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

Inheritance diagram of wolfhece._builtin_plugins.grid_adder.companion.GridAdderCompanion

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 a Grid instance into the viewer’s vector layer list.

menu_spec()[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.

start() None[source]

Programmatic activation — show the size dialog and insert the grid.

_on_add(ctx: wolfhece._viewer_plugin_handlers.MouseContext) None[source]
_do_add_grid() None[source]

Ask for cell size, then add a Grid to the viewer’s tree.