diff --git a/bec_widgets/cli/client_utils.py b/bec_widgets/cli/client_utils.py index 35a7c4e7..21add492 100644 --- a/bec_widgets/cli/client_utils.py +++ b/bec_widgets/cli/client_utils.py @@ -9,6 +9,7 @@ import os import select import subprocess import threading +import time from contextlib import contextmanager from typing import TYPE_CHECKING diff --git a/bec_widgets/cli/rpc/rpc_register.py b/bec_widgets/cli/rpc/rpc_register.py index 459336ae..91f03308 100644 --- a/bec_widgets/cli/rpc/rpc_register.py +++ b/bec_widgets/cli/rpc/rpc_register.py @@ -73,6 +73,20 @@ class RPCRegister: rpc_object = self._rpc_register.get(gui_id, None) return rpc_object + def get_rpc_by_name(self, name: str) -> QObject | None: + """ + Get an RPC object by its name. + + Args: + name(str): The name of the RPC object to be retrieved. + + Returns: + QObject | None: The RPC object with the given name. + """ + rpc_object = [rpc for rpc in self._rpc_register if rpc._name == name] + rpc_object = rpc_object[0] if len(rpc_object) > 0 else None + return rpc_object + def list_all_connections(self) -> dict: """ List all the registered RPC objects. diff --git a/bec_widgets/utils/bec_widget.py b/bec_widgets/utils/bec_widget.py index e90bfb4a..0b7eecff 100644 --- a/bec_widgets/utils/bec_widget.py +++ b/bec_widgets/utils/bec_widget.py @@ -55,7 +55,6 @@ class BECWidget(BECConnector): """ if not isinstance(self, QWidget): raise RuntimeError(f"{repr(self)} is not a subclass of QWidget") - super().__init__(client=client, config=config, gui_id=gui_id, name=name) self._parent_dock = parent_dock app = QApplication.instance() diff --git a/bec_widgets/widgets/containers/dock/dock_area.py b/bec_widgets/widgets/containers/dock/dock_area.py index 1c1724b7..1a06fc09 100644 --- a/bec_widgets/widgets/containers/dock/dock_area.py +++ b/bec_widgets/widgets/containers/dock/dock_area.py @@ -467,7 +467,7 @@ class BECDockArea(BECWidget, QWidget): dock.hide_title_bar() else: raise ValueError(f"Dock with name {dock_name} does not exist.") - # self._broadcast_update() + self._broadcast_update() def remove(self) -> None: """Remove the dock area.""" diff --git a/bec_widgets/widgets/containers/main_window/main_window.py b/bec_widgets/widgets/containers/main_window/main_window.py index 76b689b4..dfd09dbc 100644 --- a/bec_widgets/widgets/containers/main_window/main_window.py +++ b/bec_widgets/widgets/containers/main_window/main_window.py @@ -71,4 +71,4 @@ class BECMainWindow(BECWidget, QMainWindow): return dock_area def cleanup(self): - super().close() + super().cleanup()