bec-widgets 0.99.1__py3-none-any.whl → 0.99.9__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 (250) hide show
  1. .gitlab-ci.yml +0 -1
  2. CHANGELOG.md +76 -70
  3. PKG-INFO +2 -2
  4. bec_widgets/cli/client.py +3 -3
  5. bec_widgets/qt_utils/toolbar.py +11 -5
  6. bec_widgets/utils/bec_widget.py +11 -2
  7. bec_widgets/utils/colors.py +18 -2
  8. bec_widgets/utils/plugin_templates/plugin.template +2 -2
  9. bec_widgets/widgets/bec_queue/bec_queue.py +2 -0
  10. bec_widgets/widgets/bec_queue/bec_queue_plugin.py +1 -1
  11. bec_widgets/widgets/bec_status_box/bec_status_box.py +2 -0
  12. bec_widgets/widgets/bec_status_box/bec_status_box_plugin.py +1 -1
  13. bec_widgets/widgets/color_button/color_button.py +2 -0
  14. bec_widgets/widgets/color_button/color_button_plugin.py +1 -1
  15. bec_widgets/widgets/colormap_selector/colormap_selector.py +1 -0
  16. bec_widgets/widgets/colormap_selector/colormap_selector_plugin.py +1 -1
  17. bec_widgets/widgets/dark_mode_button/dark_mode_button.py +12 -3
  18. bec_widgets/widgets/dark_mode_button/dark_mode_button_plugin.py +1 -1
  19. bec_widgets/widgets/device_browser/device_browser.py +2 -0
  20. bec_widgets/widgets/device_browser/device_browser_plugin.py +1 -1
  21. bec_widgets/widgets/device_combobox/device_combo_box_plugin.py +1 -1
  22. bec_widgets/widgets/device_combobox/device_combobox.py +2 -0
  23. bec_widgets/widgets/device_line_edit/device_line_edit.py +2 -0
  24. bec_widgets/widgets/device_line_edit/device_line_edit_plugin.py +1 -1
  25. bec_widgets/widgets/dock/dock.py +1 -0
  26. bec_widgets/widgets/dock/dock_area.py +30 -10
  27. bec_widgets/widgets/dock/dock_area_plugin.py +1 -1
  28. bec_widgets/widgets/figure/figure.py +1 -1
  29. bec_widgets/widgets/figure/plots/waveform/waveform.py +12 -7
  30. bec_widgets/widgets/figure/plots/waveform/waveform_curve.py +3 -3
  31. bec_widgets/widgets/image/bec_image_widget_plugin.py +1 -1
  32. bec_widgets/widgets/image/image_widget.py +1 -0
  33. bec_widgets/widgets/motor_map/bec_motor_map_widget_plugin.py +1 -1
  34. bec_widgets/widgets/motor_map/motor_map_widget.py +1 -0
  35. bec_widgets/widgets/position_indicator/position_indicator.py +2 -0
  36. bec_widgets/widgets/position_indicator/position_indicator_plugin.py +1 -1
  37. bec_widgets/widgets/positioner_box/positioner_box.py +1 -0
  38. bec_widgets/widgets/positioner_box/positioner_box_plugin.py +1 -1
  39. bec_widgets/widgets/positioner_box/positioner_control_line.py +2 -0
  40. bec_widgets/widgets/positioner_box/positioner_control_line_plugin.py +1 -1
  41. bec_widgets/widgets/ring_progress_bar/ring_progress_bar.py +1 -0
  42. bec_widgets/widgets/ring_progress_bar/ring_progress_bar_plugin.py +1 -1
  43. bec_widgets/widgets/scan_control/scan_control.py +2 -0
  44. bec_widgets/widgets/scan_control/scan_control_plugin.py +1 -4
  45. bec_widgets/widgets/spinner/spinner.py +2 -0
  46. bec_widgets/widgets/spinner/spinner_widget_plugin.py +1 -1
  47. bec_widgets/widgets/stop_button/stop_button.py +2 -0
  48. bec_widgets/widgets/stop_button/stop_button_plugin.py +1 -1
  49. bec_widgets/widgets/text_box/text_box.py +1 -0
  50. bec_widgets/widgets/text_box/text_box_plugin.py +1 -1
  51. bec_widgets/widgets/toggle/toggle.py +1 -0
  52. bec_widgets/widgets/toggle/toggle_switch_plugin.py +1 -1
  53. bec_widgets/widgets/vscode/vs_code_editor_plugin.py +1 -1
  54. bec_widgets/widgets/vscode/vscode.py +1 -0
  55. bec_widgets/widgets/waveform/bec_waveform_widget_plugin.py +1 -1
  56. bec_widgets/widgets/waveform/waveform_popups/curve_dialog/curve_dialog.py +14 -13
  57. bec_widgets/widgets/waveform/waveform_widget.py +3 -2
  58. bec_widgets/widgets/website/website.py +42 -10
  59. bec_widgets/widgets/website/website_widget_plugin.py +1 -1
  60. {bec_widgets-0.99.1.dist-info → bec_widgets-0.99.9.dist-info}/METADATA +2 -2
  61. bec_widgets-0.99.9.dist-info/RECORD +231 -0
  62. pyproject.toml +7 -2
  63. bec_widgets/assets/toolbar_icons/add.svg +0 -3
  64. bec_widgets/assets/toolbar_icons/attach_all.svg +0 -3
  65. bec_widgets/assets/toolbar_icons/auto_range.svg +0 -3
  66. bec_widgets/assets/toolbar_icons/compare.svg +0 -3
  67. bec_widgets/assets/toolbar_icons/connection.svg +0 -4
  68. bec_widgets/assets/toolbar_icons/device_line_edit.svg +0 -3
  69. bec_widgets/assets/toolbar_icons/drag_pan_mode.svg +0 -3
  70. bec_widgets/assets/toolbar_icons/export.svg +0 -9
  71. bec_widgets/assets/toolbar_icons/fft.svg +0 -11
  72. bec_widgets/assets/toolbar_icons/fitting_parameters.svg +0 -3
  73. bec_widgets/assets/toolbar_icons/history.svg +0 -4
  74. bec_widgets/assets/toolbar_icons/image.svg +0 -3
  75. bec_widgets/assets/toolbar_icons/image_autorange.svg +0 -3
  76. bec_widgets/assets/toolbar_icons/import.svg +0 -9
  77. bec_widgets/assets/toolbar_icons/line_axis.svg +0 -3
  78. bec_widgets/assets/toolbar_icons/line_curve.svg +0 -3
  79. bec_widgets/assets/toolbar_icons/lock_aspect_ratio.svg +0 -3
  80. bec_widgets/assets/toolbar_icons/log_scale.png +0 -0
  81. bec_widgets/assets/toolbar_icons/motor_map.svg +0 -3
  82. bec_widgets/assets/toolbar_icons/photo_library.svg +0 -3
  83. bec_widgets/assets/toolbar_icons/positioner_box.svg +0 -3
  84. bec_widgets/assets/toolbar_icons/progress.svg +0 -3
  85. bec_widgets/assets/toolbar_icons/queue.svg +0 -3
  86. bec_widgets/assets/toolbar_icons/rectangle_mode.svg +0 -3
  87. bec_widgets/assets/toolbar_icons/remove.svg +0 -5
  88. bec_widgets/assets/toolbar_icons/reset_settings.svg +0 -3
  89. bec_widgets/assets/toolbar_icons/restore_state.svg +0 -3
  90. bec_widgets/assets/toolbar_icons/ring_progress.svg +0 -3
  91. bec_widgets/assets/toolbar_icons/rotate_left.svg +0 -3
  92. bec_widgets/assets/toolbar_icons/rotate_right.svg +0 -3
  93. bec_widgets/assets/toolbar_icons/save.svg +0 -3
  94. bec_widgets/assets/toolbar_icons/save_state.svg +0 -3
  95. bec_widgets/assets/toolbar_icons/scan_control.svg +0 -3
  96. bec_widgets/assets/toolbar_icons/settings.svg +0 -4
  97. bec_widgets/assets/toolbar_icons/status.svg +0 -3
  98. bec_widgets/assets/toolbar_icons/terminal.svg +0 -3
  99. bec_widgets/assets/toolbar_icons/transform.svg +0 -3
  100. bec_widgets/assets/toolbar_icons/waveform.svg +0 -3
  101. bec_widgets-0.99.1.dist-info/RECORD +0 -415
  102. docs/Makefile +0 -20
  103. docs/_static/custom.css +0 -170
  104. docs/_templates/custom-class-template.rst +0 -34
  105. docs/_templates/custom-module-template.rst +0 -66
  106. docs/api_reference/api_reference.md +0 -12
  107. docs/assets/apps_48dp.svg +0 -1
  108. docs/assets/display_settings_48dp.svg +0 -1
  109. docs/assets/index_api.svg +0 -97
  110. docs/assets/index_contribute.svg +0 -76
  111. docs/assets/index_getting_started.svg +0 -66
  112. docs/assets/index_user_guide.svg +0 -67
  113. docs/assets/rocket_launch_48dp.svg +0 -1
  114. docs/assets/widget_screenshots/buttons.png +0 -0
  115. docs/assets/widget_screenshots/device_box.png +0 -0
  116. docs/assets/widget_screenshots/device_browser.png +0 -0
  117. docs/assets/widget_screenshots/device_inputs.png +0 -0
  118. docs/assets/widget_screenshots/dock_area.png +0 -0
  119. docs/assets/widget_screenshots/figure.png +0 -0
  120. docs/assets/widget_screenshots/image_widget.png +0 -0
  121. docs/assets/widget_screenshots/motor_map_widget.png +0 -0
  122. docs/assets/widget_screenshots/position_indicator.png +0 -0
  123. docs/assets/widget_screenshots/queue.png +0 -0
  124. docs/assets/widget_screenshots/ring_progress_bar.png +0 -0
  125. docs/assets/widget_screenshots/scan_controller.png +0 -0
  126. docs/assets/widget_screenshots/spinner.gif +0 -0
  127. docs/assets/widget_screenshots/status_box.png +0 -0
  128. docs/assets/widget_screenshots/text_box.png +0 -0
  129. docs/assets/widget_screenshots/toggle.png +0 -0
  130. docs/assets/widget_screenshots/waveform_widget.png +0 -0
  131. docs/assets/widget_screenshots/website.png +0 -0
  132. docs/conf.py +0 -82
  133. docs/developer/developer.md +0 -52
  134. docs/developer/introduction/concepts.md +0 -14
  135. docs/developer/introduction/contributing.md +0 -28
  136. docs/developer/introduction/introduction.md +0 -16
  137. docs/developer/introduction/useful_links.md +0 -23
  138. docs/developer/widget_development/bec_dispatcher.md +0 -143
  139. docs/developer/widget_development/widget_development.md +0 -13
  140. docs/index.md +0 -74
  141. docs/introduction/introduction.md +0 -18
  142. docs/make.bat +0 -35
  143. docs/requirements.txt +0 -12
  144. docs/user/api_reference/api_reference.md +0 -11
  145. docs/user/applications/applications.md +0 -10
  146. docs/user/customisation.md +0 -123
  147. docs/user/getting_started/BECDockArea.png +0 -0
  148. docs/user/getting_started/auto_updates.md +0 -82
  149. docs/user/getting_started/getting_started.md +0 -15
  150. docs/user/getting_started/gui_complex_gui.gif +0 -0
  151. docs/user/getting_started/installation.md +0 -33
  152. docs/user/getting_started/quick_start.md +0 -110
  153. docs/user/getting_started/video_tutorials.md +0 -17
  154. docs/user/user.md +0 -71
  155. docs/user/widgets/bec_figure/BECFigure.png +0 -0
  156. docs/user/widgets/bec_figure/bec_figure.md +0 -105
  157. docs/user/widgets/bec_status_box/bec_status_box.gif +0 -0
  158. docs/user/widgets/bec_status_box/bec_status_box.md +0 -38
  159. docs/user/widgets/buttons/buttons.md +0 -63
  160. docs/user/widgets/buttons/dark_mode_disabled.png +0 -0
  161. docs/user/widgets/buttons/dark_mode_enabled.png +0 -0
  162. docs/user/widgets/device_browser/device_browser.md +0 -36
  163. docs/user/widgets/device_browser/device_browser.png +0 -0
  164. docs/user/widgets/device_input/device_input.md +0 -100
  165. docs/user/widgets/dock_area/BECDockArea.png +0 -0
  166. docs/user/widgets/dock_area/bec_dock_area.md +0 -107
  167. docs/user/widgets/image/image_plot.gif +0 -0
  168. docs/user/widgets/image/image_widget.md +0 -84
  169. docs/user/widgets/motor_map/motor.gif +0 -0
  170. docs/user/widgets/motor_map/motor_map.md +0 -80
  171. docs/user/widgets/position_indicator/position_indicator.md +0 -76
  172. docs/user/widgets/positioner_box/positioner_box.md +0 -63
  173. docs/user/widgets/progress_bar/progress_bar.gif +0 -0
  174. docs/user/widgets/progress_bar/ring_progress_bar.md +0 -103
  175. docs/user/widgets/queue/queue.md +0 -41
  176. docs/user/widgets/scan_control/hide_scan_control.png +0 -0
  177. docs/user/widgets/scan_control/scan_control.gif +0 -0
  178. docs/user/widgets/scan_control/scan_control.md +0 -54
  179. docs/user/widgets/spinner/spinner.md +0 -75
  180. docs/user/widgets/text_box/text_box.md +0 -74
  181. docs/user/widgets/toggle/toggle.md +0 -66
  182. docs/user/widgets/waveform/bec_figure_dap.gif +0 -0
  183. docs/user/widgets/waveform/scatter_2D.gif +0 -0
  184. docs/user/widgets/waveform/w1D.gif +0 -0
  185. docs/user/widgets/waveform/waveform_widget.md +0 -132
  186. docs/user/widgets/website/website.md +0 -69
  187. docs/user/widgets/widgets.md +0 -220
  188. tests/__init__.py +0 -0
  189. tests/end-2-end/__init__.py +0 -0
  190. tests/end-2-end/conftest.py +0 -53
  191. tests/end-2-end/test_bec_dock_rpc_e2e.py +0 -298
  192. tests/end-2-end/test_bec_figure_rpc_e2e.py +0 -212
  193. tests/end-2-end/test_rpc_register_e2e.py +0 -40
  194. tests/end-2-end/test_scan_control_e2e.py +0 -71
  195. tests/references/SpinnerWidget/SpinnerWidget_darwin.png +0 -0
  196. tests/references/SpinnerWidget/SpinnerWidget_linux.png +0 -0
  197. tests/references/SpinnerWidget/SpinnerWidget_started_darwin.png +0 -0
  198. tests/references/SpinnerWidget/SpinnerWidget_started_linux.png +0 -0
  199. tests/unit_tests/__init__.py +0 -0
  200. tests/unit_tests/client_mocks.py +0 -189
  201. tests/unit_tests/conftest.py +0 -64
  202. tests/unit_tests/test_bec_connector.py +0 -80
  203. tests/unit_tests/test_bec_dispatcher.py +0 -119
  204. tests/unit_tests/test_bec_dock.py +0 -155
  205. tests/unit_tests/test_bec_figure.py +0 -270
  206. tests/unit_tests/test_bec_image.py +0 -63
  207. tests/unit_tests/test_bec_image_widget.py +0 -217
  208. tests/unit_tests/test_bec_motor_map.py +0 -282
  209. tests/unit_tests/test_bec_queue.py +0 -111
  210. tests/unit_tests/test_bec_status_box.py +0 -123
  211. tests/unit_tests/test_client_utils.py +0 -76
  212. tests/unit_tests/test_color_map_selector.py +0 -42
  213. tests/unit_tests/test_color_validation.py +0 -75
  214. tests/unit_tests/test_configs/config_device.yaml +0 -33
  215. tests/unit_tests/test_configs/config_device_no_entry.yaml +0 -27
  216. tests/unit_tests/test_configs/config_scan.yaml +0 -82
  217. tests/unit_tests/test_crosshair.py +0 -143
  218. tests/unit_tests/test_dark_mode_button.py +0 -70
  219. tests/unit_tests/test_device_browser.py +0 -83
  220. tests/unit_tests/test_device_input_base.py +0 -76
  221. tests/unit_tests/test_device_input_widgets.py +0 -178
  222. tests/unit_tests/test_error_utils.py +0 -63
  223. tests/unit_tests/test_generate_cli_client.py +0 -123
  224. tests/unit_tests/test_generate_plugin.py +0 -155
  225. tests/unit_tests/test_motor_map_widget.py +0 -194
  226. tests/unit_tests/test_msgs/__init__.py +0 -0
  227. tests/unit_tests/test_msgs/available_scans_message.py +0 -989
  228. tests/unit_tests/test_plot_base.py +0 -95
  229. tests/unit_tests/test_plugin_utils.py +0 -13
  230. tests/unit_tests/test_positioner_box.py +0 -130
  231. tests/unit_tests/test_ring_progress_bar.py +0 -337
  232. tests/unit_tests/test_rpc_register.py +0 -52
  233. tests/unit_tests/test_rpc_server.py +0 -42
  234. tests/unit_tests/test_rpc_widget_handler.py +0 -7
  235. tests/unit_tests/test_scan_control.py +0 -324
  236. tests/unit_tests/test_scan_control_group_box.py +0 -160
  237. tests/unit_tests/test_setting_dialog.py +0 -96
  238. tests/unit_tests/test_spinner.py +0 -31
  239. tests/unit_tests/test_stop_button.py +0 -27
  240. tests/unit_tests/test_text_box_widget.py +0 -54
  241. tests/unit_tests/test_toggle.py +0 -38
  242. tests/unit_tests/test_vscode_widget.py +0 -75
  243. tests/unit_tests/test_waveform1d.py +0 -712
  244. tests/unit_tests/test_waveform_widget.py +0 -462
  245. tests/unit_tests/test_website_widget.py +0 -25
  246. tests/unit_tests/test_widget_io.py +0 -90
  247. tests/unit_tests/test_yaml_dialog.py +0 -163
  248. {bec_widgets-0.99.1.dist-info → bec_widgets-0.99.9.dist-info}/WHEEL +0 -0
  249. {bec_widgets-0.99.1.dist-info → bec_widgets-0.99.9.dist-info}/entry_points.txt +0 -0
  250. {bec_widgets-0.99.1.dist-info → bec_widgets-0.99.9.dist-info}/licenses/LICENSE +0 -0
@@ -1,324 +0,0 @@
1
- # pylint: disable = no-name-in-module,missing-class-docstring, missing-module-docstring
2
- from unittest.mock import MagicMock
3
-
4
- import pytest
5
- from bec_lib.messages import AvailableResourceMessage
6
-
7
- from bec_widgets.utils.widget_io import WidgetIO
8
- from bec_widgets.widgets.scan_control import ScanControl
9
-
10
- from .client_mocks import mocked_client
11
-
12
- available_scans_message = AvailableResourceMessage(
13
- resource={
14
- "line_scan": {
15
- "class": "LineScan",
16
- "base_class": "ScanBase",
17
- "arg_input": {"device": "device", "start": "float", "stop": "float"},
18
- "gui_config": {
19
- "scan_class_name": "LineScan",
20
- "arg_group": {
21
- "name": "Scan Arguments",
22
- "bundle": 3,
23
- "arg_inputs": {"device": "device", "start": "float", "stop": "float"},
24
- "inputs": [
25
- {
26
- "arg": True,
27
- "name": "device",
28
- "type": "device",
29
- "display_name": "Device",
30
- "tooltip": None,
31
- "default": None,
32
- "expert": False,
33
- },
34
- {
35
- "arg": True,
36
- "name": "start",
37
- "type": "float",
38
- "display_name": "Start",
39
- "tooltip": None,
40
- "default": None,
41
- "expert": False,
42
- },
43
- {
44
- "arg": True,
45
- "name": "stop",
46
- "type": "float",
47
- "display_name": "Stop",
48
- "tooltip": None,
49
- "default": None,
50
- "expert": False,
51
- },
52
- ],
53
- "min": 1,
54
- "max": None,
55
- },
56
- "kwarg_groups": [
57
- {
58
- "name": "Movement Parameters",
59
- "inputs": [
60
- {
61
- "arg": False,
62
- "name": "steps",
63
- "type": "int",
64
- "display_name": "Steps",
65
- "tooltip": "Number of steps",
66
- "default": None,
67
- "expert": False,
68
- },
69
- {
70
- "arg": False,
71
- "name": "relative",
72
- "type": "bool",
73
- "display_name": "Relative",
74
- "tooltip": "If True, the start and end positions are relative to the current position",
75
- "default": False,
76
- "expert": False,
77
- },
78
- ],
79
- },
80
- {
81
- "name": "Acquisition Parameters",
82
- "inputs": [
83
- {
84
- "arg": False,
85
- "name": "exp_time",
86
- "type": "float",
87
- "display_name": "Exp Time",
88
- "tooltip": "Exposure time in s",
89
- "default": 0,
90
- "expert": False,
91
- },
92
- {
93
- "arg": False,
94
- "name": "burst_at_each_point",
95
- "type": "int",
96
- "display_name": "Burst At Each Point",
97
- "tooltip": "Number of acquisition per point",
98
- "default": 1,
99
- "expert": False,
100
- },
101
- ],
102
- },
103
- ],
104
- },
105
- "required_kwargs": ["steps", "relative"],
106
- "arg_bundle_size": {"bundle": 3, "min": 1, "max": None},
107
- },
108
- "grid_scan": {
109
- "class": "Scan",
110
- "base_class": "ScanBase",
111
- "arg_input": {"device": "device", "start": "float", "stop": "float", "steps": "int"},
112
- "gui_config": {
113
- "scan_class_name": "Scan",
114
- "arg_group": {
115
- "name": "Scan Arguments",
116
- "bundle": 4,
117
- "arg_inputs": {
118
- "device": "device",
119
- "start": "float",
120
- "stop": "float",
121
- "steps": "int",
122
- },
123
- "inputs": [
124
- {
125
- "arg": True,
126
- "name": "device",
127
- "type": "device",
128
- "display_name": "Device",
129
- "tooltip": None,
130
- "default": None,
131
- "expert": False,
132
- },
133
- {
134
- "arg": True,
135
- "name": "start",
136
- "type": "float",
137
- "display_name": "Start",
138
- "tooltip": None,
139
- "default": None,
140
- "expert": False,
141
- },
142
- {
143
- "arg": True,
144
- "name": "stop",
145
- "type": "float",
146
- "display_name": "Stop",
147
- "tooltip": None,
148
- "default": None,
149
- "expert": False,
150
- },
151
- {
152
- "arg": True,
153
- "name": "steps",
154
- "type": "int",
155
- "display_name": "Steps",
156
- "tooltip": None,
157
- "default": None,
158
- "expert": False,
159
- },
160
- ],
161
- "min": 2,
162
- "max": None,
163
- },
164
- "kwarg_groups": [
165
- {
166
- "name": "Scan Parameters",
167
- "inputs": [
168
- {
169
- "arg": False,
170
- "name": "exp_time",
171
- "type": "float",
172
- "display_name": "Exp Time",
173
- "tooltip": "Exposure time in seconds",
174
- "default": 0,
175
- "expert": False,
176
- },
177
- {
178
- "arg": False,
179
- "name": "settling_time",
180
- "type": "float",
181
- "display_name": "Settling Time",
182
- "tooltip": "Settling time in seconds",
183
- "default": 0,
184
- "expert": False,
185
- },
186
- {
187
- "arg": False,
188
- "name": "burst_at_each_point",
189
- "type": "int",
190
- "display_name": "Burst At Each Point",
191
- "tooltip": "Number of exposures at each point",
192
- "default": 1,
193
- "expert": False,
194
- },
195
- {
196
- "arg": False,
197
- "name": "relative",
198
- "type": "bool",
199
- "display_name": "Relative",
200
- "tooltip": "If True, the motors will be moved relative to their current position",
201
- "default": False,
202
- "expert": False,
203
- },
204
- ],
205
- }
206
- ],
207
- },
208
- "required_kwargs": ["relative"],
209
- "arg_bundle_size": {"bundle": 4, "min": 2, "max": None},
210
- },
211
- "not_supported_scan_class": {"base_class": "NotSupportedScanClass"},
212
- }
213
- )
214
-
215
-
216
- @pytest.fixture(scope="function")
217
- def scan_control(qtbot, mocked_client): # , mock_dev):
218
- mocked_client.connector.set("scans/available_scans", available_scans_message)
219
- widget = ScanControl(client=mocked_client)
220
- qtbot.addWidget(widget)
221
- qtbot.waitExposed(widget)
222
- yield widget
223
-
224
-
225
- def test_populate_scans(scan_control, mocked_client):
226
- expected_scans = ["line_scan", "grid_scan"]
227
- items = [
228
- scan_control.comboBox_scan_selection.itemText(i)
229
- for i in range(scan_control.comboBox_scan_selection.count())
230
- ]
231
-
232
- assert scan_control.comboBox_scan_selection.count() == 2
233
- assert sorted(items) == sorted(expected_scans)
234
-
235
-
236
- @pytest.mark.parametrize("scan_name", ["line_scan", "grid_scan"])
237
- def test_on_scan_selected(scan_control, scan_name):
238
- expected_scan_info = available_scans_message.resource[scan_name]
239
- scan_control.comboBox_scan_selection.setCurrentText(scan_name)
240
-
241
- # Check arg_box labels and widgets
242
- for index, (arg_key, arg_value) in enumerate(expected_scan_info["arg_input"].items()):
243
- label = scan_control.arg_box.layout.itemAtPosition(0, index).widget()
244
- assert label.text().lower() == arg_key
245
-
246
- for row in range(1, expected_scan_info["arg_bundle_size"]["min"] + 1):
247
- widget = scan_control.arg_box.layout.itemAtPosition(row, index).widget()
248
- assert widget is not None # Confirm that a widget exists
249
- expected_widget_type = scan_control.arg_box.WIDGET_HANDLER.get(arg_value, None)
250
- assert isinstance(widget, expected_widget_type) # Confirm the widget type matches
251
-
252
- # Check kwargs boxes
253
- kwargs_group = [param for param in expected_scan_info["gui_config"]["kwarg_groups"]]
254
- print(kwargs_group)
255
-
256
- for kwarg_box, kwarg_group in zip(scan_control.kwarg_boxes, kwargs_group):
257
- assert kwarg_box.title() == kwarg_group["name"]
258
- for index, kwarg_info in enumerate(kwarg_group["inputs"]):
259
- label = kwarg_box.layout.itemAtPosition(0, index).widget()
260
- assert label.text() == kwarg_info["display_name"]
261
- widget = kwarg_box.layout.itemAtPosition(1, index).widget()
262
- expected_widget_type = kwarg_box.WIDGET_HANDLER.get(kwarg_info["type"], None)
263
- assert isinstance(widget, expected_widget_type)
264
-
265
-
266
- @pytest.mark.parametrize("scan_name", ["line_scan", "grid_scan"])
267
- def test_add_remove_bundle(scan_control, scan_name, qtbot):
268
- expected_scan_info = available_scans_message.resource[scan_name]
269
- scan_control.comboBox_scan_selection.setCurrentText(scan_name)
270
-
271
- # Initial number of args row
272
- initial_num_of_rows = scan_control.arg_box.count_arg_rows()
273
-
274
- assert initial_num_of_rows == expected_scan_info["arg_bundle_size"]["min"]
275
-
276
- scan_control.button_add_bundle.click()
277
- scan_control.button_add_bundle.click()
278
-
279
- if expected_scan_info["arg_bundle_size"]["max"] is None:
280
- assert scan_control.arg_box.count_arg_rows() == initial_num_of_rows + 2
281
-
282
- # Remove one bundle
283
- scan_control.button_remove_bundle.click()
284
- qtbot.wait(200)
285
-
286
- assert scan_control.arg_box.count_arg_rows() == initial_num_of_rows + 1
287
-
288
-
289
- def test_run_line_scan_with_parameters(scan_control, mocked_client):
290
- scan_name = "line_scan"
291
- kwargs = {"exp_time": 0.1, "steps": 10, "relative": True, "burst_at_each_point": 1}
292
- args = {"device": "samx", "start": -5, "stop": 5}
293
-
294
- scan_control.comboBox_scan_selection.setCurrentText(scan_name)
295
-
296
- # Set kwargs in the UI
297
- for kwarg_box in scan_control.kwarg_boxes:
298
- for widget in kwarg_box.widgets:
299
- for key, value in kwargs.items():
300
- if widget.arg_name == key:
301
- WidgetIO.set_value(widget, value)
302
- break
303
- # Set args in the UI
304
- for widget in scan_control.arg_box.widgets:
305
- for key, value in args.items():
306
- if widget.arg_name == key:
307
- WidgetIO.set_value(widget, value)
308
- break
309
-
310
- # Mock the scan function
311
- mocked_scan_function = MagicMock()
312
- setattr(mocked_client.scans, scan_name, mocked_scan_function)
313
-
314
- # Run the scan
315
- scan_control.button_run_scan.click()
316
-
317
- # Retrieve the actual arguments passed to the mock
318
- called_args, called_kwargs = mocked_scan_function.call_args
319
-
320
- # Check if the scan function was called correctly
321
- expected_device = mocked_client.device_manager.devices.samx
322
- expected_args_list = [expected_device, args["start"], args["stop"]]
323
- assert called_args == tuple(expected_args_list)
324
- assert called_kwargs == kwargs
@@ -1,160 +0,0 @@
1
- # pylint: disable = no-name-in-module,missing-class-docstring, missing-module-docstring
2
- import pytest
3
-
4
- from bec_widgets.utils.widget_io import WidgetIO
5
- from bec_widgets.widgets.scan_control.scan_group_box import ScanGroupBox
6
-
7
-
8
- def test_kwarg_box(qtbot):
9
- group_input = {
10
- "name": "Kwarg Test",
11
- "inputs": [
12
- # Test float
13
- {
14
- "arg": False,
15
- "name": "exp_time",
16
- "type": "float",
17
- "display_name": "Exp Time",
18
- "tooltip": "Exposure time in seconds",
19
- "default": 0,
20
- "expert": False,
21
- },
22
- # Test int
23
- {
24
- "arg": False,
25
- "name": "num_points",
26
- "type": "int",
27
- "display_name": "Num Points",
28
- "tooltip": "Number of points",
29
- "default": 1,
30
- "expert": False,
31
- },
32
- # Test bool
33
- {
34
- "arg": False,
35
- "name": "relative",
36
- "type": "bool",
37
- "display_name": "Relative",
38
- "tooltip": "If True, the motors will be moved relative to their current position",
39
- "default": False,
40
- "expert": False,
41
- },
42
- # Test str
43
- {
44
- "arg": False,
45
- "name": "scan_type",
46
- "type": "str",
47
- "display_name": "Scan Type",
48
- "tooltip": "Type of scan",
49
- "default": "line",
50
- "expert": False,
51
- },
52
- ],
53
- }
54
-
55
- kwarg_box = ScanGroupBox(box_type="kwargs", config=group_input)
56
- assert kwarg_box is not None
57
- assert kwarg_box.box_type == "kwargs"
58
- assert kwarg_box.config == group_input
59
- assert kwarg_box.title() == "Kwarg Test"
60
-
61
- # Labels
62
- assert kwarg_box.layout.itemAtPosition(0, 0).widget().text() == "Exp Time"
63
- assert kwarg_box.layout.itemAtPosition(0, 1).widget().text() == "Num Points"
64
- assert kwarg_box.layout.itemAtPosition(0, 2).widget().text() == "Relative"
65
- assert kwarg_box.layout.itemAtPosition(0, 3).widget().text() == "Scan Type"
66
-
67
- # Widget 0
68
- assert kwarg_box.widgets[0].__class__.__name__ == "ScanDoubleSpinBox"
69
- assert kwarg_box.widgets[0].arg_name == "exp_time"
70
- assert WidgetIO.get_value(kwarg_box.widgets[0]) == 0
71
- assert kwarg_box.widgets[0].toolTip() == "Exposure time in seconds"
72
-
73
- # Widget 1
74
- assert kwarg_box.widgets[1].__class__.__name__ == "ScanSpinBox"
75
- assert kwarg_box.widgets[1].arg_name == "num_points"
76
- assert WidgetIO.get_value(kwarg_box.widgets[1]) == 1
77
- assert kwarg_box.widgets[1].toolTip() == "Number of points"
78
-
79
- # Widget 2
80
- assert kwarg_box.widgets[2].__class__.__name__ == "ScanCheckBox"
81
- assert kwarg_box.widgets[2].arg_name == "relative"
82
- assert WidgetIO.get_value(kwarg_box.widgets[2]) == False
83
- assert (
84
- kwarg_box.widgets[2].toolTip()
85
- == "If True, the motors will be moved relative to their current position"
86
- )
87
-
88
- # Widget 3
89
- assert kwarg_box.widgets[3].__class__.__name__ == "ScanLineEdit"
90
- assert kwarg_box.widgets[3].arg_name == "scan_type"
91
- assert WidgetIO.get_value(kwarg_box.widgets[3]) == "line"
92
- assert kwarg_box.widgets[3].toolTip() == "Type of scan"
93
-
94
- parameters = kwarg_box.get_parameters()
95
- assert parameters == {"exp_time": 0, "num_points": 1, "relative": False, "scan_type": "line"}
96
-
97
-
98
- def test_arg_box(qtbot):
99
- group_input = {
100
- "name": "Arg Test",
101
- "inputs": [
102
- # Test device
103
- {
104
- "arg": True,
105
- "name": "device",
106
- "type": "str",
107
- "display_name": "Device",
108
- "tooltip": "Device to scan",
109
- "default": "samx",
110
- "expert": False,
111
- },
112
- # Test float
113
- {
114
- "arg": True,
115
- "name": "start",
116
- "type": "float",
117
- "display_name": "Start",
118
- "tooltip": "Start position",
119
- "default": 0,
120
- "expert": False,
121
- },
122
- # Test int
123
- {
124
- "arg": True,
125
- "name": "stop",
126
- "type": "int",
127
- "display_name": "Stop",
128
- "tooltip": "Stop position",
129
- "default": 1,
130
- "expert": False,
131
- },
132
- ],
133
- }
134
-
135
- arg_box = ScanGroupBox(box_type="args", config=group_input)
136
- assert arg_box is not None
137
- assert arg_box.box_type == "args"
138
- assert arg_box.config == group_input
139
- assert arg_box.title() == "Arg Test"
140
-
141
- # Labels
142
- assert arg_box.layout.itemAtPosition(0, 0).widget().text() == "Device"
143
- assert arg_box.layout.itemAtPosition(0, 1).widget().text() == "Start"
144
- assert arg_box.layout.itemAtPosition(0, 2).widget().text() == "Stop"
145
-
146
- # Widget 0
147
- assert arg_box.widgets[0].__class__.__name__ == "ScanLineEdit"
148
- assert arg_box.widgets[0].arg_name == "device"
149
- assert WidgetIO.get_value(arg_box.widgets[0]) == "samx"
150
- assert arg_box.widgets[0].toolTip() == "Device to scan"
151
-
152
- # Widget 1
153
- assert arg_box.widgets[1].__class__.__name__ == "ScanDoubleSpinBox"
154
- assert arg_box.widgets[1].arg_name == "start"
155
- assert WidgetIO.get_value(arg_box.widgets[1]) == 0
156
- assert arg_box.widgets[1].toolTip() == "Start position"
157
-
158
- # Widget 2
159
- assert arg_box.widgets[2].__class__.__name__ == "ScanSpinBox"
160
- assert arg_box.widgets[2].arg_name
@@ -1,96 +0,0 @@
1
- from unittest.mock import MagicMock, patch
2
-
3
- import pytest
4
- from qtpy.QtWidgets import QWidget
5
-
6
- from bec_widgets.qt_utils.settings_dialog import SettingsDialog, SettingWidget
7
-
8
- ###################################
9
- # SettingWidget base class tests
10
- ###################################
11
-
12
-
13
- @pytest.fixture
14
- def setting_widget(qtbot):
15
- widget = SettingWidget()
16
- qtbot.addWidget(widget)
17
- qtbot.waitExposed(widget)
18
- yield widget
19
-
20
-
21
- def test_setting_widget_initialization(setting_widget):
22
- assert setting_widget.target_widget is None
23
-
24
-
25
- def test_setting_widget_set_target_widget(setting_widget):
26
- mock_target = MagicMock(spec=QWidget)
27
- setting_widget.set_target_widget(mock_target)
28
- assert setting_widget.target_widget == mock_target
29
-
30
-
31
- def test_setting_widget_accept_changes(setting_widget):
32
- with patch.object(setting_widget, "accept_changes") as mock_accept_changes:
33
- setting_widget.accept_changes()
34
- mock_accept_changes.assert_called_once()
35
-
36
-
37
- def test_setting_widget_display_current_settings(setting_widget):
38
- config_dict = {"setting1": "value1", "setting2": "value2"}
39
- with patch.object(setting_widget, "display_current_settings") as mock_display_current_settings:
40
- setting_widget.display_current_settings(config_dict)
41
- mock_display_current_settings.assert_called_once_with(config_dict)
42
-
43
-
44
- ###################################
45
- # SettingsDialog tests
46
- ###################################
47
- @pytest.fixture
48
- def settings_dialog(qtbot, setting_widget):
49
- parent_widget = QWidget()
50
- setting_widget.set_target_widget = MagicMock()
51
- setting_widget.display_current_settings = MagicMock()
52
- setting_widget.accept_changes = MagicMock()
53
-
54
- dialog = SettingsDialog(
55
- parent=parent_widget,
56
- settings_widget=setting_widget,
57
- window_title="Test Settings",
58
- config={"setting1": "value1", "setting2": "value2"},
59
- )
60
- qtbot.addWidget(dialog)
61
- qtbot.waitExposed(dialog)
62
- yield dialog, parent_widget, setting_widget
63
- parent_widget.close()
64
- parent_widget.deleteLater()
65
-
66
-
67
- def test_settings_dialog_initialization(settings_dialog):
68
- dialog, parent_widget, settings_widget = settings_dialog
69
-
70
- assert dialog.windowTitle() == "Test Settings"
71
- settings_widget.set_target_widget.assert_called_once_with(parent_widget)
72
- settings_widget.display_current_settings.assert_called_once_with(
73
- {"setting1": "value1", "setting2": "value2"}
74
- )
75
-
76
-
77
- def test_settings_dialog_accept(settings_dialog, qtbot):
78
- dialog, _, settings_widget = settings_dialog
79
-
80
- dialog.button_box.buttons()[0].click() # OK Button
81
- settings_widget.accept_changes.assert_called_once()
82
-
83
-
84
- def test_settings_dialog_reject(settings_dialog, qtbot):
85
- dialog, _, _ = settings_dialog
86
-
87
- with patch.object(dialog, "reject", wraps=dialog.reject) as mock_reject:
88
- dialog.button_box.buttons()[1].click() # Cancel Button
89
- mock_reject.assert_called_once()
90
-
91
-
92
- def test_settings_dialog_apply_changes(settings_dialog, qtbot):
93
- dialog, _, settings_widget = settings_dialog
94
-
95
- dialog.apply_button.click()
96
- settings_widget.accept_changes.assert_called_once()
@@ -1,31 +0,0 @@
1
- import pytest
2
-
3
- from bec_widgets.utils.colors import apply_theme
4
- from bec_widgets.utils.reference_utils import snap_and_compare
5
- from bec_widgets.widgets.spinner.spinner import SpinnerWidget
6
-
7
-
8
- @pytest.fixture
9
- def spinner_widget(qtbot):
10
- apply_theme("light")
11
- spinner = SpinnerWidget()
12
- qtbot.addWidget(spinner)
13
- qtbot.waitExposed(spinner)
14
- yield spinner
15
- spinner.close()
16
-
17
-
18
- def test_spinner_widget_paint_event(spinner_widget, qtbot):
19
- spinner_widget.paintEvent(None)
20
-
21
-
22
- def test_spinner_widget_rendered(spinner_widget, qtbot, tmpdir):
23
- spinner_widget.update()
24
- qtbot.wait(200)
25
- snap_and_compare(spinner_widget, str(tmpdir), suffix="")
26
-
27
- spinner_widget._started = True
28
- spinner_widget.update()
29
- qtbot.wait(200)
30
-
31
- snap_and_compare(spinner_widget, str(tmpdir), suffix="started")
@@ -1,27 +0,0 @@
1
- # pylint: disable=missing-function-docstring, missing-module-docstring, unused-import
2
-
3
- import pytest
4
-
5
- from bec_widgets.widgets.stop_button.stop_button import StopButton
6
-
7
- from .client_mocks import mocked_client
8
-
9
-
10
- @pytest.fixture
11
- def stop_button(qtbot, mocked_client):
12
- widget = StopButton(client=mocked_client)
13
- qtbot.addWidget(widget)
14
- qtbot.waitExposed(widget)
15
- yield widget
16
-
17
-
18
- def test_stop_button(stop_button):
19
- assert stop_button.text() == "Stop"
20
- assert (
21
- stop_button.styleSheet()
22
- == "background-color: #cc181e; color: white; font-weight: bold; font-size: 12px;"
23
- )
24
- stop_button.click()
25
- assert stop_button.queue.request_scan_abortion.called
26
- assert stop_button.queue.request_queue_reset.called
27
- stop_button.close()