bec-widgets 0.94.7__py3-none-any.whl → 0.95.1__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 +46 -44
- PKG-INFO +1 -1
- bec_widgets/cli/client.py +19 -0
- bec_widgets/examples/plugin_example_pyside/tictactoeplugin.py +5 -3
- bec_widgets/widgets/bec_queue/bec_queue_plugin.py +5 -3
- bec_widgets/widgets/bec_status_box/bec_status_box_plugin.py +5 -3
- bec_widgets/widgets/color_button/color_button_plugin.py +5 -3
- bec_widgets/widgets/colormap_selector/colormap_selector_plugin.py +5 -3
- bec_widgets/widgets/device_browser/__init__.py +0 -0
- bec_widgets/widgets/device_browser/device_browser.py +107 -0
- bec_widgets/widgets/device_browser/device_browser.pyproject +1 -0
- bec_widgets/widgets/device_browser/device_browser.ui +44 -0
- bec_widgets/widgets/device_browser/device_browser_plugin.py +57 -0
- bec_widgets/widgets/device_browser/device_item/__init__.py +1 -0
- bec_widgets/widgets/device_browser/device_item/device_item.py +53 -0
- bec_widgets/widgets/device_browser/register_device_browser.py +15 -0
- bec_widgets/widgets/device_combobox/device_combo_box_plugin.py +5 -3
- bec_widgets/widgets/device_line_edit/device_line_edit_plugin.py +5 -3
- bec_widgets/widgets/dock/dock_area_plugin.py +5 -3
- bec_widgets/widgets/image/bec_image_widget_plugin.py +5 -3
- bec_widgets/widgets/motor_map/bec_motor_map_widget_plugin.py +5 -3
- bec_widgets/widgets/position_indicator/position_indicator_plugin.py +5 -3
- bec_widgets/widgets/positioner_box/positioner_box_plugin.py +5 -3
- bec_widgets/widgets/positioner_box/positioner_control_line_plugin.py +5 -3
- bec_widgets/widgets/ring_progress_bar/ring_progress_bar_plugin.py +5 -3
- bec_widgets/widgets/scan_control/scan_control_plugin.py +5 -3
- bec_widgets/widgets/spinner/spinner_widget_plugin.py +5 -3
- bec_widgets/widgets/stop_button/stop_button_plugin.py +5 -3
- bec_widgets/widgets/text_box/text_box_plugin.py +5 -3
- bec_widgets/widgets/toggle/toggle_switch_plugin.py +5 -3
- bec_widgets/widgets/vscode/vs_code_editor_plugin.py +5 -3
- bec_widgets/widgets/waveform/bec_waveform_widget_plugin.py +5 -3
- bec_widgets/widgets/website/website_widget_plugin.py +5 -3
- {bec_widgets-0.94.7.dist-info → bec_widgets-0.95.1.dist-info}/METADATA +1 -1
- {bec_widgets-0.94.7.dist-info → bec_widgets-0.95.1.dist-info}/RECORD +97 -77
- docs/_static/custom.css +10 -10
- docs/assets/widget_screenshots/buttons.png +0 -0
- docs/assets/widget_screenshots/device_box.png +0 -0
- docs/assets/widget_screenshots/device_browser.png +0 -0
- docs/assets/widget_screenshots/device_inputs.png +0 -0
- docs/assets/widget_screenshots/dock_area.png +0 -0
- docs/assets/widget_screenshots/figure.png +0 -0
- docs/assets/widget_screenshots/image_widget.png +0 -0
- docs/assets/widget_screenshots/motor_map_widget.png +0 -0
- docs/assets/widget_screenshots/position_indicator.png +0 -0
- docs/assets/widget_screenshots/queue.png +0 -0
- docs/assets/widget_screenshots/ring_progress_bar.png +0 -0
- docs/assets/widget_screenshots/scan_controller.png +0 -0
- docs/assets/widget_screenshots/spinner.gif +0 -0
- docs/assets/widget_screenshots/status_box.png +0 -0
- docs/assets/widget_screenshots/text_box.png +0 -0
- docs/assets/widget_screenshots/toggle.png +0 -0
- docs/assets/widget_screenshots/waveform_widget.png +0 -0
- docs/assets/widget_screenshots/website.png +0 -0
- docs/conf.py +1 -0
- docs/developer/developer.md +2 -0
- docs/developer/introduction/introduction.md +1 -0
- docs/developer/introduction/useful_links.md +23 -0
- docs/index.md +4 -0
- docs/requirements.txt +1 -0
- docs/user/user.md +4 -0
- docs/user/widgets/bec_figure/bec_figure.md +105 -0
- docs/user/widgets/bec_status_box/bec_status_box.md +38 -0
- docs/user/widgets/buttons/buttons.md +50 -0
- docs/user/widgets/device_browser/device_browser.md +36 -0
- docs/user/widgets/device_browser/device_browser.png +0 -0
- docs/user/widgets/device_input/device_input.md +100 -0
- docs/user/widgets/dock_area/BECDockArea.png +0 -0
- docs/user/widgets/dock_area/bec_dock_area.md +107 -0
- docs/user/widgets/image/image_widget.md +84 -0
- docs/user/widgets/motor_map/motor_map.md +80 -0
- docs/user/widgets/position_indicator/position_indicator.md +76 -0
- docs/user/widgets/positioner_box/positioner_box.md +63 -0
- docs/user/widgets/progress_bar/ring_progress_bar.md +103 -0
- docs/user/widgets/queue/queue.md +41 -0
- docs/user/widgets/scan_control/scan_control.md +46 -0
- docs/user/widgets/spinner/spinner.md +75 -0
- docs/user/widgets/text_box/text_box.md +74 -0
- docs/user/widgets/toggle/toggle.md +66 -0
- docs/user/widgets/waveform/waveform_widget.md +132 -0
- docs/user/widgets/website/website.md +69 -0
- docs/user/widgets/widgets.md +212 -12
- pyproject.toml +1 -1
- tests/unit_tests/client_mocks.py +14 -0
- tests/unit_tests/test_device_browser.py +83 -0
- bec_widgets/assets/designer_icons/code.png +0 -0
- bec_widgets/assets/designer_icons/color_button.png +0 -0
- bec_widgets/assets/designer_icons/colormap_selector.png +0 -0
- bec_widgets/assets/designer_icons/device_combo_box.png +0 -0
- bec_widgets/assets/designer_icons/device_line_edit.png +0 -0
- bec_widgets/assets/designer_icons/dock_area.png +0 -0
- bec_widgets/assets/designer_icons/games.png +0 -0
- bec_widgets/assets/designer_icons/image.png +0 -0
- bec_widgets/assets/designer_icons/motor_map.png +0 -0
- bec_widgets/assets/designer_icons/position_indicator.png +0 -0
- bec_widgets/assets/designer_icons/positioner_box.png +0 -0
- bec_widgets/assets/designer_icons/queue.png +0 -0
- bec_widgets/assets/designer_icons/ring_progress.png +0 -0
- bec_widgets/assets/designer_icons/scan_control.png +0 -0
- bec_widgets/assets/designer_icons/spinner.png +0 -0
- bec_widgets/assets/designer_icons/status.png +0 -0
- bec_widgets/assets/designer_icons/stop.png +0 -0
- bec_widgets/assets/designer_icons/text.png +0 -0
- bec_widgets/assets/designer_icons/toggle.png +0 -0
- bec_widgets/assets/designer_icons/waveform.png +0 -0
- bec_widgets/assets/designer_icons/web.png +0 -0
- docs/user/widgets/bec_figure.md +0 -146
- docs/user/widgets/bec_status_box.md +0 -30
- docs/user/widgets/buttons.md +0 -37
- docs/user/widgets/ring_progress_bar.md +0 -54
- docs/user/widgets/scan_control.md +0 -35
- docs/user/widgets/text_box.md +0 -33
- docs/user/widgets/website.md +0 -21
- {bec_widgets-0.94.7.dist-info → bec_widgets-0.95.1.dist-info}/WHEEL +0 -0
- {bec_widgets-0.94.7.dist-info → bec_widgets-0.95.1.dist-info}/entry_points.txt +0 -0
- {bec_widgets-0.94.7.dist-info → bec_widgets-0.95.1.dist-info}/licenses/LICENSE +0 -0
- /docs/user/widgets/{BECFigure.png → bec_figure/BECFigure.png} +0 -0
- /docs/user/widgets/{bec_status_box.gif → bec_status_box/bec_status_box.gif} +0 -0
- /docs/user/widgets/{image_plot.gif → image/image_plot.gif} +0 -0
- /docs/user/widgets/{motor.gif → motor_map/motor.gif} +0 -0
- /docs/user/widgets/{progress_bar.gif → progress_bar/progress_bar.gif} +0 -0
- /docs/user/widgets/{scan_control.gif → scan_control/scan_control.gif} +0 -0
- /docs/user/widgets/{bec_figure_dap.gif → waveform/bec_figure_dap.gif} +0 -0
- /docs/user/widgets/{scatter_2D.gif → waveform/scatter_2D.gif} +0 -0
- /docs/user/widgets/{w1D.gif → waveform/w1D.gif} +0 -0
@@ -0,0 +1,69 @@
|
|
1
|
+
(user.widgets.website)=
|
2
|
+
|
3
|
+
# Website Widget
|
4
|
+
|
5
|
+
````{tab} Overview
|
6
|
+
|
7
|
+
The [`Website Widget`](/api_reference/_autosummary/bec_widgets.cli.client.WebsiteWidget) is a versatile tool that allows users to display websites directly within the BEC GUI. This widget is useful for embedding documentation, dashboards, or any web-based tools within the application interface. It is designed to be integrated within a [`BECDockArea`](user.widgets.bec_dock_area) or used as an individual component in your application through `QtDesigner`.
|
8
|
+
|
9
|
+
## Key Features:
|
10
|
+
- **URL Display**: Set and display any website URL within the widget.
|
11
|
+
- **Navigation Controls**: Navigate through the website’s history with back and forward controls.
|
12
|
+
- **Reload Functionality**: Reload the currently displayed website to ensure up-to-date content.
|
13
|
+
|
14
|
+
````
|
15
|
+
|
16
|
+
````{tab} Examples - CLI
|
17
|
+
|
18
|
+
The `WebsiteWidget` can be embedded within a [`BECDockArea`](user.widgets.bec_dock_area) or used as an individual component in your application through `QtDesigner`. The following examples demonstrate how to create and use the `WebsiteWidget` in different scenarios.
|
19
|
+
|
20
|
+
## Example 1 - Adding Website Widget to BECDockArea
|
21
|
+
|
22
|
+
In this example, we demonstrate how to add a `WebsiteWidget` to a `BECDockArea` and set the URL of the website to be displayed.
|
23
|
+
|
24
|
+
```python
|
25
|
+
# Add a new dock with a WebsiteWidget
|
26
|
+
web = gui.add_dock().add_widget("WebsiteWidget")
|
27
|
+
|
28
|
+
# Set the URL of the website to display
|
29
|
+
web.set_url("https://bec.readthedocs.io/en/latest/")
|
30
|
+
```
|
31
|
+
|
32
|
+
## Example 2 - Navigating within the Website Widget
|
33
|
+
|
34
|
+
The `WebsiteWidget` allows users to navigate back and forward through the website’s history. This example shows how to implement these navigation controls.
|
35
|
+
|
36
|
+
```python
|
37
|
+
# Go back in the website history
|
38
|
+
web.back()
|
39
|
+
|
40
|
+
# Go forward in the website history
|
41
|
+
web.forward()
|
42
|
+
```
|
43
|
+
|
44
|
+
## Example 3 - Reloading the Website
|
45
|
+
|
46
|
+
To ensure that the displayed website content is up-to-date, you can use the reload functionality.
|
47
|
+
|
48
|
+
```python
|
49
|
+
# Reload the current website
|
50
|
+
web.reload()
|
51
|
+
```
|
52
|
+
|
53
|
+
## Example 4 - Retrieving the Current URL
|
54
|
+
|
55
|
+
You may want to retrieve the current URL being displayed in the `WebsiteWidget`. The following example demonstrates how to access the current URL.
|
56
|
+
|
57
|
+
```python
|
58
|
+
# Get the current URL of the WebsiteWidget
|
59
|
+
current_url = web.get_url()
|
60
|
+
print(f"The current URL is: {current_url}")
|
61
|
+
```
|
62
|
+
|
63
|
+
````
|
64
|
+
|
65
|
+
````{tab} API
|
66
|
+
```{eval-rst}
|
67
|
+
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.WebsiteWidget.rst
|
68
|
+
```
|
69
|
+
````
|
docs/user/widgets/widgets.md
CHANGED
@@ -1,20 +1,220 @@
|
|
1
1
|
(user.widgets)=
|
2
2
|
# Widgets
|
3
|
-
BEC Widgets includes a variety of visualization widgets designed to cater to diverse data representation needs in beamline experiments. These widgets enhance the user experience by providing intuitive and interactive data visualizations.
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
BEC Widgets offers a range of tools designed to make data visualization in beamline experiments easier and more
|
5
|
+
interactive. These widgets help users better understand their data by providing clear, intuitive displays that enhance
|
6
|
+
the overall experience.
|
7
|
+
|
8
|
+
## Widget Containers
|
9
|
+
|
10
|
+
Serves as containers to organise and display other widgets.
|
11
|
+
|
12
|
+
````{grid} 3
|
13
|
+
:gutter: 2
|
14
|
+
|
15
|
+
```{grid-item-card} BEC Dock Area
|
16
|
+
:link: user.widgets.bec_dock_area
|
17
|
+
:link-type: ref
|
18
|
+
:img-top: /assets/widget_screenshots/dock_area.png
|
19
|
+
|
20
|
+
Quickly build dynamic GUI.
|
21
|
+
|
22
|
+
```
|
23
|
+
|
24
|
+
```{grid-item-card} BEC Figure
|
25
|
+
:link: user.widgets.bec_figure
|
26
|
+
:link-type: ref
|
27
|
+
:img-top: /assets/widget_screenshots/figure.png
|
28
|
+
|
29
|
+
Display 1D and 2D data.
|
30
|
+
```
|
31
|
+
````
|
32
|
+
|
33
|
+
## Plotting Widgets
|
34
|
+
|
35
|
+
Plotting widgets are used to display data in a graphical format.
|
36
|
+
|
37
|
+
````{grid} 3
|
38
|
+
:gutter: 2
|
39
|
+
|
40
|
+
```{grid-item-card} Waveform Widget
|
41
|
+
:link: user.widgets.waveform_widget
|
42
|
+
:link-type: ref
|
43
|
+
:img-top: /assets/widget_screenshots/waveform_widget.png
|
44
|
+
|
45
|
+
Display 1D detector signals.
|
46
|
+
```
|
47
|
+
|
48
|
+
```{grid-item-card} Image Widget
|
49
|
+
:link: user.widgets.image_widget
|
50
|
+
:link-type: ref
|
51
|
+
:img-top: /assets/widget_screenshots/image_widget.png
|
52
|
+
|
53
|
+
Display signal from 2D detector.
|
54
|
+
```
|
55
|
+
|
56
|
+
```{grid-item-card} Motor Map Widget
|
57
|
+
:link: user.widgets.motor_map
|
58
|
+
:link-type: ref
|
59
|
+
:img-top: /assets/widget_screenshots/motor_map_widget.png
|
60
|
+
|
61
|
+
Track position for motors.
|
62
|
+
```
|
63
|
+
|
64
|
+
````
|
65
|
+
|
66
|
+
## Device Control Widgets
|
67
|
+
|
68
|
+
Control and monitor devices/scan in the BEC environment.
|
69
|
+
|
70
|
+
````{grid} 3
|
71
|
+
:gutter: 2
|
72
|
+
|
73
|
+
```{grid-item-card} Scan Control Widget
|
74
|
+
:link: user.widgets.scan_control
|
75
|
+
:link-type: ref
|
76
|
+
:img-top: /assets/widget_screenshots/scan_controller.png
|
77
|
+
|
78
|
+
Launch scans.
|
79
|
+
```
|
80
|
+
|
81
|
+
```{grid-item-card} Device Browser
|
82
|
+
:link: user.widgets.device_browser
|
83
|
+
:link-type: ref
|
84
|
+
:img-top: /assets/widget_screenshots/device_browser.png
|
85
|
+
|
86
|
+
Find and drag devices.
|
87
|
+
```
|
88
|
+
|
89
|
+
```{grid-item-card} Positioner Box
|
90
|
+
:link: user.widgets.positioner_box
|
91
|
+
:link-type: ref
|
92
|
+
:img-top: /assets/widget_screenshots/device_box.png
|
93
|
+
|
94
|
+
Control individual device.
|
95
|
+
```
|
10
96
|
|
11
|
-
|
12
|
-
ring_progress_bar
|
13
|
-
|
14
|
-
|
15
|
-
text_box/
|
16
|
-
bec_status_box/
|
97
|
+
```{grid-item-card} Ring Progress Bar
|
98
|
+
:link: user.widgets.ring_progress_bar
|
99
|
+
:link-type: ref
|
100
|
+
:img-top: /assets/widget_screenshots/ring_progress_bar.png
|
17
101
|
|
102
|
+
Nested progress bar.
|
18
103
|
```
|
19
104
|
|
105
|
+
````
|
106
|
+
|
107
|
+
## BEC Service Widgets
|
108
|
+
|
109
|
+
Visualise the status of BEC services.
|
110
|
+
|
111
|
+
````{grid} 3
|
112
|
+
:gutter: 2
|
113
|
+
|
114
|
+
```{grid-item-card} BEC Status Box
|
115
|
+
:link: user.widgets.bec_status_box
|
116
|
+
:link-type: ref
|
117
|
+
:img-top: /assets/widget_screenshots/status_box.png
|
118
|
+
|
119
|
+
Display status of BEC services.
|
120
|
+
```
|
121
|
+
|
122
|
+
```{grid-item-card} BEC Queue Table
|
123
|
+
:link: user.widgets.bec_queue
|
124
|
+
:link-type: ref
|
125
|
+
:img-top: /assets/widget_screenshots/queue.png
|
126
|
+
|
127
|
+
Display current scan queue.
|
128
|
+
```
|
129
|
+
````
|
130
|
+
|
131
|
+
## BEC Utility Widgets
|
132
|
+
|
133
|
+
Various utility widgets to enhance user experience.
|
134
|
+
|
135
|
+
````{grid} 3
|
136
|
+
:gutter: 2
|
137
|
+
|
138
|
+
```{grid-item-card} Service Buttons
|
139
|
+
:link: user.widgets.buttons
|
140
|
+
:link-type: ref
|
141
|
+
:img-top: /assets/widget_screenshots/buttons.png
|
142
|
+
|
143
|
+
Various service buttons.
|
144
|
+
```
|
145
|
+
|
146
|
+
```{grid-item-card} Device Input Widgets
|
147
|
+
:link: user.widgets.device_input
|
148
|
+
:link-type: ref
|
149
|
+
:img-top: /assets/widget_screenshots/device_inputs.png
|
150
|
+
|
151
|
+
Choose individual device from current session.
|
152
|
+
```
|
153
|
+
|
154
|
+
```{grid-item-card} Text Box Widget
|
155
|
+
:link: user.widgets.text_box
|
156
|
+
:link-type: ref
|
157
|
+
:img-top: /assets/widget_screenshots/text_box.png
|
158
|
+
|
159
|
+
Display custom text or HTML content.
|
160
|
+
```
|
161
|
+
|
162
|
+
```{grid-item-card} Website Widget
|
163
|
+
:link: user.widgets.website
|
164
|
+
:link-type: ref
|
165
|
+
:img-top: /assets/widget_screenshots/website.png
|
166
|
+
|
167
|
+
Display website content.
|
168
|
+
```
|
169
|
+
|
170
|
+
```{grid-item-card} Toogle Widget
|
171
|
+
:link: user.widgets.toggle
|
172
|
+
:link-type: ref
|
173
|
+
:img-top: /assets/widget_screenshots/toggle.png
|
174
|
+
|
175
|
+
Angular like toggle switch.
|
176
|
+
```
|
177
|
+
|
178
|
+
```{grid-item-card} Spinner
|
179
|
+
:link: user.widgets.spinner
|
180
|
+
:link-type: ref
|
181
|
+
:img-top: /assets/widget_screenshots/spinner.gif
|
182
|
+
|
183
|
+
Display spinner widget for loading or device movement.
|
184
|
+
```
|
185
|
+
|
186
|
+
```{grid-item-card} Position Indicator
|
187
|
+
:link: user.widgets.position_indicator
|
188
|
+
:link-type: ref
|
189
|
+
:img-top: /assets/widget_screenshots/position_indicator.png
|
190
|
+
|
191
|
+
Display position of motor withing its limits.
|
192
|
+
```
|
193
|
+
````
|
194
|
+
|
195
|
+
```{toctree}
|
196
|
+
---
|
197
|
+
maxdepth: 1
|
198
|
+
hidden: true
|
199
|
+
---
|
200
|
+
|
201
|
+
dock_area/bec_dock_area.md
|
202
|
+
bec_figure/bec_figure.md
|
203
|
+
waveform/waveform_widget.md
|
204
|
+
image/image_widget.md
|
205
|
+
motor_map/motor_map.md
|
206
|
+
scan_control/scan_control.md
|
207
|
+
progress_bar/ring_progress_bar.md
|
208
|
+
bec_status_box/bec_status_box.md
|
209
|
+
queue/queue.md
|
210
|
+
buttons/buttons.md
|
211
|
+
device_browser/device_browser.md
|
212
|
+
positioner_box/positioner_box.md
|
213
|
+
text_box/text_box.md
|
214
|
+
website/website.md
|
215
|
+
toggle/toggle.md
|
216
|
+
spinner/spinner.md
|
217
|
+
device_input/device_input.md
|
218
|
+
position_indicator/position_indicator.md
|
20
219
|
|
220
|
+
```
|
pyproject.toml
CHANGED
tests/unit_tests/client_mocks.py
CHANGED
@@ -18,6 +18,20 @@ class FakeDevice:
|
|
18
18
|
self.signals = {self.name: {"value": 1.0}}
|
19
19
|
self.description = {self.name: {"source": self.name, "dtype": "number", "shape": []}}
|
20
20
|
self.readout_priority = readout_priority
|
21
|
+
self._config = {
|
22
|
+
"readoutPriority": "baseline",
|
23
|
+
"deviceClass": "ophyd_devices.SimPositioner",
|
24
|
+
"deviceConfig": {
|
25
|
+
"delay": 1,
|
26
|
+
"limits": [-50, 50],
|
27
|
+
"tolerance": 0.01,
|
28
|
+
"update_frequency": 400,
|
29
|
+
},
|
30
|
+
"deviceTags": ["user motors"],
|
31
|
+
"enabled": enabled,
|
32
|
+
"readOnly": False,
|
33
|
+
"name": self.name,
|
34
|
+
}
|
21
35
|
|
22
36
|
def __contains__(self, item):
|
23
37
|
return item == self.name
|
@@ -0,0 +1,83 @@
|
|
1
|
+
from typing import TYPE_CHECKING
|
2
|
+
from unittest import mock
|
3
|
+
|
4
|
+
import pytest
|
5
|
+
from qtpy.QtCore import Qt
|
6
|
+
|
7
|
+
from bec_widgets.widgets.device_browser.device_browser import DeviceBrowser
|
8
|
+
|
9
|
+
from .client_mocks import mocked_client
|
10
|
+
|
11
|
+
if TYPE_CHECKING:
|
12
|
+
from qtpy.QtWidgets import QListWidgetItem
|
13
|
+
|
14
|
+
from bec_widgets.widgets.device_browser.device_item.device_item import DeviceItem
|
15
|
+
|
16
|
+
|
17
|
+
@pytest.fixture
|
18
|
+
def device_browser(qtbot, mocked_client):
|
19
|
+
dev_browser = DeviceBrowser(client=mocked_client)
|
20
|
+
qtbot.addWidget(dev_browser)
|
21
|
+
qtbot.waitExposed(dev_browser)
|
22
|
+
yield dev_browser
|
23
|
+
|
24
|
+
|
25
|
+
def test_device_browser_init_with_devices(device_browser):
|
26
|
+
"""
|
27
|
+
Test that the device browser is initialized with the correct number of devices.
|
28
|
+
"""
|
29
|
+
device_list = device_browser.ui.device_list
|
30
|
+
assert device_list.count() == len(device_browser.dev)
|
31
|
+
|
32
|
+
|
33
|
+
def test_device_browser_filtering(qtbot, device_browser):
|
34
|
+
"""
|
35
|
+
Test that the device browser is able to filter the device list.
|
36
|
+
"""
|
37
|
+
device_list = device_browser.ui.device_list
|
38
|
+
device_browser.ui.filter_input.setText("sam")
|
39
|
+
qtbot.wait(1000)
|
40
|
+
assert device_list.count() == 3
|
41
|
+
|
42
|
+
device_browser.ui.filter_input.setText("nonexistent")
|
43
|
+
qtbot.wait(1000)
|
44
|
+
assert device_list.count() == 0
|
45
|
+
|
46
|
+
device_browser.ui.filter_input.setText("")
|
47
|
+
qtbot.wait(1000)
|
48
|
+
assert device_list.count() == len(device_browser.dev)
|
49
|
+
|
50
|
+
|
51
|
+
def test_device_item_mouse_press_event(device_browser, qtbot):
|
52
|
+
"""
|
53
|
+
Test that the mousePressEvent is triggered correctly.
|
54
|
+
"""
|
55
|
+
# Simulate a left mouse press event on the device item
|
56
|
+
device_item: QListWidgetItem = device_browser.ui.device_list.itemAt(0, 0)
|
57
|
+
widget: DeviceItem = device_browser.ui.device_list.itemWidget(device_item)
|
58
|
+
qtbot.mousePress(widget.label, Qt.MouseButton.LeftButton)
|
59
|
+
|
60
|
+
|
61
|
+
def test_device_item_mouse_press_event_creates_drag(device_browser, qtbot):
|
62
|
+
"""
|
63
|
+
Test that the mousePressEvent is triggered correctly and initiates a drag.
|
64
|
+
"""
|
65
|
+
device_item: QListWidgetItem = device_browser.ui.device_list.itemAt(0, 0)
|
66
|
+
widget: DeviceItem = device_browser.ui.device_list.itemWidget(device_item)
|
67
|
+
device_name = widget.device
|
68
|
+
with mock.patch("qtpy.QtGui.QDrag.exec_") as mock_exec:
|
69
|
+
with mock.patch("qtpy.QtGui.QDrag.setMimeData") as mock_set_mimedata:
|
70
|
+
qtbot.mousePress(widget.label, Qt.MouseButton.LeftButton)
|
71
|
+
mock_set_mimedata.assert_called_once()
|
72
|
+
mock_exec.assert_called_once()
|
73
|
+
assert mock_set_mimedata.call_args[0][0].text() == device_name
|
74
|
+
|
75
|
+
|
76
|
+
def test_device_item_double_click_event(device_browser, qtbot):
|
77
|
+
"""
|
78
|
+
Test that the mouseDoubleClickEvent is triggered correctly.
|
79
|
+
"""
|
80
|
+
# Simulate a left mouse press event on the device item
|
81
|
+
device_item: QListWidgetItem = device_browser.ui.device_list.itemAt(0, 0)
|
82
|
+
widget: DeviceItem = device_browser.ui.device_list.itemWidget(device_item)
|
83
|
+
qtbot.mouseDClick(widget, Qt.LeftButton)
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
docs/user/widgets/bec_figure.md
DELETED
@@ -1,146 +0,0 @@
|
|
1
|
-
(user.widgets.bec_figure)=
|
2
|
-
# BECFigure
|
3
|
-
[`BECFigure`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure) is a widget that provides a graphical user interface for creating and managing plots. It is a versatile tool that allows users to create a wide range of plots, from simple 1D waveforms to complex 2D scatter plots. BECFigure is designed to be user-friendly and interactive, enabling users to customize plots and visualize data in real-time.
|
4
|
-
In the following, we describe 4 different type of widgets thaat are available in BECFigure.
|
5
|
-
|
6
|
-
**Schema of the BECFigure**
|
7
|
-
|
8
|
-

|
9
|
-
|
10
|
-
## [1D Waveform Widget](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform)
|
11
|
-
|
12
|
-
**Purpose:** This widget provides a straightforward visualization of 1D data. It is particularly useful for plotting positioner movements against detector readings, enabling users to observe correlations and patterns in a simple, linear format.
|
13
|
-
|
14
|
-
**Key Features:**
|
15
|
-
- Real-time plotting of positioner versus detector values.
|
16
|
-
- Interactive controls for zooming and panning through the data.
|
17
|
-
- Customizable visual elements such as line color and style.
|
18
|
-
|
19
|
-
**Example of Use:**
|
20
|
-

|
21
|
-
|
22
|
-
**Code example 1 - adding curves**
|
23
|
-
|
24
|
-
The following code snipped demonstrates how to create a 1D waveform plot using BEC Widgets within BEC. More details about BEC Widgets in BEC can be found in the getting started section within the [introduction to the command line.](user.command_line_introduction)
|
25
|
-
```python
|
26
|
-
# adds a new dock, a new BECFigure and a BECWaveForm to the dock
|
27
|
-
plt = gui.add_dock().add_widget('BECFigure').plot(x_name='samx', y_name='bpm4i')
|
28
|
-
# add a second curve to the same plot
|
29
|
-
plt.plot(x_name='samx', y_name='bpm3i')
|
30
|
-
plt.set_title("Gauss plots vs. samx")
|
31
|
-
plt.set_x_label("Motor X")
|
32
|
-
plt.set_y_label("Gauss Signal (A.U.")
|
33
|
-
```
|
34
|
-
Note, the return value of the simulated devices *bpm4i* and *bpm3i* may not be gaussian signals, but they can be easily configured with the code snippet below. For more details please check the documentation of the [simulation](https://bec.readthedocs.io/en/latest/developer/devices/bec_sim.html).
|
35
|
-
```python
|
36
|
-
# bpm4i uses GaussianModel and samx as a reference; default settings
|
37
|
-
dev.bpm4i.sim.select_sim_model("GaussianModel")
|
38
|
-
# bpm3i uses StepModel and samx as a reference; default settings
|
39
|
-
dev.bpm3i.sim.select_sim_model("StepModel")
|
40
|
-
```
|
41
|
-
|
42
|
-
**Code example 2 - Adding Data Processing Pipeline Curve with LMFit Models**
|
43
|
-
|
44
|
-
Together with the scan curve, one can also add a second curve that fits the signal using a specified model
|
45
|
-
from [LMFit](https://lmfit.github.io/lmfit-py/builtin_models.html). The following code snippet demonstrates how to
|
46
|
-
create a 1D waveform curve with an attached DAP process, or how to add a DAP process to an existing curve using the BEC
|
47
|
-
CLI. Please note that for this example, both devices were set as Gaussian signals.
|
48
|
-
|
49
|
-
```python
|
50
|
-
# Add a new dock, a new BECFigure, and a BECWaveForm to the dock with a GaussianModel DAP
|
51
|
-
plt = gui.add_dock().add_widget('BECFigure').plot(x_name='samx', y_name='bpm4i', dap="GaussianModel")
|
52
|
-
|
53
|
-
# Add a second curve to the same plot without DAP
|
54
|
-
plt.plot(x_name='samx', y_name='bpm3a')
|
55
|
-
|
56
|
-
# Add DAP to the second curve
|
57
|
-
plt.add_dap(x_name='samx', y_name='bpm3a', dap="GaussianModel")
|
58
|
-
|
59
|
-
```
|
60
|
-
|
61
|
-
To get the parameters of the fit, one has to retrieve the curve objects and call the dap_params property.
|
62
|
-
|
63
|
-
```python
|
64
|
-
# Get the curve object by name from the legend
|
65
|
-
dap_bpm4i = plt.get_curve("bpm4i-bpm4i-GaussianModel")
|
66
|
-
dap_bpm3a = plt.get_curve("bpm3a-bpm3a-GaussianModel")
|
67
|
-
|
68
|
-
# Get the parameters of the fit
|
69
|
-
print(dap_bpm4i.dap_params)
|
70
|
-
# Output
|
71
|
-
{'amplitude': 197.399639720862,
|
72
|
-
'center': 5.013486095404885,
|
73
|
-
'sigma': 0.9820868875739888}
|
74
|
-
|
75
|
-
print(dap_bpm3a.dap_params)
|
76
|
-
# Output
|
77
|
-
{'amplitude': 698.3072786185278,
|
78
|
-
'center': 0.9702840866173836,
|
79
|
-
'sigma': 1.97139754785518}
|
80
|
-
```
|
81
|
-
|
82
|
-

|
83
|
-
|
84
|
-
(user.widgets.scatter_2d)=
|
85
|
-
## [2D Scatter Plot](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform)
|
86
|
-
|
87
|
-
**Purpose:** The 2D scatter plot widget is designed for more complex data visualization. It employs a false color map to represent a third dimension (z-axis), making it an ideal tool for visualizing multidimensional data sets.
|
88
|
-
|
89
|
-
**Key Features:**
|
90
|
-
|
91
|
-
- 2D scatter plot with color-coded data points based on a third variable (two positioners for x/y vs. one detector for colormap).
|
92
|
-
- Interactive false color map for enhanced data interpretation.
|
93
|
-
- Tools for selecting and inspecting specific data points.
|
94
|
-
|
95
|
-
**Example of Use:**
|
96
|
-

|
97
|
-
|
98
|
-
**Code example**
|
99
|
-
The following code snipped demonstrates how to create a 2D scatter plot using BEC Widgets within BEC.
|
100
|
-
```python
|
101
|
-
# adds a new dock, a new BECFigure and a BECWaveForm to the dock
|
102
|
-
plt = gui.add_dock().add_widget('BECFigure').add_plot(x_name='samx', y_name='samy', z_name='bpm4i')
|
103
|
-
```
|
104
|
-
|
105
|
-
(user.widgets.motor_map)=
|
106
|
-
## [Motor Position Map](/api_reference/_autosummary/bec_widgets.cli.client.BECMotorMap)
|
107
|
-
|
108
|
-
**Purpose:** A specialized component derived from the Motor Alignment Tool. It's focused on tracking and visualizing the position of motors, crucial for precise alignment and movement tracking during scans.
|
109
|
-
|
110
|
-
**Key Features:**
|
111
|
-
- Real-time tracking of motor positions.
|
112
|
-
- Visual representation of motor trajectories, aiding in alignment tasks.
|
113
|
-
|
114
|
-
**Example of Use:**
|
115
|
-

|
116
|
-
|
117
|
-
**Code example**
|
118
|
-
The following code snipped demonstrates how to create a motor map using BEC Widgets within BEC.
|
119
|
-
```python
|
120
|
-
# add a motor map to the gui
|
121
|
-
mot_map = gui.add_dock().add_widget('BECFigure').motor_map('samx', 'samy')
|
122
|
-
# change the number of points displayed
|
123
|
-
```
|
124
|
-
|
125
|
-
(user.widgets.image_2d)=
|
126
|
-
## [Image Plot](/api_reference/_autosummary/bec_widgets.cli.client.BECImageItem)
|
127
|
-
|
128
|
-
**Purpose:** A versatile widget for visualizing 2D image data, such as camera images. It provides a detailed representation of image data, with an attached color and scale bar to dynamically adjust the image display.
|
129
|
-
|
130
|
-
**Key Features:**
|
131
|
-
- Live-plotting of 2D image data from cameras (*if data stream is available in BEC*).
|
132
|
-
- Color maps and scale bars for customizing image display.
|
133
|
-
**Example of Use:**
|
134
|
-

|
135
|
-
|
136
|
-
**Code example**
|
137
|
-
The following code snipped demonstrates how to create a motor map using BEC Widgets within BEC.
|
138
|
-
```python
|
139
|
-
# add a camera view for the eiger camera to the gui
|
140
|
-
cam_widget = gui.add_dock().add_widget('BECFigure').image('eiger')
|
141
|
-
# set the title of the camera view
|
142
|
-
cam_widget.set_title("Camera Image Eiger")
|
143
|
-
# change the color map range, e.g. from 0 to 100, per default it is autoscaling
|
144
|
-
# Note, the simulation has hot pixels on the detector
|
145
|
-
cam_widget.set_vrange(vmin=0, vmax=100)
|
146
|
-
```
|
@@ -1,30 +0,0 @@
|
|
1
|
-
(user.widgets.bec_status_box)=
|
2
|
-
# BEC Status Box
|
3
|
-
**Purpose:**
|
4
|
-
|
5
|
-
The [BECStatusBox](/api_reference/_autosummary/bec_widgets.cli.client.BECStatusBox) is a widget that allows you to monitor the status/health of the all running BEC processes. The widget generates the view automatically and updates the status of the processes in real-time. The top level indicates the overall state of the BEC core services (DeviceServer, ScanServer, SciHub, ScanBundler and FileWriter), but you can also see the status of each individual process by opening the collapsed view. In the collapsed view, you can double click on each process to get a popup window with live updates of the metrics for each process in real-time.
|
6
|
-
|
7
|
-
**Key Features:**
|
8
|
-
|
9
|
-
- monitor the state of individual BEC services.
|
10
|
-
- automatically track BEC services, i.e. additional clients connecting.
|
11
|
-
- live-updates of the metrics for each process.
|
12
|
-
|
13
|
-
**Example of Use:**
|
14
|
-

|
15
|
-
|
16
|
-
**Code example:**
|
17
|
-
|
18
|
-
The following code snipped demonstrates how to create a `BECStatusBox` widget using BEC Widgets within BEC.
|
19
|
-
```python
|
20
|
-
bec_status_box = gui.add_dock().add_widget("BECStatusBox")
|
21
|
-
```
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
docs/user/widgets/buttons.md
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
(user.widgets.buttons)=
|
2
|
-
# Buttons Widgets
|
3
|
-
|
4
|
-
This section consolidates various custom buttons used within the BEC GUIs, facilitating the integration of these
|
5
|
-
controls into different layouts.
|
6
|
-
|
7
|
-
## Stop Button
|
8
|
-
|
9
|
-
**Purpose:**
|
10
|
-
|
11
|
-
The `Stop Button` provides a user interface control to immediately halt the execution of the current operation in the
|
12
|
-
BEC Client. It is designed for easy integration into any BEC GUI layout.
|
13
|
-
|
14
|
-
**Key Features:**
|
15
|
-
|
16
|
-
- **Immediate Termination:** Halts the execution of the current script or process.
|
17
|
-
- **Queue Management:** Clears any pending operations in the scan queue, ensuring the system is ready for new tasks.
|
18
|
-
|
19
|
-
**Code example:**
|
20
|
-
|
21
|
-
Integrating the `StopButton` into a BEC GUI layout is straightforward. The following example demonstrates how to embed
|
22
|
-
a `StopButton` within a GUI layout:
|
23
|
-
|
24
|
-
```python
|
25
|
-
from qtpy.QtWidgets import QWidget, QVBoxLayout
|
26
|
-
from bec_widgets.widgets.buttons import StopButton
|
27
|
-
|
28
|
-
|
29
|
-
class MyGui(QWidget):
|
30
|
-
def __init__(self):
|
31
|
-
super().__init__()
|
32
|
-
self.setLayout(QVBoxLayout(self)) # Initialize the layout for the widget
|
33
|
-
|
34
|
-
# Create and add the StopButton to the layout
|
35
|
-
self.stop_button = StopButton()
|
36
|
-
self.layout().addWidget(self.stop_button)
|
37
|
-
```
|