wolfhece._builtin_plugins.wms_base ================================== .. py:module:: wolfhece._builtin_plugins.wms_base .. autoapi-nested-parse:: Shared base companion for WMS plugins. All WMS companions inherit from :class:`WmsLayerCompanion` instead of :class:`AbstractUICompanion` directly. The base class provides: * automatic layer tracking via :meth:`_add_wms`, * automatic tree cleanup in :meth:`menu_destroy` when the plugin is disabled (removes both the tree items and the objects from ``mywmsback`` / ``mywmsfore``). Module Contents --------------- .. py:class:: WmsLayerCompanion Bases: :py:obj:`wolfhece.plugins.abc.AbstractUICompanion` .. autoapi-inheritance-diagram:: wolfhece._builtin_plugins.wms_base.WmsLayerCompanion :parts: 1 :private-bases: Base companion for plugins that load WMS layers. Subclasses only need to implement :meth:`_do_load_layers` and call :meth:`_add_wms` instead of ``self._viewer.add_object`` directly. :meth:`menu_build` and :meth:`start` are already wired up. On deactivation (:meth:`menu_destroy`), all layers added via :meth:`_add_wms` are removed from the viewer tree and from ``mywmsback`` / ``mywmsfore``. .. py:attribute:: _loaded_objects :type: list .. py:method:: build() -> None Load WMS layers immediately on plugin activation. .. py:method:: start() -> None Reload all layers (e.g. called from a notebook). .. py:method:: destroy() -> None Remove all tracked WMS layers from the tree and internal lists. .. py:method:: _add_wms(which: str, obj, id: str) -> None Add *obj* to the viewer as a WMS layer and track it for cleanup. :param which: ``'wmsback'`` or ``'wmsfore'``. :param obj: An :class:`~wolfhece.wolf_texture.imagetexture` instance. :param id: The tree label / identifier for the layer. .. py:method:: _do_load_layers() -> None :abstractmethod: Load and register all WMS layers for this plugin. Concrete subclasses must override this method and call :meth:`_add_wms` for each layer.