diff --git a/bec_widgets/cli/client.py b/bec_widgets/cli/client.py index 5a5d359c..4a98aaa8 100644 --- a/bec_widgets/cli/client.py +++ b/bec_widgets/cli/client.py @@ -35,8 +35,6 @@ _Widgets = { "DapComboBox": "DapComboBox", "DarkModeButton": "DarkModeButton", "DeviceBrowser": "DeviceBrowser", - "DeviceComboBox": "DeviceComboBox", - "DeviceLineEdit": "DeviceLineEdit", "Heatmap": "Heatmap", "Image": "Image", "LogPanel": "LogPanel", @@ -56,9 +54,7 @@ _Widgets = { "ScanControl": "ScanControl", "ScanProgressBar": "ScanProgressBar", "ScatterWaveform": "ScatterWaveform", - "SignalComboBox": "SignalComboBox", "SignalLabel": "SignalLabel", - "SignalLineEdit": "SignalLineEdit", "TextBox": "TextBox", "VSCodeEditor": "VSCodeEditor", "Waveform": "Waveform", @@ -1048,29 +1044,6 @@ class DeviceBrowser(RPCBase): """ -class DeviceComboBox(RPCBase): - """Combobox widget for device input with autocomplete for device names.""" - - @rpc_call - def set_device(self, device: "str"): - """ - Set the device. - - Args: - device (str): Default name. - """ - - @property - @rpc_call - def devices(self) -> "list[str]": - """ - Get the list of devices for the applied filters. - - Returns: - list[str]: List of devices. - """ - - class DeviceInitializationProgressBar(RPCBase): """A progress bar that displays the progress of device initialization.""" @@ -1115,39 +1088,6 @@ class DeviceInputBase(RPCBase): """ -class DeviceLineEdit(RPCBase): - """Line edit widget for device input with autocomplete for device names.""" - - @rpc_call - def set_device(self, device: "str"): - """ - Set the device. - - Args: - device (str): Default name. - """ - - @property - @rpc_call - def devices(self) -> "list[str]": - """ - Get the list of devices for the applied filters. - - Returns: - list[str]: List of devices. - """ - - @property - @rpc_call - def _is_valid_input(self) -> bool: - """ - Check if the current value is a valid device name. - - Returns: - bool: True if the current value is a valid device name, False otherwise. - """ - - class DockAreaWidget(RPCBase): """Lightweight dock area that exposes the core Qt ADS docking helpers without any""" @@ -5411,49 +5351,6 @@ class ScatterWaveform(RPCBase): """ -class SignalComboBox(RPCBase): - """Line edit widget for device input with autocomplete for device names.""" - - @rpc_call - def set_signal(self, signal: str): - """ - Set the signal. - - Args: - signal (str): signal name. - """ - - @rpc_call - def set_device(self, device: "str | None"): - """ - Set the device. When signal_class_filter is active, ensures base-class - logic runs and then refreshes the signal list to show only signals from - that device matching the signal class filter. - - Args: - device(str): device name. - """ - - @property - @rpc_call - def signals(self) -> list[str]: - """ - Get the list of device signals for the applied filters. - - Returns: - list[str]: List of device signals. - """ - - @rpc_call - def get_signal_name(self) -> "str": - """ - Get the signal name from the combobox. - - Returns: - str: The signal name. - """ - - class SignalLabel(RPCBase): @property @rpc_call @@ -5596,48 +5493,6 @@ class SignalLabel(RPCBase): """ -class SignalLineEdit(RPCBase): - """Line edit widget for device input with autocomplete for device names.""" - - @property - @rpc_call - def _is_valid_input(self) -> bool: - """ - Check if the current value is a valid device name. - - Returns: - bool: True if the current value is a valid device name, False otherwise. - """ - - @rpc_call - def set_signal(self, signal: str): - """ - Set the signal. - - Args: - signal (str): signal name. - """ - - @rpc_call - def set_device(self, device: str | None): - """ - Set the device. If device is not valid, device will be set to None which happens - - Args: - device(str): device name. - """ - - @property - @rpc_call - def signals(self) -> list[str]: - """ - Get the list of device signals for the applied filters. - - Returns: - list[str]: List of device signals. - """ - - class TextBox(RPCBase): """A widget that displays text in plain and HTML format""" diff --git a/bec_widgets/widgets/control/device_input/device_combobox/device_combobox.py b/bec_widgets/widgets/control/device_input/device_combobox/device_combobox.py index cd07ef6d..0dcb569d 100644 --- a/bec_widgets/widgets/control/device_input/device_combobox/device_combobox.py +++ b/bec_widgets/widgets/control/device_input/device_combobox/device_combobox.py @@ -1,7 +1,6 @@ from bec_lib.callback_handler import EventType from bec_lib.device import ReadoutPriority from qtpy.QtCore import QSize, Signal, Slot -from qtpy.QtGui import QPainter, QPaintEvent, QPen from qtpy.QtWidgets import QComboBox, QSizePolicy from bec_widgets.utils.colors import get_accent_colors @@ -30,10 +29,9 @@ class DeviceComboBox(DeviceInputBase, QComboBox): signal_class_filter: List of signal classes to filter the devices by. Only devices with signals of these classes will be shown. """ - USER_ACCESS = ["set_device", "devices"] - ICON_NAME = "list_alt" PLUGIN = True + RPC = False device_selected = Signal(str) device_reset = Signal() diff --git a/bec_widgets/widgets/control/device_input/device_line_edit/device_line_edit.py b/bec_widgets/widgets/control/device_input/device_line_edit/device_line_edit.py index e9d523fd..5917b806 100644 --- a/bec_widgets/widgets/control/device_input/device_line_edit/device_line_edit.py +++ b/bec_widgets/widgets/control/device_input/device_line_edit/device_line_edit.py @@ -31,12 +31,11 @@ class DeviceLineEdit(DeviceInputBase, QLineEdit): arg_name: Argument name, can be used for the other widgets which has to call some other function in bec using correct argument names. """ - USER_ACCESS = ["set_device", "devices", "_is_valid_input"] - device_selected = Signal(str) device_config_update = Signal() PLUGIN = True + RPC = False ICON_NAME = "edit_note" def __init__( diff --git a/bec_widgets/widgets/control/device_input/signal_combobox/signal_combobox.py b/bec_widgets/widgets/control/device_input/signal_combobox/signal_combobox.py index dcc8b879..892d30ab 100644 --- a/bec_widgets/widgets/control/device_input/signal_combobox/signal_combobox.py +++ b/bec_widgets/widgets/control/device_input/signal_combobox/signal_combobox.py @@ -38,7 +38,7 @@ class SignalComboBox(DeviceSignalInputBase, QComboBox): ICON_NAME = "list_alt" PLUGIN = True - RPC = True + RPC = False device_signal_changed = Signal(str) signal_reset = Signal() diff --git a/bec_widgets/widgets/control/device_input/signal_line_edit/signal_line_edit.py b/bec_widgets/widgets/control/device_input/signal_line_edit/signal_line_edit.py index 759706a1..a7e9fe1f 100644 --- a/bec_widgets/widgets/control/device_input/signal_line_edit/signal_line_edit.py +++ b/bec_widgets/widgets/control/device_input/signal_line_edit/signal_line_edit.py @@ -29,7 +29,7 @@ class SignalLineEdit(DeviceSignalInputBase, QLineEdit): device_signal_changed = Signal(str) PLUGIN = True - RPC = True + RPC = False ICON_NAME = "vital_signs" def __init__( diff --git a/tests/end-2-end/user_interaction/test_user_interaction_e2e.py b/tests/end-2-end/user_interaction/test_user_interaction_e2e.py index aba9a6d1..8307b948 100644 --- a/tests/end-2-end/user_interaction/test_user_interaction_e2e.py +++ b/tests/end-2-end/user_interaction/test_user_interaction_e2e.py @@ -221,95 +221,6 @@ def test_widgets_e2e_device_browser(qtbot, connected_client_gui_obj, random_gene maybe_remove_dock_area(qtbot, gui=gui, random_int_gen=random_generator_from_seed) -@pytest.mark.timeout(PYTEST_TIMEOUT) -def test_widgets_e2e_device_combo_box(qtbot, connected_client_gui_obj, random_generator_from_seed): - """Test the DeviceComboBox widget.""" - gui = connected_client_gui_obj - bec = gui._client - # Create dock_area and widget - widget = create_widget(qtbot, gui, gui.available_widgets.DeviceComboBox) - widget: client.DeviceComboBox - - assert "samx" in widget.devices - assert "bpm4i" in widget.devices - - widget.set_device("samx") - - # Test removing the widget, or leaving it open for the next test - maybe_remove_dock_area(qtbot, gui=gui, random_int_gen=random_generator_from_seed) - - -@pytest.mark.timeout(PYTEST_TIMEOUT) -def test_widgets_e2e_device_line_edit(qtbot, connected_client_gui_obj, random_generator_from_seed): - """Test the DeviceLineEdit widget.""" - gui = connected_client_gui_obj - bec = gui._client - # Create dock_area and widget - widget = create_widget(qtbot, gui, gui.available_widgets.DeviceLineEdit) - widget: client.DeviceLineEdit - - assert widget._is_valid_input is False - assert "samx" in widget.devices - assert "bpm4i" in widget.devices - - widget.set_device("samx") - assert widget._is_valid_input is True - - # Test removing the widget, or leaving it open for the next test - maybe_remove_dock_area(qtbot, gui=gui, random_int_gen=random_generator_from_seed) - - -@pytest.mark.timeout(PYTEST_TIMEOUT) -def test_widgets_e2e_signal_line_edit(qtbot, connected_client_gui_obj, random_generator_from_seed): - """Test the DeviceSignalLineEdit widget.""" - gui = connected_client_gui_obj - bec = gui._client - # Create dock_area and widget - widget = create_widget(qtbot, gui, gui.available_widgets.SignalLineEdit) - widget: client.SignalLineEdit - - widget.set_device("samx") - assert widget._is_valid_input is False - assert widget.signals == [ - "readback", - "setpoint", - "motor_is_moving", - "velocity", - "acceleration", - "tolerance", - ] - widget.set_signal("readback") - assert widget._is_valid_input is True - - # Test removing the widget, or leaving it open for the next test - maybe_remove_dock_area(qtbot, gui=gui, random_int_gen=random_generator_from_seed) - - -@pytest.mark.timeout(PYTEST_TIMEOUT) -def test_widgets_e2e_signal_combobox(qtbot, connected_client_gui_obj, random_generator_from_seed): - """Test the DeviceSignalComboBox widget.""" - gui = connected_client_gui_obj - bec = gui._client - # Create dock_area and widget - widget = create_widget(qtbot, gui, gui.available_widgets.SignalComboBox) - widget: client.SignalComboBox - - widget.set_device("samx") - info = bec.device_manager.devices.samx._info["signals"] - assert widget.signals == [ - ["samx (readback)", info.get("readback")], - ["setpoint", info.get("setpoint")], - ["motor_is_moving", info.get("motor_is_moving")], - ["velocity", info.get("velocity")], - ["acceleration", info.get("acceleration")], - ["tolerance", info.get("tolerance")], - ] - widget.set_signal("samx (readback)") - - # Test removing the widget, or leaving it open for the next test - maybe_remove_dock_area(qtbot, gui=gui, random_int_gen=random_generator_from_seed) - - @pytest.mark.timeout(PYTEST_TIMEOUT) def test_widgets_e2e_image(qtbot, connected_client_gui_obj, random_generator_from_seed): """Test the Image widget.""" diff --git a/tests/unit_tests/test_client_plugin_widgets.py b/tests/unit_tests/test_client_plugin_widgets.py index d438031f..a863c58c 100644 --- a/tests/unit_tests/test_client_plugin_widgets.py +++ b/tests/unit_tests/test_client_plugin_widgets.py @@ -34,9 +34,9 @@ class _TestDuplicatePlugin(RPCBase): ... mock_client_module_duplicate = SimpleNamespace() -_TestDuplicatePlugin.__name__ = "DeviceComboBox" +_TestDuplicatePlugin.__name__ = "Waveform" -mock_client_module_duplicate.DeviceComboBox = _TestDuplicatePlugin +mock_client_module_duplicate.Waveform = _TestDuplicatePlugin @patch("bec_lib.logger.bec_logger") @@ -47,14 +47,14 @@ mock_client_module_duplicate.DeviceComboBox = _TestDuplicatePlugin @patch( "bec_widgets.utils.bec_plugin_helper.get_all_plugin_widgets", return_value=BECClassContainer( - [BECClassInfo(name="DeviceComboBox", obj=_TestDuplicatePlugin, module="", file="")] + [BECClassInfo(name="Waveform", obj=_TestDuplicatePlugin, module="", file="")] ), ) def test_duplicate_plugins_not_allowed(_, bec_logger: MagicMock): reload(client) assert ( call( - f"Detected duplicate widget DeviceComboBox in plugin repo file: {inspect.getfile(_TestDuplicatePlugin)} !" + f"Detected duplicate widget Waveform in plugin repo file: {inspect.getfile(_TestDuplicatePlugin)} !" ) in bec_logger.logger.warning.mock_calls )