bec-widgets 0.93.2__py3-none-any.whl → 0.93.3__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 (42) hide show
  1. CHANGELOG.md +24 -28
  2. PKG-INFO +1 -1
  3. bec_widgets/qt_utils/settings_dialog.py +11 -0
  4. bec_widgets/widgets/color_button/color_button.py +7 -0
  5. bec_widgets/widgets/dock/dock.py +4 -1
  6. bec_widgets/widgets/dock/dock_area.py +15 -1
  7. bec_widgets/widgets/figure/figure.py +21 -16
  8. bec_widgets/widgets/figure/plots/image/image.py +14 -0
  9. bec_widgets/widgets/figure/plots/plot_base.py +8 -0
  10. bec_widgets/widgets/image/image_widget.py +2 -0
  11. bec_widgets/widgets/motor_map/motor_map_dialog/motor_map_settings.py +9 -0
  12. bec_widgets/widgets/website/website.py +6 -0
  13. {bec_widgets-0.93.2.dist-info → bec_widgets-0.93.3.dist-info}/METADATA +1 -1
  14. {bec_widgets-0.93.2.dist-info → bec_widgets-0.93.3.dist-info}/RECORD +42 -42
  15. pyproject.toml +1 -1
  16. tests/end-2-end/test_scan_control_e2e.py +0 -1
  17. tests/unit_tests/conftest.py +33 -2
  18. tests/unit_tests/test_bec_dock.py +0 -1
  19. tests/unit_tests/test_bec_figure.py +31 -24
  20. tests/unit_tests/test_bec_image.py +7 -3
  21. tests/unit_tests/test_bec_image_widget.py +0 -1
  22. tests/unit_tests/test_bec_motor_map.py +28 -14
  23. tests/unit_tests/test_bec_queue.py +0 -1
  24. tests/unit_tests/test_bec_status_box.py +0 -1
  25. tests/unit_tests/test_color_map_selector.py +0 -1
  26. tests/unit_tests/test_device_input_base.py +0 -1
  27. tests/unit_tests/test_device_input_widgets.py +0 -6
  28. tests/unit_tests/test_motor_map_widget.py +0 -2
  29. tests/unit_tests/test_plot_base.py +9 -4
  30. tests/unit_tests/test_ring_progress_bar.py +0 -1
  31. tests/unit_tests/test_scan_control.py +0 -1
  32. tests/unit_tests/test_setting_dialog.py +1 -2
  33. tests/unit_tests/test_stop_button.py +0 -1
  34. tests/unit_tests/test_text_box_widget.py +0 -1
  35. tests/unit_tests/test_toggle.py +0 -1
  36. tests/unit_tests/test_vscode_widget.py +2 -2
  37. tests/unit_tests/test_waveform1d.py +46 -23
  38. tests/unit_tests/test_waveform_widget.py +0 -1
  39. tests/unit_tests/test_website_widget.py +0 -2
  40. {bec_widgets-0.93.2.dist-info → bec_widgets-0.93.3.dist-info}/WHEEL +0 -0
  41. {bec_widgets-0.93.2.dist-info → bec_widgets-0.93.3.dist-info}/entry_points.txt +0 -0
  42. {bec_widgets-0.93.2.dist-info → bec_widgets-0.93.3.dist-info}/licenses/LICENSE +0 -0
@@ -4,13 +4,15 @@ from unittest import mock
4
4
  import numpy as np
5
5
  import pytest
6
6
 
7
+ from bec_widgets.widgets.figure import BECFigure
7
8
  from bec_widgets.widgets.figure.plots.waveform.waveform_curve import CurveConfig, Signal, SignalData
8
9
 
9
10
  from .client_mocks import mocked_client
10
- from .test_bec_figure import bec_figure
11
+ from .conftest import create_widget
11
12
 
12
13
 
13
- def test_adding_curve_to_waveform(bec_figure):
14
+ def test_adding_curve_to_waveform(qtbot, mocked_client):
15
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
14
16
  w1 = bec_figure.plot()
15
17
 
16
18
  # adding curve which is in bec - only names
@@ -38,7 +40,8 @@ def test_adding_curve_to_waveform(bec_figure):
38
40
  assert c3.config.label == "non_existent_device-non_existent_device"
39
41
 
40
42
 
41
- def test_adding_curve_with_same_id(bec_figure):
43
+ def test_adding_curve_with_same_id(qtbot, mocked_client):
44
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
42
45
  w1 = bec_figure.plot()
43
46
  c1 = w1.add_curve_bec(x_name="samx", y_name="bpm4i", gui_id="test_curve")
44
47
 
@@ -47,7 +50,8 @@ def test_adding_curve_with_same_id(bec_figure):
47
50
  assert "Curve with ID 'test_curve' already exists." in str(excinfo.value)
48
51
 
49
52
 
50
- def test_create_waveform1D_by_config(bec_figure):
53
+ def test_create_waveform1D_by_config(qtbot, mocked_client):
54
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
51
55
  w1_config_input = {
52
56
  "widget_class": "BECWaveform",
53
57
  "gui_id": "widget_1",
@@ -132,7 +136,8 @@ def test_create_waveform1D_by_config(bec_figure):
132
136
  assert w1.config.axis.title == "Widget 1"
133
137
 
134
138
 
135
- def test_change_gui_id(bec_figure):
139
+ def test_change_gui_id(qtbot, mocked_client):
140
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
136
141
  w1 = bec_figure.plot()
137
142
  c1 = w1.add_curve_bec(x_name="samx", y_name="bpm4i")
138
143
  w1.change_gui_id("new_id")
@@ -141,7 +146,8 @@ def test_change_gui_id(bec_figure):
141
146
  assert c1.config.parent_id == "new_id"
142
147
 
143
148
 
144
- def test_getting_curve(bec_figure):
149
+ def test_getting_curve(qtbot, mocked_client):
150
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
145
151
  w1 = bec_figure.plot()
146
152
  c1 = w1.add_curve_bec(x_name="samx", y_name="bpm4i", gui_id="test_curve")
147
153
  c1_expected_config = CurveConfig(
@@ -173,7 +179,8 @@ def test_getting_curve(bec_figure):
173
179
  assert c1.get_config() == c1_expected_config.model_dump()
174
180
 
175
181
 
176
- def test_getting_curve_errors(bec_figure):
182
+ def test_getting_curve_errors(qtbot, mocked_client):
183
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
177
184
  w1 = bec_figure.plot()
178
185
  c1 = w1.add_curve_bec(x_name="samx", y_name="bpm4i", gui_id="test_curve")
179
186
 
@@ -190,7 +197,8 @@ def test_getting_curve_errors(bec_figure):
190
197
  )
191
198
 
192
199
 
193
- def test_add_curve(bec_figure):
200
+ def test_add_curve(qtbot, mocked_client):
201
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
194
202
  w1 = bec_figure.plot()
195
203
 
196
204
  c1 = w1.add_curve_bec(x_name="samx", y_name="bpm4i")
@@ -201,7 +209,8 @@ def test_add_curve(bec_figure):
201
209
  assert c1.config.source == "scan_segment"
202
210
 
203
211
 
204
- def test_change_legend_font_size(bec_figure):
212
+ def test_change_legend_font_size(qtbot, mocked_client):
213
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
205
214
  plot = bec_figure.plot()
206
215
 
207
216
  w1 = plot.add_curve_bec(x_name="samx", y_name="bpm4i")
@@ -213,7 +222,8 @@ def test_change_legend_font_size(bec_figure):
213
222
  assert mock_set_scale.call_args == mock.call(2)
214
223
 
215
224
 
216
- def test_remove_curve(bec_figure):
225
+ def test_remove_curve(qtbot, mocked_client):
226
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
217
227
  w1 = bec_figure.plot()
218
228
 
219
229
  w1.add_curve_bec(x_name="samx", y_name="bpm4i")
@@ -231,7 +241,8 @@ def test_remove_curve(bec_figure):
231
241
  )
232
242
 
233
243
 
234
- def test_change_curve_appearance_methods(bec_figure, qtbot):
244
+ def test_change_curve_appearance_methods(qtbot, mocked_client):
245
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
235
246
  w1 = bec_figure.plot()
236
247
 
237
248
  c1 = w1.add_curve_bec(x_name="samx", y_name="bpm4i")
@@ -260,7 +271,8 @@ def test_change_curve_appearance_methods(bec_figure, qtbot):
260
271
  }
261
272
 
262
273
 
263
- def test_change_curve_appearance_args(bec_figure):
274
+ def test_change_curve_appearance_args(qtbot, mocked_client):
275
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
264
276
  w1 = bec_figure.plot()
265
277
 
266
278
  c1 = w1.add_curve_bec(x_name="samx", y_name="bpm4i")
@@ -290,7 +302,8 @@ def test_change_curve_appearance_args(bec_figure):
290
302
  }
291
303
 
292
304
 
293
- def test_set_custom_curve_data(bec_figure, qtbot):
305
+ def test_set_custom_curve_data(qtbot, mocked_client):
306
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
294
307
  w1 = bec_figure.plot()
295
308
 
296
309
  c1 = w1.add_curve_custom(
@@ -326,7 +339,8 @@ def test_set_custom_curve_data(bec_figure, qtbot):
326
339
  assert np.array_equal(y_new, [7, 8, 9])
327
340
 
328
341
 
329
- def test_custom_data_2D_array(bec_figure, qtbot):
342
+ def test_custom_data_2D_array(qtbot, mocked_client):
343
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
330
344
 
331
345
  data = np.random.rand(10, 2)
332
346
 
@@ -338,7 +352,8 @@ def test_custom_data_2D_array(bec_figure, qtbot):
338
352
  assert np.array_equal(y, data[:, 1])
339
353
 
340
354
 
341
- def test_get_all_data(bec_figure):
355
+ def test_get_all_data(qtbot, mocked_client):
356
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
342
357
  w1 = bec_figure.plot()
343
358
 
344
359
  c1 = w1.add_curve_custom(
@@ -373,7 +388,8 @@ def test_get_all_data(bec_figure):
373
388
  }
374
389
 
375
390
 
376
- def test_curve_add_by_config(bec_figure):
391
+ def test_curve_add_by_config(qtbot, mocked_client):
392
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
377
393
  w1 = bec_figure.plot()
378
394
 
379
395
  c1_config_input = {
@@ -413,7 +429,8 @@ def test_curve_add_by_config(bec_figure):
413
429
  assert c1.get_config(False) == CurveConfig(**c1_config_input)
414
430
 
415
431
 
416
- def test_scan_update(bec_figure, qtbot):
432
+ def test_scan_update(qtbot, mocked_client):
433
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
417
434
  w1 = bec_figure.plot()
418
435
 
419
436
  c1 = w1.add_curve_bec(x_name="samx", y_name="bpm4i")
@@ -447,7 +464,8 @@ def test_scan_update(bec_figure, qtbot):
447
464
  assert c1.get_data() == ([10], [5])
448
465
 
449
466
 
450
- def test_scan_history_with_val_access(bec_figure, qtbot):
467
+ def test_scan_history_with_val_access(qtbot, mocked_client):
468
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
451
469
  w1 = bec_figure.plot()
452
470
 
453
471
  w1.plot(x_name="samx", y_name="bpm4i")
@@ -472,7 +490,8 @@ def test_scan_history_with_val_access(bec_figure, qtbot):
472
490
  assert np.array_equal(y_data, [4, 5, 6])
473
491
 
474
492
 
475
- def test_scatter_2d_update(bec_figure, qtbot):
493
+ def test_scatter_2d_update(qtbot, mocked_client):
494
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
476
495
  w1 = bec_figure.plot()
477
496
 
478
497
  c1 = w1.add_curve_bec(x_name="samx", y_name="samx", z_name="bpm4i")
@@ -512,7 +531,8 @@ def test_scatter_2d_update(bec_figure, qtbot):
512
531
  assert colors == expected_z_colors
513
532
 
514
533
 
515
- def test_waveform_single_arg_inputs(bec_figure, qtbot):
534
+ def test_waveform_single_arg_inputs(qtbot, mocked_client):
535
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
516
536
  w1 = bec_figure.plot()
517
537
 
518
538
  w1.plot("bpm4i")
@@ -544,7 +564,8 @@ def test_waveform_single_arg_inputs(bec_figure, qtbot):
544
564
  assert np.array_equal(w1._curves_data["custom"]["np_ndarray 2D"].get_data(), data_array_2D.T)
545
565
 
546
566
 
547
- def test_waveform_set_x_sync(bec_figure, qtbot):
567
+ def test_waveform_set_x_sync(qtbot, mocked_client):
568
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
548
569
  w1 = bec_figure.plot()
549
570
  custom_label = "custom_label"
550
571
  w1.plot("bpm4i")
@@ -601,7 +622,8 @@ def test_waveform_set_x_sync(bec_figure, qtbot):
601
622
  assert w1.plot_item.getAxis("bottom").labelText == custom_label + " [timestamp]"
602
623
 
603
624
 
604
- def test_waveform_async_data_update(bec_figure, qtbot):
625
+ def test_waveform_async_data_update(qtbot, mocked_client):
626
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
605
627
  w1 = bec_figure.plot("async_device")
606
628
  custom_label = "custom_label"
607
629
  w1.set_x_label(custom_label)
@@ -647,7 +669,8 @@ def test_waveform_async_data_update(bec_figure, qtbot):
647
669
  assert w1.plot_item.getAxis("bottom").labelText == custom_label + " [best_effort]"
648
670
 
649
671
 
650
- def test_waveform_set_x_async(bec_figure, qtbot):
672
+ def test_waveform_set_x_async(qtbot, mocked_client):
673
+ bec_figure = create_widget(qtbot, BECFigure, client=mocked_client)
651
674
  w1 = bec_figure.plot("async_device")
652
675
  custom_label = "custom_label"
653
676
  w1.set_x_label(custom_label)
@@ -14,7 +14,6 @@ def waveform_widget(qtbot, mocked_client):
14
14
  qtbot.addWidget(widget)
15
15
  qtbot.waitExposed(widget)
16
16
  yield widget
17
- widget.close()
18
17
 
19
18
 
20
19
  @pytest.fixture
@@ -12,8 +12,6 @@ def website_widget(qtbot, mocked_client):
12
12
  qtbot.addWidget(widget)
13
13
  qtbot.waitExposed(widget)
14
14
  yield widget
15
- widget.page().deleteLater()
16
- qtbot.wait(1000)
17
15
 
18
16
 
19
17
  def test_website_widget_set_url(website_widget):