wolfhece._builtin_plugins.grid_adder.companion
Grid Adder — built-in companion plugin.
Adds a configurable reference grid to the active WolfMapViewer’s object tree.
This is a one-shot action: no mouse/keyboard interaction is required. The companion adds a single “Grid” top-level menu to the viewer’s menu bar.
Module Contents
- class wolfhece._builtin_plugins.grid_adder.companion.GridAdderCompanion(*, dialogs=None)[source]
Bases:
wolfhece.plugins.abc.AbstractUICompanion
Adds a configurable reference grid to the viewer’s object tree.
Menu entry: Grid → Add grid…
Calling
start()(or selecting the menu item) opens a float-input dialog asking for the cell size in map units, then inserts aGridinstance into the viewer’s vector layer list.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.
- _on_add(ctx: wolfhece._viewer_plugin_handlers.MouseContext) None[source]