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 frommywmsback/mywmsfore).
Module Contents
- class wolfhece._builtin_plugins.wms_base.WmsLayerCompanion[source]
Bases:
wolfhece.plugins.abc.AbstractUICompanion
Base companion for plugins that load WMS layers.
Subclasses only need to implement
_do_load_layers()and call_add_wms()instead ofself._viewer.add_objectdirectly.menu_build()andstart()are already wired up.On deactivation (
menu_destroy()), all layers added via_add_wms()are removed from the viewer tree and frommywmsback/mywmsfore.- _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
imagetextureinstance.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.