mirror of
https://github.com/bec-project/bec_widgets.git
synced 2025-07-14 03:31:50 +02:00
WIP bec connector by default do not register RPC = False to rpc register
This commit is contained in:
@ -22,7 +22,6 @@ class Widgets(str, enum.Enum):
|
||||
BECQueue = "BECQueue"
|
||||
BECStatusBox = "BECStatusBox"
|
||||
DapComboBox = "DapComboBox"
|
||||
DarkModeButton = "DarkModeButton"
|
||||
DeviceBrowser = "DeviceBrowser"
|
||||
DeviceComboBox = "DeviceComboBox"
|
||||
DeviceLineEdit = "DeviceLineEdit"
|
||||
@ -625,15 +624,6 @@ class DapComboBox(RPCBase):
|
||||
"""
|
||||
|
||||
|
||||
class DarkModeButton(RPCBase):
|
||||
@rpc_call
|
||||
def toggle_dark_mode(self) -> "None":
|
||||
"""
|
||||
Toggle the dark mode state. This will change the theme of the entire
|
||||
application to dark or light mode.
|
||||
"""
|
||||
|
||||
|
||||
class DemoApp(RPCBase):
|
||||
@rpc_call
|
||||
def remove(self):
|
||||
|
@ -75,6 +75,7 @@ class BECConnector:
|
||||
"""Connection mixin class to handle BEC client and device manager"""
|
||||
|
||||
USER_ACCESS = ["_config_dict", "_get_all_rpc", "_rpc_id"]
|
||||
RPC = True
|
||||
EXIT_HANDLERS = {}
|
||||
|
||||
def __init__(
|
||||
@ -129,7 +130,8 @@ class BECConnector:
|
||||
raise ValueError(f"Name {name} contains invalid characters.")
|
||||
self._name = name if name else self.__class__.__name__
|
||||
self.rpc_register = RPCRegister()
|
||||
self.rpc_register.add_rpc(self)
|
||||
if self.RPC is True:
|
||||
self.rpc_register.add_rpc(self)
|
||||
|
||||
# Error popups
|
||||
self.error_utility = ErrorPopupUtility()
|
||||
|
@ -167,9 +167,7 @@ class CLIServer:
|
||||
# 1) Gather ALL BECConnector-based widgets
|
||||
all_qwidgets = QApplication.allWidgets()
|
||||
bec_widgets = set(w for w in all_qwidgets if isinstance(w, BECConnector))
|
||||
bec_widgets = {
|
||||
c for c in bec_widgets if not (hasattr(c, "RPC") and c.RPC is False)
|
||||
} # FIXME not needed
|
||||
bec_widgets = {c for c in bec_widgets if c.RPC is not False} # FIXME not needed
|
||||
|
||||
# 2) Also gather BECConnector-based data items from PlotBase
|
||||
# TODO do we need to access plot data items in cli in namespace?
|
||||
|
@ -9,10 +9,10 @@ from bec_widgets.utils.colors import set_theme
|
||||
|
||||
|
||||
class DarkModeButton(BECWidget, QWidget):
|
||||
USER_ACCESS = ["toggle_dark_mode"]
|
||||
|
||||
ICON_NAME = "dark_mode"
|
||||
PLUGIN = True
|
||||
RPC = False
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@ -99,9 +99,6 @@ class DarkModeButton(BECWidget, QWidget):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from qtpy.QtWidgets import QApplication
|
||||
|
||||
from bec_widgets.utils.colors import set_theme
|
||||
|
||||
app = QApplication([])
|
||||
set_theme("auto")
|
||||
|
Reference in New Issue
Block a user