From 6a7ec51a99df16375467bcf0fdf5d12bd9f5a4d1 Mon Sep 17 00:00:00 2001 From: appel_c Date: Wed, 5 Mar 2025 13:47:52 +0100 Subject: [PATCH] wip cleanup --- bec_widgets/cli/client.py | 9 --------- bec_widgets/cli/client_utils.py | 3 +++ bec_widgets/widgets/containers/dock/dock.py | 2 -- bec_widgets/widgets/containers/dock/dock_area.py | 5 +++++ 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/bec_widgets/cli/client.py b/bec_widgets/cli/client.py index 77a378c3..13abe921 100644 --- a/bec_widgets/cli/client.py +++ b/bec_widgets/cli/client.py @@ -304,15 +304,6 @@ class BECDock(RPCBase): Hide the title bar of the dock. """ - @rpc_call - def get_widgets_positions(self) -> "dict": - """ - Get the positions of the widgets in the dock. - - Returns: - dict: The positions of the widgets in the dock as dict -> {(row, col, rowspan, colspan):widget} - """ - @rpc_call def available_widgets(self) -> "list": """ diff --git a/bec_widgets/cli/client_utils.py b/bec_widgets/cli/client_utils.py index a47c832f..8fc70294 100644 --- a/bec_widgets/cli/client_utils.py +++ b/bec_widgets/cli/client_utils.py @@ -20,6 +20,7 @@ from bec_lib.utils.import_utils import lazy_import, lazy_import_from import bec_widgets.cli.client as client from bec_widgets.cli.auto_updates import AutoUpdates from bec_widgets.cli.rpc.rpc_base import RPCBase +from bec_widgets.cli.rpc.rpc_widget_handler import widget_handler if TYPE_CHECKING: from bec_lib import messages @@ -432,6 +433,8 @@ class BECGuiClient(RPCBase): self, widget_info: dict[str, dict], dock_area: client.BECDockArea, dock: client.BECDock ): for widget_name, info in widget_info.items(): + # FIXME use widget_handler instead + # widget_class = widget_handler.widget_classes[info["widget_class"]] widget_class = getattr(client, info["widget_class"]) widget = widget_class(gui_id=info["gui_id"], name=widget_name, parent=dock) obj = getattr(dock_area, "elements") diff --git a/bec_widgets/widgets/containers/dock/dock.py b/bec_widgets/widgets/containers/dock/dock.py index dd4f996f..bb547c2e 100644 --- a/bec_widgets/widgets/containers/dock/dock.py +++ b/bec_widgets/widgets/containers/dock/dock.py @@ -118,9 +118,7 @@ class BECDock(BECWidget, Dock): "show_title_bar", "set_title", "hide_title_bar", - "get_widgets_positions", "available_widgets", - "move_widget", "delete", "delete_all", "attach", diff --git a/bec_widgets/widgets/containers/dock/dock_area.py b/bec_widgets/widgets/containers/dock/dock_area.py index aaf35551..f92ec5da 100644 --- a/bec_widgets/widgets/containers/dock/dock_area.py +++ b/bec_widgets/widgets/containers/dock/dock_area.py @@ -410,6 +410,11 @@ class BECDockArea(BECWidget, QWidget): Remove a temporary area from the dock area. This is a patched method of pyqtgraph's removeTempArea """ + if area not in self.dock_area.tempAreas: + # FIXME add some context for the logging, I am not sure which object is passed. + # It looks like a pyqtgraph.DockArea + logger.info(f"Attempted to remove dock_area, but was not floating.") + return self.dock_area.tempAreas.remove(area) area.window().close() area.window().deleteLater()