bec-widgets 0.79.3__py3-none-any.whl → 0.82.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. .gitlab-ci.yml +0 -1
  2. .pylintrc +1 -1
  3. CHANGELOG.md +52 -62
  4. PKG-INFO +1 -4
  5. README.md +2 -2
  6. bec_widgets/cli/client.py +3 -2
  7. bec_widgets/cli/generate_cli.py +11 -10
  8. bec_widgets/cli/rpc_wigdet_handler.py +1 -1
  9. bec_widgets/examples/__init__.py +0 -9
  10. bec_widgets/utils/bec_connector.py +2 -1
  11. bec_widgets/utils/bec_dispatcher.py +3 -3
  12. bec_widgets/utils/bec_widget.py +2 -0
  13. bec_widgets/utils/entry_validator.py +1 -1
  14. bec_widgets/utils/plugin_utils.py +80 -10
  15. bec_widgets/utils/ui_loader.py +85 -26
  16. bec_widgets/widgets/{device_inputs → base_classes}/device_input_base.py +2 -0
  17. bec_widgets/widgets/color_button/color_button.py +36 -0
  18. bec_widgets/widgets/{buttons/color_button → color_button}/color_button_plugin.py +1 -1
  19. bec_widgets/widgets/{buttons/color_button → color_button}/register_color_button.py +1 -1
  20. bec_widgets/widgets/device_combobox/assets/device_combobox_icon.png +0 -0
  21. bec_widgets/widgets/{device_inputs/device_combobox → device_combobox}/device_combobox.py +2 -2
  22. bec_widgets/widgets/device_combobox/device_combobox.pyproject +3 -0
  23. bec_widgets/widgets/{device_inputs/device_combobox → device_combobox}/device_combobox_plugin.py +6 -3
  24. bec_widgets/widgets/{device_inputs/device_combobox → device_combobox}/register_device_combobox.py +1 -3
  25. bec_widgets/widgets/device_line_edit/assets/line_edit_icon.png +0 -0
  26. bec_widgets/widgets/{device_inputs/device_line_edit → device_line_edit}/device_line_edit.py +2 -2
  27. bec_widgets/widgets/device_line_edit/device_line_edit.pyproject +3 -0
  28. bec_widgets/widgets/{device_inputs/device_line_edit → device_line_edit}/device_line_edit_plugin.py +6 -3
  29. bec_widgets/widgets/{device_inputs/device_line_edit → device_line_edit}/register_device_line_edit.py +1 -3
  30. bec_widgets/widgets/figure/plots/waveform/waveform.py +8 -2
  31. bec_widgets/widgets/motor_map/motor_map_dialog/motor_map_settings.py +1 -1
  32. bec_widgets/widgets/motor_map/motor_map_dialog/motor_map_toolbar.py +1 -1
  33. bec_widgets/widgets/motor_map/motor_map_widget.py +0 -12
  34. bec_widgets/widgets/scan_control/scan_control.py +1 -1
  35. bec_widgets/widgets/scan_control/scan_group_box.py +1 -1
  36. bec_widgets/widgets/stop_button/assets/stop.png +0 -0
  37. bec_widgets/widgets/stop_button/register_stop_button.py +15 -0
  38. bec_widgets/widgets/{buttons/stop_button → stop_button}/stop_button.py +5 -12
  39. bec_widgets/widgets/stop_button/stop_button.pyproject +1 -0
  40. bec_widgets/widgets/stop_button/stop_button_plugin.py +57 -0
  41. bec_widgets/widgets/toggle/register_toggle_switch.py +15 -0
  42. bec_widgets/widgets/toggle/toggle.py +149 -0
  43. bec_widgets/widgets/toggle/toggle_switch.pyproject +1 -0
  44. bec_widgets/widgets/toggle/toggle_switch_plugin.py +54 -0
  45. {bec_widgets-0.79.3.dist-info → bec_widgets-0.82.0.dist-info}/METADATA +1 -4
  46. {bec_widgets-0.79.3.dist-info → bec_widgets-0.82.0.dist-info}/RECORD +66 -74
  47. docs/introduction/introduction.md +1 -1
  48. docs/user/getting_started/installation.md +2 -2
  49. pyproject.toml +1 -2
  50. tests/unit_tests/test_device_input_base.py +1 -1
  51. tests/unit_tests/test_device_input_widgets.py +2 -2
  52. tests/unit_tests/test_generate_cli_client.py +41 -17
  53. tests/unit_tests/test_plugin_utils.py +2 -3
  54. tests/unit_tests/test_stop_button.py +5 -2
  55. tests/unit_tests/test_toggle.py +38 -0
  56. bec_widgets/examples/motor_movement/__init__.py +0 -9
  57. bec_widgets/examples/motor_movement/motor_control_compilations.py +0 -250
  58. bec_widgets/examples/motor_movement/motor_controller.ui +0 -926
  59. bec_widgets/widgets/buttons/__init__.py +0 -1
  60. bec_widgets/widgets/buttons/color_button/color_button.py +0 -17
  61. bec_widgets/widgets/device_inputs/__init__.py +0 -2
  62. bec_widgets/widgets/device_inputs/device_combobox/device_combobox.pyproject +0 -4
  63. bec_widgets/widgets/device_inputs/device_combobox/launch_device_combobox.py +0 -11
  64. bec_widgets/widgets/device_inputs/device_line_edit/device_line_edit.pyproject +0 -4
  65. bec_widgets/widgets/device_inputs/device_line_edit/launch_device_line_edit.py +0 -11
  66. bec_widgets/widgets/motor_control/motor_control.py +0 -252
  67. bec_widgets/widgets/motor_control/motor_table/motor_table.py +0 -484
  68. bec_widgets/widgets/motor_control/motor_table/motor_table.ui +0 -113
  69. bec_widgets/widgets/motor_control/movement_absolute/__init__.py +0 -0
  70. bec_widgets/widgets/motor_control/movement_absolute/movement_absolute.py +0 -159
  71. bec_widgets/widgets/motor_control/movement_absolute/movement_absolute.ui +0 -149
  72. bec_widgets/widgets/motor_control/movement_relative/__init__.py +0 -0
  73. bec_widgets/widgets/motor_control/movement_relative/movement_relative.py +0 -230
  74. bec_widgets/widgets/motor_control/movement_relative/movement_relative.ui +0 -298
  75. bec_widgets/widgets/motor_control/selection/__init__.py +0 -0
  76. bec_widgets/widgets/motor_control/selection/selection.py +0 -110
  77. bec_widgets/widgets/motor_control/selection/selection.ui +0 -69
  78. tests/unit_tests/test_motor_control.py +0 -588
  79. /bec_widgets/widgets/{buttons/color_button → base_classes}/__init__.py +0 -0
  80. /bec_widgets/widgets/{buttons/stop_button → color_button}/__init__.py +0 -0
  81. /bec_widgets/widgets/{buttons/color_button → color_button}/assets/color_button.png +0 -0
  82. /bec_widgets/widgets/{buttons/color_button → color_button}/color_button.pyproject +0 -0
  83. /bec_widgets/widgets/{device_inputs/device_combobox → device_combobox}/__init__.py +0 -0
  84. /bec_widgets/widgets/{device_inputs/device_line_edit → device_line_edit}/__init__.py +0 -0
  85. /bec_widgets/widgets/{motor_control → stop_button}/__init__.py +0 -0
  86. /bec_widgets/widgets/{motor_control/motor_table → toggle}/__init__.py +0 -0
  87. {bec_widgets-0.79.3.dist-info → bec_widgets-0.82.0.dist-info}/WHEEL +0 -0
  88. {bec_widgets-0.79.3.dist-info → bec_widgets-0.82.0.dist-info}/entry_points.txt +0 -0
  89. {bec_widgets-0.79.3.dist-info → bec_widgets-0.82.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,250 +0,0 @@
1
- # pylint: disable = no-name-in-module,missing-class-docstring, missing-module-docstring
2
-
3
- import qdarktheme
4
- from qtpy.QtCore import Qt
5
- from qtpy.QtWidgets import QApplication, QSplitter, QVBoxLayout, QWidget
6
-
7
- from bec_widgets.utils.bec_dispatcher import BECDispatcher
8
- from bec_widgets.widgets.motor_control.motor_control import MotorThread
9
- from bec_widgets.widgets.motor_control.motor_table.motor_table import MotorCoordinateTable
10
- from bec_widgets.widgets.motor_control.movement_absolute.movement_absolute import (
11
- MotorControlAbsolute,
12
- )
13
- from bec_widgets.widgets.motor_control.movement_relative.movement_relative import (
14
- MotorControlRelative,
15
- )
16
- from bec_widgets.widgets.motor_control.selection.selection import MotorControlSelection
17
-
18
- CONFIG_DEFAULT = {
19
- "motor_control": {
20
- "motor_x": "samx",
21
- "motor_y": "samy",
22
- "step_size_x": 3,
23
- "step_size_y": 3,
24
- "precision": 4,
25
- "step_x_y_same": False,
26
- "move_with_arrows": False,
27
- },
28
- "plot_settings": {
29
- "colormap": "Greys",
30
- "scatter_size": 5,
31
- "max_points": 1000,
32
- "num_dim_points": 100,
33
- "precision": 2,
34
- "num_columns": 1,
35
- "background_value": 25,
36
- },
37
- "motors": [
38
- {
39
- "plot_name": "Motor Map",
40
- "x_label": "Motor X",
41
- "y_label": "Motor Y",
42
- "signals": {
43
- "x": [{"name": "samx", "entry": "samx"}],
44
- "y": [{"name": "samy", "entry": "samy"}],
45
- },
46
- }
47
- ],
48
- }
49
-
50
-
51
- class MotorControlApp(QWidget):
52
- def __init__(self, parent=None, client=None, config=None):
53
- super().__init__(parent)
54
-
55
- bec_dispatcher = BECDispatcher()
56
- self.client = bec_dispatcher.client if client is None else client
57
- self.config = config
58
-
59
- # Widgets
60
- self.motor_control_panel = MotorControlPanel(client=self.client, config=self.config)
61
- # Create MotorMap
62
- # self.motion_map = MotorMap(client=self.client, config=self.config)
63
- # Create MotorCoordinateTable
64
- self.motor_table = MotorCoordinateTable(client=self.client, config=self.config)
65
-
66
- # Create the splitter and add MotorMap and MotorControlPanel
67
- splitter = QSplitter(Qt.Horizontal)
68
- # splitter.addWidget(self.motion_map)
69
- splitter.addWidget(self.motor_control_panel)
70
- splitter.addWidget(self.motor_table)
71
-
72
- # Set the main layout
73
- layout = QVBoxLayout(self)
74
- layout.addWidget(splitter)
75
- self.setLayout(layout)
76
-
77
- # Connecting signals and slots
78
- # self.motor_control_panel.selection_widget.selected_motors_signal.connect(
79
- # lambda x, y: self.motion_map.change_motors(x, y, 0)
80
- # )
81
- self.motor_control_panel.absolute_widget.coordinates_signal.connect(
82
- self.motor_table.add_coordinate
83
- )
84
- self.motor_control_panel.relative_widget.precision_signal.connect(
85
- self.motor_table.set_precision
86
- )
87
- self.motor_control_panel.relative_widget.precision_signal.connect(
88
- self.motor_control_panel.absolute_widget.set_precision
89
- )
90
-
91
- # self.motor_table.plot_coordinates_signal.connect(self.motion_map.plot_saved_coordinates)
92
-
93
-
94
- class MotorControlMap(QWidget):
95
- def __init__(self, parent=None, client=None, config=None):
96
- super().__init__(parent)
97
-
98
- bec_dispatcher = BECDispatcher()
99
- self.client = bec_dispatcher.client if client is None else client
100
- self.config = config
101
-
102
- # Widgets
103
- self.motor_control_panel = MotorControlPanel(client=self.client, config=self.config)
104
- # Create MotorMap
105
- # self.motion_map = MotorMap(client=self.client, config=self.config)
106
-
107
- # Create the splitter and add MotorMap and MotorControlPanel
108
- splitter = QSplitter(Qt.Horizontal)
109
- # splitter.addWidget(self.motion_map)
110
- splitter.addWidget(self.motor_control_panel)
111
-
112
- # Set the main layout
113
- layout = QVBoxLayout(self)
114
- layout.addWidget(splitter)
115
- self.setLayout(layout)
116
-
117
- # Connecting signals and slots
118
- # self.motor_control_panel.selection_widget.selected_motors_signal.connect(
119
- # lambda x, y: self.motion_map.change_motors(x, y, 0)
120
- # )
121
-
122
-
123
- class MotorControlPanel(QWidget):
124
- def __init__(self, parent=None, client=None, config=None):
125
- super().__init__(parent)
126
-
127
- bec_dispatcher = BECDispatcher()
128
- self.client = bec_dispatcher.client if client is None else client
129
- self.config = config
130
-
131
- self.motor_thread = MotorThread(client=self.client)
132
-
133
- self.selection_widget = MotorControlSelection(
134
- client=self.client, config=self.config, motor_thread=self.motor_thread
135
- )
136
- self.relative_widget = MotorControlRelative(
137
- client=self.client, config=self.config, motor_thread=self.motor_thread
138
- )
139
- self.absolute_widget = MotorControlAbsolute(
140
- client=self.client, config=self.config, motor_thread=self.motor_thread
141
- )
142
-
143
- layout = QVBoxLayout(self)
144
-
145
- layout.addWidget(self.selection_widget)
146
- layout.addWidget(self.relative_widget)
147
- layout.addWidget(self.absolute_widget)
148
-
149
- # Connecting signals and slots
150
- self.selection_widget.selected_motors_signal.connect(self.relative_widget.change_motors)
151
- self.selection_widget.selected_motors_signal.connect(self.absolute_widget.change_motors)
152
-
153
- # Set the window to a fixed size based on its contents
154
- # self.layout().setSizeConstraint(layout.SetFixedSize)
155
-
156
-
157
- class MotorControlPanelAbsolute(QWidget):
158
- def __init__(self, parent=None, client=None, config=None):
159
- super().__init__(parent)
160
-
161
- bec_dispatcher = BECDispatcher()
162
- self.client = bec_dispatcher.client if client is None else client
163
- self.config = config
164
-
165
- self.motor_thread = MotorThread(client=self.client)
166
-
167
- self.selection_widget = MotorControlSelection(
168
- client=client, config=config, motor_thread=self.motor_thread
169
- )
170
- self.absolute_widget = MotorControlAbsolute(
171
- client=client, config=config, motor_thread=self.motor_thread
172
- )
173
-
174
- layout = QVBoxLayout(self)
175
- layout.addWidget(self.selection_widget)
176
- layout.addWidget(self.absolute_widget)
177
-
178
- # Connecting signals and slots
179
- self.selection_widget.selected_motors_signal.connect(self.absolute_widget.change_motors)
180
-
181
-
182
- class MotorControlPanelRelative(QWidget):
183
- def __init__(self, parent=None, client=None, config=None):
184
- super().__init__(parent)
185
-
186
- bec_dispatcher = BECDispatcher()
187
- self.client = bec_dispatcher.client if client is None else client
188
- self.config = config
189
-
190
- self.motor_thread = MotorThread(client=self.client)
191
-
192
- self.selection_widget = MotorControlSelection(
193
- client=client, config=config, motor_thread=self.motor_thread
194
- )
195
- self.relative_widget = MotorControlRelative(
196
- client=client, config=config, motor_thread=self.motor_thread
197
- )
198
-
199
- layout = QVBoxLayout(self)
200
- layout.addWidget(self.selection_widget)
201
- layout.addWidget(self.relative_widget)
202
-
203
- # Connecting signals and slots
204
- self.selection_widget.selected_motors_signal.connect(self.relative_widget.change_motors)
205
-
206
-
207
- if __name__ == "__main__": # pragma: no cover
208
- import argparse
209
- import sys
210
-
211
- parser = argparse.ArgumentParser(description="Run various Motor Control Widgets compositions.")
212
- parser.add_argument(
213
- "-v",
214
- "--variant",
215
- type=str,
216
- choices=["app", "map", "panel", "panel_abs", "panel_rel"],
217
- help="Select the variant of the motor control to run. "
218
- "'app' for the full application, "
219
- "'map' for MotorMap, "
220
- "'panel' for the MotorControlPanel, "
221
- "'panel_abs' for MotorControlPanel with absolute control, "
222
- "'panel_rel' for MotorControlPanel with relative control.",
223
- )
224
-
225
- args = parser.parse_args()
226
-
227
- bec_dispatcher = BECDispatcher()
228
- client = bec_dispatcher.client
229
- client.start()
230
-
231
- app = QApplication([])
232
- qdarktheme.setup_theme("auto")
233
-
234
- if args.variant == "app":
235
- window = MotorControlApp(client=client) # , config=CONFIG_DEFAULT)
236
- elif args.variant == "map":
237
- window = MotorControlMap(client=client) # , config=CONFIG_DEFAULT)
238
- elif args.variant == "panel":
239
- window = MotorControlPanel(client=client) # , config=CONFIG_DEFAULT)
240
- elif args.variant == "panel_abs":
241
- window = MotorControlPanelAbsolute(client=client) # , config=CONFIG_DEFAULT)
242
- elif args.variant == "panel_rel":
243
- window = MotorControlPanelRelative(client=client) # , config=CONFIG_DEFAULT)
244
- else:
245
- print("Please specify a valid variant to run. Use -h for help.")
246
- print("Running the full application by default.")
247
- window = MotorControlApp(client=client) # , config=CONFIG_DEFAULT)
248
-
249
- window.show()
250
- sys.exit(app.exec())