LCOV - code coverage report
Current view: top level - src/pairinteraction_gui/plotwidget - navigation_toolbar.py (source / functions) Hit Total Coverage
Test: coverage.info Lines: 8 8 100.0 %
Date: 2025-06-06 09:09:03 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             : 
       4           1 : from typing import Optional
       5             : 
       6           1 : from matplotlib.backends.backend_qt import NavigationToolbar2QT as NavigationToolbar
       7           1 : from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg
       8           1 : from PySide6.QtWidgets import QWidget
       9             : 
      10             : 
      11           1 : class CustomNavigationToolbar(NavigationToolbar):
      12             :     """Custom navigation toolbar for matplotlib figures.
      13             : 
      14             :     See Also:
      15             :     https://stackoverflow.com/questions/12695678/how-to-modify-the-navigation-toolbar-easily-in-a-matplotlib-figure-window/15549675#15549675
      16             : 
      17             :     """
      18             : 
      19           1 :     toolitems = (
      20             :         ("Zoom", "Zoom to rectangle\nx/y fixes axis", "zoom_to_rect", "zoom"),
      21             :         ("Pan", "Left button pans, Right button zooms\nx/y fixes axis, CTRL fixes aspect", "move", "pan"),
      22             :         ("Home", "Reset original view", "home", "home"),
      23             :     )  # type: ignore [assignment]
      24             : 
      25           1 :     def __init__(self, canvas: FigureCanvasQTAgg, parent: Optional[QWidget] = None) -> None:
      26             :         """Initialize the custom navigation toolbar."""
      27           1 :         super().__init__(canvas, parent, coordinates=False)

Generated by: LCOV version 1.16