wolfhece._builtin_plugins.dot_picker.companion ============================================== .. py:module:: wolfhece._builtin_plugins.dot_picker.companion .. autoapi-nested-parse:: 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 :class:`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 --------------- .. py:class:: DotPickerCompanion(viewer: wolfhece.PyDraw.WolfMapViewer) Bases: :py:obj:`wolfhece._companion_factory.PointPickerCompanion` .. autoapi-inheritance-diagram:: wolfhece._builtin_plugins.dot_picker.companion.DotPickerCompanion :parts: 1 :private-bases: Point-picker companion exposed as a plugin. Adds a *"Dot Picker"* entry to the viewer's menu bar. Inherits all interaction logic from :class:`PointPickerCompanion`. .. py:method:: menu_build() -> None 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 :meth:`_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. .. py:method:: start() -> None Activate the pick action (called by the plugin manager). .. py:method:: _on_pick(event) -> None .. py:method:: _on_clear(event) -> None