napari_track_edit.application_menus.menu_manager ================================================ .. py:module:: napari_track_edit.application_menus.menu_manager Classes ------- .. autoapisummary:: napari_track_edit.application_menus.menu_manager.MenuManager Module Contents --------------- .. py:class:: MenuManager(viewer: napari.Viewer) Initializes and manages the menu widgets, including show/hide functionality and tracking active widgets. .. py:attribute:: viewer .. py:attribute:: tracks_viewer .. py:attribute:: hidden :value: False .. py:attribute:: initialized_menu_widgets :type: set[str] .. py:attribute:: visible_menus :type: set[str] .. py:attribute:: active_tabs :type: list[str] :value: [] .. py:attribute:: menu_widgets :type: dict[str, qtpy.QtWidgets.QScrollArea] .. py:method:: initialize_menu(menu: dict[str, dict[str, Any]]) -> None Initialize the menu by creating and adding the specified widgets, with robust handling for closed/deleted dock widgets. .. py:method:: destroy_menu_widget(name: str) -> None Destroy a menu widget and everything it holds on to. Clicking the 'x' on a tab calls napari's ``remove_dock_widget``, which deletes the QDockWidget but leaves the widget behind as a parentless orphan: it stays alive for as long as anything still references it and keeps reacting to TracksViewer signals (rebuilding the tree, re-filling the table) with nothing to show it in. By giving the widget a `cleanup` method, we can properly disconnect from these signals and remove it. .. py:method:: _on_dock_destroyed(name: str) -> None Call the menu widget's cleanup method when its dock is destroyed .. py:method:: _find_dock_widget_by_name(name: str) -> qtpy.QtWidgets.QScrollArea | None Find a widget in the dock dock by name, or return None if not found or deleted. .. py:method:: set_tabbar_location(location: str = 'North') -> None Set tabbar location. :param location: :type location: str, one of (North, East, South, West) to map the tabbar to .. py:method:: _create_scroll_wrapper(widget: qtpy.QtWidgets.QWidget) -> qtpy.QtWidgets.QScrollArea Wrap a widget in a QScrollArea to make it scrollable. .. py:method:: _get_foreground_tabs() -> list[str] Get the names of the currently active tabs (dock widgets that are both initialized and currently present in a dock). .. py:method:: set_foreground_tabs(tab_names: list[str]) -> None Set the specified tab to the foreground. .. py:method:: _get_visible_tabs() -> set[str] Get the names of the current foreground tabs .. py:method:: toggle_menu_panel_visibility() -> None Toggle visibility of all active menu widgets.