wolfhece._dike_manager ====================== .. py:module:: wolfhece._dike_manager .. autoapi-nested-parse:: Dike companion object for WolfMapViewer. All dike-simulation management logic lives here (DikeWolf objects, menu, event dispatch, creation). Injectors are *not* part of this companion — they register themselves via ``WolfMapViewer.add_object(which='injector')`` when ``DikeWolf.set_injector()`` is called. ``WolfMapViewer`` holds a single instance as ``self._dike = DikeManager(self)`` and exposes one-line delegators so that external callers remain unaffected. Module Contents --------------- .. py:class:: DikeManager(viewer: wolfhece.PyDraw.WolfMapViewer) Companion object that owns dike-simulation state. Instantiated unconditionally as ``viewer._dike = DikeManager(viewer)`` inside ``WolfMapViewer.__init__``. If the *wolfpydike* package is not installed, ``available`` is ``False`` and all operations are no-ops or log an error. .. py:attribute:: available :type: bool :value: True .. py:attribute:: _viewer .. py:attribute:: mydikes :type: list[wolfhece.dike.DikeWolf] :value: [] .. py:attribute:: active :type: DikeWolf | None :value: None .. py:attribute:: _menu :type: wx.Menu | None :value: None .. py:method:: register(newobj: wolfhece.dike.DikeWolf) -> None Add *newobj* to the registry and make it the active dike. .. py:method:: menu_build() -> None Create and append the 'Dike' menu to the viewer menubar. Safe to call multiple times — only the first call has any effect. Silently returns if wolfpydike is not available. .. py:method:: _active_guard() -> bool Return True if available and active dike exists, log and return False otherwise. .. py:method:: _on_lumped(event: wx.MenuEvent) -> None .. py:method:: _on_injector(event: wx.MenuEvent) -> None .. py:method:: _on_coupled(event: wx.MenuEvent) -> None .. py:method:: _on_triang(event: wx.MenuEvent) -> None .. py:method:: _on_discharge(event: wx.MenuEvent) -> None .. py:method:: _on_levels(event: wx.MenuEvent) -> None .. py:method:: _on_breach(event: wx.MenuEvent) -> None .. py:method:: _on_params(event: wx.MenuEvent) -> None .. py:method:: new_dike(itemlabel: str) -> None Handle 'Create dike...' and 'Add dike...' menu items.