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._plugin_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.DotPickerModel[source]
Bases:
wolfhece.plugins.factory.PointPickerModel
Business state for the Dot Picker plugin.
Keeps domain operations explicit for the built-in plugin example while reusing the base point-picker state structure.
- class wolfhece._builtin_plugins.dot_picker.companion.DotPickerCompanion[source]
Bases:
wolfhece.plugins.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.- create_model() DotPickerModel[source]
Create the companion’s optional pure business model.
Override this to keep domain logic independent from UI concerns while staying in the same plugin module (companion + model in one file).
Default implementation returns
None.
- property model_state: DotPickerModel[source]
Declare the companion’s menu as a
(title, items)pair.Override this to add a menu without writing wx code:
def menu_spec(self) -> tuple[str, list[MenuEntry]] | None: return (_('My Tool'), [ MenuItem(_('Run'), self._on_run, _('Execute the tool')), SEPARATOR, SubMenuSpec(_('Settings'), [ MenuItem(_('Configure…'), self._on_configure), ]), ])
Return
None(the default) when no top-level menu is needed.Called automatically by
build(). Do not call directly.
- actions_spec()[source]
Declare interactive handlers to register with the viewer.
Override this method declaratively by returning
ActionSpecand/orMultiStepSpecrows. The proxy performs registration and handler adaptation:def actions_spec(self): return [ ActionSpec(self._pick.action_id, ldown=self._ldown, key=self._key), MultiStepSpec( 'wall', steps=[ StepSpec(hint='Pick first point', ldown=self._step1), StepSpec(hint='Pick second point', ldown=self._step2), ], ), ]
For
MultiStepSpec, handlers can returnStepTransitionvalues (or equivalent strings) to drive the runtime state machine.Return
None(or an empty iterable) when there is no action to register.Called automatically by
build(). Do not call directly.
- _on_pick(ctx: wolfhece._viewer_plugin_handlers.MouseContext) None[source]
- _on_clear(ctx: wolfhece._viewer_plugin_handlers.MouseContext) None[source]