wolfhece._builtin_plugins.grid_adder.companion ============================================== .. py:module:: wolfhece._builtin_plugins.grid_adder.companion .. autoapi-nested-parse:: 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 --------------- .. py:class:: GridAdderCompanion(*, dialogs=None) Bases: :py:obj:`wolfhece.plugins.abc.AbstractUICompanion` .. autoapi-inheritance-diagram:: wolfhece._builtin_plugins.grid_adder.companion.GridAdderCompanion :parts: 1 :private-bases: Adds a configurable reference grid to the viewer's object tree. Menu entry: *Grid → Add grid…* Calling :meth:`start` (or selecting the menu item) opens a float-input dialog asking for the cell size in map units, then inserts a :class:`~wolfhece.pyvertexvectors.Grid` instance into the viewer's vector layer list. .. py:method:: menu_spec() 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 :meth:`build`. Do not call directly. .. py:method:: start() -> None Programmatic activation — show the size dialog and insert the grid. .. py:method:: _on_add(ctx: wolfhece._viewer_plugin_handlers.MouseContext) -> None .. py:method:: _do_add_grid() -> None Ask for cell size, then add a Grid to the viewer's tree.