wolfhece._builtin_plugins._template.companion
Template companion plugin.
Replace every occurrence of MyPlugin / my_plugin with your own name,
then implement the methods below.
Rename this directory to match the name field in plugin.toml
(removing the leading _ so it is auto-discovered).
Recommended structure to keep plugin footprint minimal: - one Python module containing both the pure business model and the UI
companion adapter,
one metadata file (
plugin.toml).
Module Contents
- class wolfhece._builtin_plugins._template.companion.MyPluginModel[source]
Bases:
wolfhece.plugins.abc.AbstractCompanionModel
Pure domain state: no viewer/wx/OpenGL dependencies.
- class wolfhece._builtin_plugins._template.companion.MyPluginCompanion[source]
Bases:
wolfhece.plugins.abc.AbstractUICompanion
Minimal template — replace with your implementation.
- create_model() MyPluginModel[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.
Add a sub-menu entry in Companions main menu. Remove if no menu is needed.
- 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_run(ctx: wolfhece._viewer_plugin_handlers.MouseContext) None[source]
- rdown(ctx: wolfhece._viewer_plugin_handlers.MouseContext) None[source]
- step1_rdown(ctx: wolfhece._viewer_plugin_handlers.MouseContext) wolfhece.plugins.abc.StepTransition[source]
- step2_rdown(ctx: wolfhece._viewer_plugin_handlers.MouseContext) wolfhece.plugins.abc.StepTransition[source]
- key(kb: wolfhece._viewer_plugin_handlers.KeyboardSnapshot) bool | wolfhece.plugins.abc.StepTransition[source]