wolfhece._builtin_plugins.wms_base

Shared base companion for WMS plugins.

All WMS companions inherit from WmsLayerCompanion instead of AbstractUICompanion directly. The base class provides:

  • automatic layer tracking via _add_wms(),

  • automatic tree cleanup in menu_destroy() when the plugin is disabled (removes both the tree items and the objects from mywmsback / mywmsfore).

Module Contents

class wolfhece._builtin_plugins.wms_base.WmsLayerCompanion[source]

Bases: wolfhece.plugins.abc.AbstractUICompanion

Inheritance diagram of wolfhece._builtin_plugins.wms_base.WmsLayerCompanion

Base companion for plugins that load WMS layers.

Subclasses only need to implement _do_load_layers() and call _add_wms() instead of self._viewer.add_object directly. menu_build() and start() are already wired up.

On deactivation (menu_destroy()), all layers added via _add_wms() are removed from the viewer tree and from mywmsback / mywmsfore.

_loaded_objects: list[source]
build() None[source]

Load WMS layers immediately on plugin activation.

start() None[source]

Reload all layers (e.g. called from a notebook).

destroy() None[source]

Remove all tracked WMS layers from the tree and internal lists.

_add_wms(which: str, obj, id: str) None[source]

Add obj to the viewer as a WMS layer and track it for cleanup.

Parameters:
  • which'wmsback' or 'wmsfore'.

  • obj – An imagetexture instance.

  • id – The tree label / identifier for the layer.

abstractmethod _do_load_layers() None[source]

Load and register all WMS layers for this plugin.

Concrete subclasses must override this method and call _add_wms() for each layer.