mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 11:41:49 +02:00
fix(dock_area): save/restore state is saved in config
This commit is contained in:
@ -1,9 +1,8 @@
|
|||||||
# This file was automatically generated by generate_cli.py
|
# 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 typing import Literal, Optional, overload
|
||||||
|
|
||||||
from bec_widgets.cli.client_utils import BECGuiClientMixin, RPCBase, rpc_call
|
|
||||||
|
|
||||||
|
|
||||||
class BECPlotBase(RPCBase):
|
class BECPlotBase(RPCBase):
|
||||||
@property
|
@property
|
||||||
@ -1528,6 +1527,16 @@ class BECDock(RPCBase):
|
|||||||
|
|
||||||
|
|
||||||
class BECDockArea(RPCBase, BECGuiClientMixin):
|
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
|
@property
|
||||||
@rpc_call
|
@rpc_call
|
||||||
def panels(self) -> "dict":
|
def panels(self) -> "dict":
|
||||||
|
@ -16,10 +16,14 @@ from .dock import BECDock, DockConfig
|
|||||||
|
|
||||||
class DockAreaConfig(ConnectionConfig):
|
class DockAreaConfig(ConnectionConfig):
|
||||||
docks: dict[str, DockConfig] = Field({}, description="The docks in the dock area.")
|
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):
|
class BECDockArea(BECConnector, DockArea):
|
||||||
USER_ACCESS = [
|
USER_ACCESS = [
|
||||||
|
"config_dict",
|
||||||
"panels",
|
"panels",
|
||||||
"save_state",
|
"save_state",
|
||||||
"remove_dock",
|
"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.
|
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:
|
if state is None:
|
||||||
state = self._last_state
|
state = self.config.docks_state
|
||||||
self.restoreState(state, missing=missing, extra=extra)
|
self.restoreState(state, missing=missing, extra=extra)
|
||||||
|
|
||||||
def save_state(self) -> dict:
|
def save_state(self) -> dict:
|
||||||
@ -91,8 +95,9 @@ class BECDockArea(BECConnector, DockArea):
|
|||||||
Returns:
|
Returns:
|
||||||
dict: The state of the dock area.
|
dict: The state of the dock area.
|
||||||
"""
|
"""
|
||||||
self._last_state = self.saveState()
|
last_state = self.saveState()
|
||||||
return self._last_state
|
self.config.docks_state = last_state
|
||||||
|
return last_state
|
||||||
|
|
||||||
def remove_dock(self, name: str):
|
def remove_dock(self, name: str):
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user