wolfhece._builtin_plugins.dot_picker.companion
Dot Picker — example companion plugin.
- Demonstrates the minimal pattern:
right-click adds a point
Ctrl+Z removes the last point
Esc deactivates
This file is a simplified wrapper around
wolfhece._companion_factory.PointPickerCompanion.
Import the factory class directly in your own code if you only need the
behaviour without the plugin infrastructure.
Module Contents
- class wolfhece._builtin_plugins.dot_picker.companion.DotPickerCompanion(viewer: wolfhece.PyDraw.WolfMapViewer)[source]
Bases:
wolfhece._companion_factory.PointPickerCompanion
Point-picker companion exposed as a plugin.
Adds a “Dot Picker” entry to the viewer’s menu bar. Inherits all interaction logic from
PointPickerCompanion.Build and attach the companion’s menu to the viewer menubar.
The default implementation does nothing — companions that work purely through mouse/keyboard interactions do not need a menu. Override this method when a menu is desired.
Preferred — wx-free approach using
_build_menu():def menu_build(self) -> None: self._build_menu(_('My Feature'), [ ActionItem(_('Do something'), self._on_do), SEPARATOR, SubMenuSpec(_('Tools'), [ ActionItem(_('Export'), self._on_export), ]), ])
Alternative — full wx control (for advanced cases):
def menu_build(self) -> None: if self._menu is not None: return import wx self._menu = wx.Menu() ...
Implementations must be idempotent.