0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-13 03:01:50 +02:00

feat!: namespace update for gui, dock_area and docks.

This commit is contained in:
2025-03-13 10:06:11 +01:00
committed by appel_c
parent 17f7c05f85
commit a4614973b6
5 changed files with 17 additions and 3 deletions

View File

@ -9,6 +9,7 @@ import os
import select
import subprocess
import threading
import time
from contextlib import contextmanager
from typing import TYPE_CHECKING

View File

@ -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.

View File

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

View File

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

View File

@ -71,4 +71,4 @@ class BECMainWindow(BECWidget, QMainWindow):
return dock_area
def cleanup(self):
super().close()
super().cleanup()