diff --git a/bec_widgets/cli/client.py b/bec_widgets/cli/client.py index 9bd674fb..e461c9f6 100644 --- a/bec_widgets/cli/client.py +++ b/bec_widgets/cli/client.py @@ -1,9 +1,8 @@ # This file was automatically generated by generate_cli.py +from bec_widgets.cli.client_utils import rpc_call, RPCBase, BECGuiClientMixin from typing import Literal, Optional, overload -from bec_widgets.cli.client_utils import BECGuiClientMixin, RPCBase, rpc_call - class BECPlotBase(RPCBase): @property @@ -1528,6 +1527,16 @@ class BECDock(RPCBase): class BECDockArea(RPCBase, BECGuiClientMixin): + @property + @rpc_call + def config_dict(self) -> "dict": + """ + Get the configuration of the widget. + + Returns: + dict: The configuration of the widget. + """ + @property @rpc_call def panels(self) -> "dict": diff --git a/bec_widgets/widgets/dock/dock_area.py b/bec_widgets/widgets/dock/dock_area.py index 669e0ceb..ce8fabdc 100644 --- a/bec_widgets/widgets/dock/dock_area.py +++ b/bec_widgets/widgets/dock/dock_area.py @@ -16,10 +16,14 @@ from .dock import BECDock, DockConfig class DockAreaConfig(ConnectionConfig): docks: dict[str, DockConfig] = Field({}, description="The docks in the dock area.") + docks_state: Optional[dict] = Field( + None, description="The state of the docks in the dock area." + ) class BECDockArea(BECConnector, DockArea): USER_ACCESS = [ + "config_dict", "panels", "save_state", "remove_dock", @@ -81,7 +85,7 @@ class BECDockArea(BECConnector, DockArea): extra(str): Extra docks that are in the dockarea but that are not mentioned in state will be added to the bottom of the dockarea, unless otherwise specified by the extra argument. """ if state is None: - state = self._last_state + state = self.config.docks_state self.restoreState(state, missing=missing, extra=extra) def save_state(self) -> dict: @@ -91,8 +95,9 @@ class BECDockArea(BECConnector, DockArea): Returns: dict: The state of the dock area. """ - self._last_state = self.saveState() - return self._last_state + last_state = self.saveState() + self.config.docks_state = last_state + return last_state def remove_dock(self, name: str): """