bec-widgets 0.93.2__py3-none-any.whl → 0.93.4__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.
- CHANGELOG.md +32 -34
- PKG-INFO +1 -1
- bec_widgets/cli/client.py +9 -16
- bec_widgets/qt_utils/settings_dialog.py +11 -0
- bec_widgets/widgets/color_button/color_button.py +7 -0
- bec_widgets/widgets/dock/dock.py +4 -1
- bec_widgets/widgets/dock/dock_area.py +19 -5
- bec_widgets/widgets/figure/figure.py +21 -16
- bec_widgets/widgets/figure/plots/image/image.py +14 -0
- bec_widgets/widgets/figure/plots/plot_base.py +8 -0
- bec_widgets/widgets/image/image_widget.py +2 -0
- bec_widgets/widgets/motor_map/motor_map_dialog/motor_map_settings.py +9 -0
- bec_widgets/widgets/{device_box/device_box.py → positioner_box/positioner_box.py} +88 -11
- bec_widgets/widgets/positioner_box/positioner_box.pyproject +1 -0
- bec_widgets/widgets/{device_box/device_box.ui → positioner_box/positioner_box.ui} +20 -3
- bec_widgets/widgets/{device_box/device_box_plugin.py → positioner_box/positioner_box_plugin.py} +9 -14
- bec_widgets/widgets/{device_box/register_device_box.py → positioner_box/register_positioner_box.py} +2 -2
- bec_widgets/widgets/website/website.py +6 -0
- {bec_widgets-0.93.2.dist-info → bec_widgets-0.93.4.dist-info}/METADATA +1 -1
- {bec_widgets-0.93.2.dist-info → bec_widgets-0.93.4.dist-info}/RECORD +50 -50
- pyproject.toml +1 -1
- tests/end-2-end/test_scan_control_e2e.py +0 -1
- tests/unit_tests/conftest.py +33 -2
- tests/unit_tests/test_bec_dock.py +6 -5
- tests/unit_tests/test_bec_figure.py +31 -24
- tests/unit_tests/test_bec_image.py +7 -3
- tests/unit_tests/test_bec_image_widget.py +0 -1
- tests/unit_tests/test_bec_motor_map.py +28 -14
- tests/unit_tests/test_bec_queue.py +0 -1
- tests/unit_tests/test_bec_status_box.py +0 -1
- tests/unit_tests/test_color_map_selector.py +0 -1
- tests/unit_tests/test_device_input_base.py +0 -1
- tests/unit_tests/test_device_input_widgets.py +0 -6
- tests/unit_tests/test_motor_map_widget.py +0 -2
- tests/unit_tests/test_plot_base.py +9 -4
- tests/unit_tests/test_positioner_box.py +104 -0
- tests/unit_tests/test_ring_progress_bar.py +0 -1
- tests/unit_tests/test_scan_control.py +0 -1
- tests/unit_tests/test_setting_dialog.py +1 -2
- tests/unit_tests/test_stop_button.py +0 -1
- tests/unit_tests/test_text_box_widget.py +0 -1
- tests/unit_tests/test_toggle.py +0 -1
- tests/unit_tests/test_vscode_widget.py +2 -2
- tests/unit_tests/test_waveform1d.py +46 -23
- tests/unit_tests/test_waveform_widget.py +0 -1
- tests/unit_tests/test_website_widget.py +0 -2
- bec_widgets/widgets/device_box/device_box.pyproject +0 -1
- tests/unit_tests/test_device_box.py +0 -98
- /bec_widgets/widgets/{device_box → positioner_box}/__init__.py +0 -0
- {bec_widgets-0.93.2.dist-info → bec_widgets-0.93.4.dist-info}/WHEEL +0 -0
- {bec_widgets-0.93.2.dist-info → bec_widgets-0.93.4.dist-info}/entry_points.txt +0 -0
- {bec_widgets-0.93.2.dist-info → bec_widgets-0.93.4.dist-info}/licenses/LICENSE +0 -0
@@ -1 +0,0 @@
|
|
1
|
-
{'files': ['device_box.py']}
|
@@ -1,98 +0,0 @@
|
|
1
|
-
from unittest import mock
|
2
|
-
|
3
|
-
import pytest
|
4
|
-
from bec_lib.endpoints import MessageEndpoints
|
5
|
-
from bec_lib.messages import ScanQueueMessage
|
6
|
-
from qtpy.QtGui import QValidator
|
7
|
-
|
8
|
-
from bec_widgets.widgets.device_box.device_box import DeviceBox
|
9
|
-
|
10
|
-
from .client_mocks import mocked_client
|
11
|
-
|
12
|
-
|
13
|
-
@pytest.fixture
|
14
|
-
def device_box(qtbot, mocked_client):
|
15
|
-
with mock.patch("bec_widgets.widgets.device_box.device_box.uuid.uuid4") as mock_uuid:
|
16
|
-
mock_uuid.return_value = "fake_uuid"
|
17
|
-
db = DeviceBox(device="samx", client=mocked_client)
|
18
|
-
qtbot.addWidget(db)
|
19
|
-
yield db
|
20
|
-
|
21
|
-
|
22
|
-
def test_device_box(device_box):
|
23
|
-
assert device_box.device == "samx"
|
24
|
-
data = device_box.dev["samx"].read()
|
25
|
-
|
26
|
-
setpoint_text = device_box.ui.setpoint.text()
|
27
|
-
# check that the setpoint is taken correctly after init
|
28
|
-
assert float(setpoint_text) == data["samx_setpoint"]["value"]
|
29
|
-
|
30
|
-
# check that the precision is taken correctly after init
|
31
|
-
precision = device_box.dev["samx"].precision
|
32
|
-
assert setpoint_text == f"{data['samx_setpoint']['value']:.{precision}f}"
|
33
|
-
|
34
|
-
# check that the step size is set according to the device precision
|
35
|
-
assert device_box.ui.step_size.value() == 10**-precision * 10
|
36
|
-
|
37
|
-
|
38
|
-
def test_device_box_update_limits(device_box):
|
39
|
-
device_box._limits = None
|
40
|
-
device_box.update_limits([0, 10])
|
41
|
-
assert device_box._limits == [0, 10]
|
42
|
-
assert device_box.setpoint_validator.bottom() == 0
|
43
|
-
assert device_box.setpoint_validator.top() == 10
|
44
|
-
assert device_box.setpoint_validator.validate("100", 0) == (
|
45
|
-
QValidator.State.Intermediate,
|
46
|
-
"100",
|
47
|
-
0,
|
48
|
-
)
|
49
|
-
|
50
|
-
device_box.update_limits(None)
|
51
|
-
assert device_box._limits is None
|
52
|
-
assert device_box.setpoint_validator.validate("100", 0) == (
|
53
|
-
QValidator.State.Acceptable,
|
54
|
-
"100",
|
55
|
-
0,
|
56
|
-
)
|
57
|
-
|
58
|
-
|
59
|
-
def test_device_box_on_stop(device_box):
|
60
|
-
with mock.patch.object(device_box.client.connector, "send") as mock_send:
|
61
|
-
device_box.on_stop()
|
62
|
-
params = {"device": "samx", "rpc_id": "fake_uuid", "func": "stop", "args": [], "kwargs": {}}
|
63
|
-
msg = ScanQueueMessage(
|
64
|
-
scan_type="device_rpc",
|
65
|
-
parameter=params,
|
66
|
-
queue="emergency",
|
67
|
-
metadata={"RID": "fake_uuid", "response": False},
|
68
|
-
)
|
69
|
-
mock_send.assert_called_once_with(MessageEndpoints.scan_queue_request(), msg)
|
70
|
-
|
71
|
-
|
72
|
-
def test_device_box_setpoint_change(device_box):
|
73
|
-
with mock.patch.object(device_box.dev["samx"], "move") as mock_move:
|
74
|
-
device_box.ui.setpoint.setText("100")
|
75
|
-
device_box.on_setpoint_change()
|
76
|
-
mock_move.assert_called_once_with(100, relative=False)
|
77
|
-
|
78
|
-
|
79
|
-
def test_device_box_on_tweak_right(device_box):
|
80
|
-
with mock.patch.object(device_box.dev["samx"], "move") as mock_move:
|
81
|
-
device_box.ui.step_size.setValue(0.1)
|
82
|
-
device_box.on_tweak_right()
|
83
|
-
mock_move.assert_called_once_with(0.1, relative=True)
|
84
|
-
|
85
|
-
|
86
|
-
def test_device_box_on_tweak_left(device_box):
|
87
|
-
with mock.patch.object(device_box.dev["samx"], "move") as mock_move:
|
88
|
-
device_box.ui.step_size.setValue(0.1)
|
89
|
-
device_box.on_tweak_left()
|
90
|
-
mock_move.assert_called_once_with(-0.1, relative=True)
|
91
|
-
|
92
|
-
|
93
|
-
def test_device_box_setpoint_out_of_range(device_box):
|
94
|
-
device_box.update_limits([0, 10])
|
95
|
-
device_box.ui.setpoint.setText("100")
|
96
|
-
device_box.on_setpoint_change()
|
97
|
-
assert device_box.ui.setpoint.text() == "100"
|
98
|
-
assert device_box.ui.setpoint.hasAcceptableInput() == False
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|