wolfhece._menu_companion_template

Template module for menu-based companions.

Purpose

This file is a starter kit to create new companions following the same structure used in existing managers such as:

  • _qdfidf_manager.py

  • _simtools2d_manager.py

  • _weir_manager.py

  • _particlesystem_manager.py

How to use

  1. Copy this file and rename class/module to your feature.

  2. Instantiate it in WolfMapViewer.__init__.

  3. Call menu_build() from the same place where other companion menus are built.

  4. Replace example handlers with your business logic.

Integration sketch in PyDraw.py

from ._my_feature_manager import MyFeatureManager … self._my_feature_mgr = MyFeatureManager(self) … self._my_feature_mgr.menu_build()

Module Contents

class wolfhece._menu_companion_template.MenuCompanionTemplate(viewer: wolfhece.PyDraw.WolfMapViewer)[source]

Reusable template for a menu-based companion manager.

_viewer[source]
_menu: wx.Menu | None = None[source]
_submenu_tools: wx.Menu | None = None[source]
menu_build() None[source]

Build the top-level menu once and bind all handlers.

_require_active_array() bool[source]

Return True if an active array exists, else log and abort.

_show_error(message: str) None[source]

Show a standard error dialog.

_on_check_context(event: wx.MenuEvent) None[source]

Minimal action showing guard usage.

_on_pick(event: wx.MenuEvent) None[source]

Interactive action example (ActionKind driven).

_on_run_tool(event: wx.MenuEvent) None[source]

Long action example with progress dialog and final refresh.

_on_export(event: wx.MenuEvent) None[source]

Export-like action with explicit try/except error flow.