LCOV - code coverage report
Current view: top level - src/pairinteraction_gui/plotwidget - navigation_toolbar.py (source / functions) Hit Total Coverage
Test: coverage.info Lines: 7 7 100.0 %
Date: 2025-09-29 10:28:29 Functions: 1 2 50.0 %

          Line data    Source code
       1             : # SPDX-FileCopyrightText: 2025 PairInteraction Developers
       2             : # SPDX-License-Identifier: LGPL-3.0-or-later
       3           1 : from __future__ import annotations
       4             : 
       5           1 : from typing import TYPE_CHECKING
       6             : 
       7           1 : from matplotlib.backends.backend_qt import NavigationToolbar2QT as NavigationToolbar
       8             : 
       9             : if TYPE_CHECKING:
      10             :     from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg
      11             :     from PySide6.QtWidgets import QWidget
      12             : 
      13             : 
      14           1 : class CustomNavigationToolbar(NavigationToolbar):
      15             :     """Custom navigation toolbar for matplotlib figures.
      16             : 
      17             :     See Also:
      18             :     https://stackoverflow.com/questions/12695678/how-to-modify-the-navigation-toolbar-easily-in-a-matplotlib-figure-window/15549675#15549675
      19             : 
      20             :     """
      21             : 
      22           1 :     toolitems = (
      23             :         ("Zoom", "Zoom to rectangle\nx/y fixes axis", "zoom_to_rect", "zoom"),
      24             :         ("Pan", "Left button pans, Right button zooms\nx/y fixes axis, CTRL fixes aspect", "move", "pan"),
      25             :         ("Home", "Reset original view", "home", "home"),
      26             :     )  # type: ignore [assignment]
      27             : 
      28           1 :     def __init__(self, canvas: FigureCanvasQTAgg, parent: QWidget | None = None) -> None:
      29             :         """Initialize the custom navigation toolbar."""
      30           1 :         super().__init__(canvas, parent, coordinates=False)

Generated by: LCOV version 1.16