1
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2026-03-08 09:47:48 +01:00

wip cleanup

This commit is contained in:
2025-03-05 13:47:52 +01:00
committed by wyzula-jan
parent 5f11a44f27
commit 6a7ec51a99
4 changed files with 8 additions and 11 deletions

View File

@@ -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":
"""

View File

@@ -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")

View File

@@ -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",

View File

@@ -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()