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,76 @@
|
|
1
|
+
(user.widgets.position_indicator)=
|
2
|
+
|
3
|
+
# Position Indicator Widget
|
4
|
+
|
5
|
+
````{tab} Overview
|
6
|
+
|
7
|
+
The [`PositionIndicator`](/api_reference/_autosummary/bec_widgets.cli.client.PositionIndicator) widget is a simple yet effective tool for visually indicating the position of a motor within its set limits. This widget is particularly useful in applications where it is important to provide a visual cue of the motor's current position relative to its minimum and maximum values. The `PositionIndicator` can be easily integrated into your GUI application either through direct code instantiation or by using `QtDesigner`.
|
8
|
+
|
9
|
+
## Key Features:
|
10
|
+
- **Position Visualization**: Displays the current position of a motor on a linear scale, showing its location relative to the defined limits.
|
11
|
+
- **Customizable Range**: The widget allows you to set the minimum and maximum range, adapting to different motor configurations.
|
12
|
+
- **Real-Time Updates**: Responds to real-time updates, allowing the position indicator to move dynamically as the motor's position changes.
|
13
|
+
- **QtDesigner Integration**: Can be added directly in code or through `QtDesigner`, making it adaptable to various use cases.
|
14
|
+
|
15
|
+
````
|
16
|
+
|
17
|
+
````{tab} Examples
|
18
|
+
|
19
|
+
The `PositionIndicator` widget can be embedded within a GUI application through direct code instantiation or by using `QtDesigner`. Below are examples demonstrating how to create and use the `PositionIndicator` widget.
|
20
|
+
|
21
|
+
## Example 1 - Creating a Position Indicator in Code
|
22
|
+
|
23
|
+
In this example, we demonstrate how to create a `PositionIndicator` widget in code and connect it to a slider to simulate position updates.
|
24
|
+
|
25
|
+
```python
|
26
|
+
from qtpy.QtWidgets import QApplication, QSlider, QVBoxLayout, QWidget
|
27
|
+
from bec_widgets.widgets.position_indicator import PositionIndicator
|
28
|
+
|
29
|
+
app = QApplication([])
|
30
|
+
|
31
|
+
# Create the PositionIndicator widget
|
32
|
+
position_indicator = PositionIndicator()
|
33
|
+
|
34
|
+
# Create a slider to simulate position changes
|
35
|
+
slider = QSlider(Qt.Horizontal)
|
36
|
+
slider.valueChanged.connect(lambda value: position_indicator.on_position_update(value / 100))
|
37
|
+
|
38
|
+
# Create a layout and add the widgets
|
39
|
+
layout = QVBoxLayout()
|
40
|
+
layout.addWidget(position_indicator)
|
41
|
+
layout.addWidget(slider)
|
42
|
+
|
43
|
+
# Set up the main widget
|
44
|
+
widget = QWidget()
|
45
|
+
widget.setLayout(layout)
|
46
|
+
widget.show()
|
47
|
+
|
48
|
+
app.exec_()
|
49
|
+
```
|
50
|
+
|
51
|
+
## Example 2 - Setting the Range for the Position Indicator
|
52
|
+
|
53
|
+
You can set the minimum and maximum range for the position indicator to reflect the actual limits of the motor.
|
54
|
+
|
55
|
+
```python
|
56
|
+
# Set the range for the position indicator
|
57
|
+
position_indicator.set_range(min_value=0, max_value=200)
|
58
|
+
```
|
59
|
+
|
60
|
+
## Example 3 - Integrating the Position Indicator in QtDesigner
|
61
|
+
|
62
|
+
The `PositionIndicator` can be added to your GUI layout using `QtDesigner`. Once added, you can connect it to the motor's position updates using the `on_position_update` slot.
|
63
|
+
|
64
|
+
```python
|
65
|
+
# Example: Updating the position in a QtDesigner-based application
|
66
|
+
self.position_indicator.on_position_update(new_position_value)
|
67
|
+
```
|
68
|
+
|
69
|
+
````
|
70
|
+
|
71
|
+
````{tab} API
|
72
|
+
|
73
|
+
```{eval-rst}
|
74
|
+
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.PositionIndicator.rst
|
75
|
+
```
|
76
|
+
````
|
@@ -0,0 +1,63 @@
|
|
1
|
+
(user.widgets.positioner_box)=
|
2
|
+
|
3
|
+
# Positioner Box Widget
|
4
|
+
|
5
|
+
````{tab} Overview
|
6
|
+
|
7
|
+
The [`PositionerBox`](/api_reference/_autosummary/bec_widgets.cli.client.PositionerBox) widget provides a graphical user interface to control a positioner device within the BEC environment. This widget allows users to interact with a positioner by setting setpoints, tweaking the motor position, and stopping motion. The device selection can be done via a small button under the device label, through `QtDesigner`, or by using the command line interface (CLI). This flexibility makes the `PositionerBox` an essential tool for tasks involving precise position control.
|
8
|
+
|
9
|
+
## Key Features:
|
10
|
+
- **Device Selection**: Easily select a positioner device by clicking the button under the device label or by configuring the widget in `QtDesigner`.
|
11
|
+
- **Setpoint Control**: Directly set the positioner’s target setpoint and issue movement commands.
|
12
|
+
- **Tweak Controls**: Adjust the motor position incrementally using the tweak left/right buttons.
|
13
|
+
- **Real-Time Feedback**: Monitor the device’s current position and status, with live updates on whether the device is moving or idle.
|
14
|
+
- **Flexible Integration**: Can be integrated into a GUI through `BECDockArea` or used as a standalone component in `QtDesigner`.
|
15
|
+
````
|
16
|
+
|
17
|
+
````{tab} Examples
|
18
|
+
|
19
|
+
The `PositionerBox` widget can be integrated within a GUI application either through direct code instantiation or by using `QtDesigner`. Below are examples demonstrating how to create and use the `PositionerBox` widget.
|
20
|
+
|
21
|
+
## Example 1 - Creating a PositionerBox in Code
|
22
|
+
|
23
|
+
In this example, we demonstrate how to create a `PositionerBox` widget in code and configure it for a specific device.
|
24
|
+
|
25
|
+
```python
|
26
|
+
from qtpy.QtWidgets import QApplication, QVBoxLayout, QWidget
|
27
|
+
from bec_widgets.widgets.positioner_box import PositionerBox
|
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 PositionerBox to the layout
|
35
|
+
self.positioner_box = PositionerBox(device="motor1")
|
36
|
+
self.layout().addWidget(self.positioner_box)
|
37
|
+
|
38
|
+
# Example of how this custom GUI might be used:
|
39
|
+
app = QApplication([])
|
40
|
+
my_gui = MyGui()
|
41
|
+
my_gui.show()
|
42
|
+
app.exec_()
|
43
|
+
```
|
44
|
+
|
45
|
+
## Example 2 - Selecting a Device via GUI
|
46
|
+
|
47
|
+
Users can select the positioner device by clicking the button under the device label, which opens a dialog for device selection.
|
48
|
+
|
49
|
+
## Example 3 - Customizing PositionerBox in QtDesigner
|
50
|
+
|
51
|
+
The `PositionerBox` widget can be added to a GUI through `QtDesigner`. Once integrated, you can configure the default device and customize the widget’s appearance and behavior directly within the designer.
|
52
|
+
|
53
|
+
```python
|
54
|
+
# After adding the widget to a form in QtDesigner, you can configure the device:
|
55
|
+
self.positioner_box.set_positioner("motor2")
|
56
|
+
```
|
57
|
+
````
|
58
|
+
|
59
|
+
````{tab} API
|
60
|
+
```{eval-rst}
|
61
|
+
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.PositionerBox.rst
|
62
|
+
```
|
63
|
+
````
|
@@ -0,0 +1,103 @@
|
|
1
|
+
(user.widgets.ring_progress_bar)=
|
2
|
+
|
3
|
+
# Ring Progress Bar
|
4
|
+
|
5
|
+
````{tab} Overview
|
6
|
+
|
7
|
+
The [`Ring Progress Bar`](/api_reference/_autosummary/bec_widgets.cli.client.RingProgressBar) widget is a circular progress bar designed to visualize the progress of tasks in a clear and intuitive manner. This widget is particularly useful in applications where task progress needs to be represented as a percentage. The `Ring Progress Bar` can be controlled directly via its API or can be hooked up to track the progress of a device readback or scan, providing real-time visual feedback.
|
8
|
+
|
9
|
+
## Key Features:
|
10
|
+
- **Circular Progress Visualization**: Displays a circular progress bar to represent task completion.
|
11
|
+
- **Device and Scan Integration**: Hooks into device readbacks or scans to automatically update the progress bar based on real-time data.
|
12
|
+
- **Multiple Rings**: Supports multiple progress rings within the same widget to track different tasks in parallel.
|
13
|
+
- **Customizable Visual Elements**: Allows customization of colors, line widths, and other visual elements for each progress ring.
|
14
|
+
|
15
|
+

|
16
|
+
|
17
|
+
````
|
18
|
+
|
19
|
+
````{tab} Example
|
20
|
+
|
21
|
+
## Example 1 - Adding Ring Progress Bar to BECDockArea
|
22
|
+
|
23
|
+
In this example, we demonstrate how to add a `RingProgressBar` widget to a `BECDockArea` to visualize the progress of a task.
|
24
|
+
|
25
|
+
```python
|
26
|
+
# Add a new dock with a RingProgressBar widget
|
27
|
+
progress = gui.add_dock().add_widget("RingProgressBar")
|
28
|
+
|
29
|
+
# Customize the size of the progress ring
|
30
|
+
progress.set_line_widths(20)
|
31
|
+
```
|
32
|
+
|
33
|
+
## Example 2 - Adding Multiple Rings to Track Parallel Tasks
|
34
|
+
|
35
|
+
By default, the `RingProgressBar` widget displays a single ring. You can add additional rings to track multiple tasks simultaneously.
|
36
|
+
|
37
|
+
```python
|
38
|
+
# Add a second ring to the RingProgressBar
|
39
|
+
progress.add_ring()
|
40
|
+
|
41
|
+
# Customize the rings
|
42
|
+
progress.rings[0].set_line_widths(20) # Set the width of the first ring
|
43
|
+
progress.rings[1].set_line_widths(10) # Set the width of the second ring
|
44
|
+
```
|
45
|
+
|
46
|
+
## Example 3 - Integrating with Device Readback and Scans
|
47
|
+
|
48
|
+
The `RingProgressBar` can automatically update based on the progress of scans or device readbacks. This example shows how to set up the progress rings to reflect these updates.
|
49
|
+
|
50
|
+
```python
|
51
|
+
# Set the first ring to update based on scan progress
|
52
|
+
progress.rings[0].set_update("scan")
|
53
|
+
|
54
|
+
# Set the second ring to update based on a device readback (e.g., samx)
|
55
|
+
progress.rings[1].set_update("device", "samx")
|
56
|
+
```
|
57
|
+
|
58
|
+
## Example 4 - Customizing Visual Elements of the Rings
|
59
|
+
|
60
|
+
The `RingProgressBar` widget offers various customization options, such as changing colors, line widths, and the gap between rings.
|
61
|
+
|
62
|
+
```python
|
63
|
+
# Set the color of the first ring to blue
|
64
|
+
progress.rings[0].set_color("blue")
|
65
|
+
|
66
|
+
# Set the background color of the second ring
|
67
|
+
progress.rings[1].set_background("gray")
|
68
|
+
|
69
|
+
# Adjust the gap between the rings
|
70
|
+
progress.set_gap(5)
|
71
|
+
|
72
|
+
# Set the diameter of the progress bar
|
73
|
+
progress.set_diameter(150)
|
74
|
+
```
|
75
|
+
|
76
|
+
## Example 5 - Manual Updates and Precision Control
|
77
|
+
|
78
|
+
While the `RingProgressBar` supports automatic updates, you can also manually control the progress and set the precision for each ring.
|
79
|
+
|
80
|
+
```python
|
81
|
+
# Disable automatic updates and manually set the progress value
|
82
|
+
progress.enable_auto_updates(False)
|
83
|
+
progress.rings[0].set_value(75) # Set the first ring to 75%
|
84
|
+
|
85
|
+
# Set precision for the progress display
|
86
|
+
progress.set_precision(2) # Display progress with two decimal places
|
87
|
+
|
88
|
+
|
89
|
+
# Setting multiple rigns with different values
|
90
|
+
progress.set_number_of_bars(3)
|
91
|
+
|
92
|
+
# Set the values of the rings to 50, 75, and 25 from outer to inner ring
|
93
|
+
progress.set_value([50, 75, 25])
|
94
|
+
```
|
95
|
+
|
96
|
+
````
|
97
|
+
|
98
|
+
````{tab} API
|
99
|
+
```{eval-rst}
|
100
|
+
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.RingProgressBar.rst
|
101
|
+
```
|
102
|
+
````
|
103
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
(user.widgets.bec_queue)=
|
2
|
+
|
3
|
+
# BEC Queue Widget
|
4
|
+
|
5
|
+
````{tab} Overview
|
6
|
+
|
7
|
+
The [`BEC Queue Widget`](/api_reference/_autosummary/bec_widgets.cli.client.BECQueue) provides a real-time display of the BEC scan queue, allowing users to monitor and track the status of ongoing and pending scans. The widget automatically updates to reflect the current state of the scan queue, displaying critical information such as scan numbers, types, and statuses. This widget is particularly useful for users who need to manage and oversee multiple scans in the BEC environment.
|
8
|
+
|
9
|
+
## Key Features:
|
10
|
+
- **Real-Time Queue Monitoring**: Displays the current state of the BEC scan queue, with automatic updates as the queue changes.
|
11
|
+
- **Detailed Scan Information**: Provides a clear view of scan numbers, types, and statuses, helping users track the progress and state of each scan.
|
12
|
+
- **Interactive Table Layout**: The queue is presented in a table format, with customizable columns that stretch to fit the available space.
|
13
|
+
- **Flexible Integration**: The widget can be integrated into both [`BECDockArea`](user.widgets.bec_dock_area) and used as an individual component in your application through `QtDesigner`.
|
14
|
+
|
15
|
+
````
|
16
|
+
|
17
|
+
````{tab} Examples
|
18
|
+
|
19
|
+
The `BEC Queue Widget` can be embedded within a [`BECDockArea`](user.widgets.bec_dock_area) or used as an individual component in your application through `QtDesigner`. Below are examples demonstrating how to create and use the `BEC Queue Widget`.
|
20
|
+
|
21
|
+
## Example 1 - Adding BEC Queue Widget to BECDockArea
|
22
|
+
|
23
|
+
In this example, we demonstrate how to add a `BECQueue` widget to a `BECDockArea`, allowing users to monitor the BEC scan queue directly from the GUI.
|
24
|
+
|
25
|
+
```python
|
26
|
+
# Add a new dock with a BECQueue widget
|
27
|
+
bec_queue = gui.add_dock().add_widget("BECQueue")
|
28
|
+
```
|
29
|
+
|
30
|
+
```{hint}
|
31
|
+
The `BECQueue` widget automatically updates as the scan queue changes, providing real-time feedback on the status of each scan.
|
32
|
+
Once the widget is added, it will automatically display the current scan queue
|
33
|
+
```
|
34
|
+
|
35
|
+
````
|
36
|
+
|
37
|
+
````{tab} API
|
38
|
+
```{eval-rst}
|
39
|
+
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.BECQueue.rst
|
40
|
+
```
|
41
|
+
````
|
@@ -0,0 +1,46 @@
|
|
1
|
+
(user.widgets.scan_control)=
|
2
|
+
|
3
|
+
# Scan Control Widget
|
4
|
+
|
5
|
+
````{tab} Overview
|
6
|
+
|
7
|
+
The [`Scan Control`](/api_reference/_autosummary/bec_widgets.cli.client.ScanControl) widget provides a graphical user interface (GUI) to manage various scan operations in a BEC environment. It is designed to interact with the BEC server, enabling users to start and stop scans. The widget automatically creates the necessary input form based on the scan's signature and gui_config, making it highly adaptable to different scanning processes.
|
8
|
+
|
9
|
+
## Key Features:
|
10
|
+
- **Automatic Interface Generation**: Automatically generates a control interface based on scan signatures and `gui_config`.
|
11
|
+
- **Dynamic Argument Bundling**: Supports the dynamic addition and removal of argument bundles such as positioners controls.
|
12
|
+
- **Visual Parameter Grouping**: Provides a visual representation of scan parameters, grouped by their functionality.
|
13
|
+
- **Integrated Scan Controls**: Includes start abd stop controls for managing scan execution.
|
14
|
+
|
15
|
+
```{note}
|
16
|
+
By default, this widget supports scans that are derived from the following base classes and have a defined `gui_config`:
|
17
|
+
- [ScanBase](https://beamline-experiment-control.readthedocs.io/en/latest/api_reference/_autosummary/bec_server.scan_server.scans.ScanBase.html)
|
18
|
+
- [SyncFlyScanBase](https://beamline-experiment-control.readthedocs.io/en/latest/api_reference/_autosummary/bec_server.scan_server.scans.SyncFlyScanBase.html)
|
19
|
+
- [AsyncFlyScanBase](https://beamline-experiment-control.readthedocs.io/en/latest/api_reference/_autosummary/bec_server.scan_server.scans.AsyncFlyScanBase.html)
|
20
|
+
```
|
21
|
+
|
22
|
+
```{hint}
|
23
|
+
The full procedure how to design `gui_config` for your custom scan class is described in the [Scan GUI Configuration](https://bec.readthedocs.io/en/latest/developer/scans/scan_gui_config.html) tutorial.
|
24
|
+
```
|
25
|
+
|
26
|
+
````
|
27
|
+
|
28
|
+
````{tab} Examples
|
29
|
+
|
30
|
+
The `ScanControl` widget can be integrated within a [`BECDockArea`](user.widgets.bec_dock_area) or used as an individual component in your application through `QtDesigner`. Below are examples demonstrating how to create and use the `ScanControl` widget.
|
31
|
+
|
32
|
+
## Example 1 - Adding Scan Control Widget to BECDockArea
|
33
|
+
|
34
|
+
In this example, we demonstrate how to add a `ScanControl` widget to a `BECDockArea`, enabling the user to control scan operations directly from the GUI.
|
35
|
+
|
36
|
+
```python
|
37
|
+
# Add a new dock with a ScanControl widget
|
38
|
+
scan_control = gui.add_dock().add_widget("ScanControl")
|
39
|
+
```
|
40
|
+
````
|
41
|
+
|
42
|
+
````{tab} API
|
43
|
+
```{eval-rst}
|
44
|
+
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.ScanControl.rst
|
45
|
+
```
|
46
|
+
````
|
@@ -0,0 +1,75 @@
|
|
1
|
+
(user.widgets.spinner)=
|
2
|
+
|
3
|
+
# Spinner Widget
|
4
|
+
|
5
|
+
````{tab} Overview
|
6
|
+
|
7
|
+
The [`SpinnerWidget`](/api_reference/_autosummary/bec_widgets.cli.client.SpinnerWidget) is a simple and versatile widget designed to indicate loading or movement within an application. It is commonly used to show that a device is in motion or that an operation is ongoing. The `SpinnerWidget` can be easily integrated into your GUI application either through direct code instantiation or by using `QtDesigner`.
|
8
|
+
|
9
|
+
## Key Features:
|
10
|
+
- **Loading Indicator**: Provides a visual indication of ongoing operations or device movement.
|
11
|
+
- **Smooth Animation**: Features a smooth, continuous spinning animation to catch the user's attention.
|
12
|
+
- **Easy Integration**: Can be added directly in code or through `QtDesigner`, making it adaptable to various use cases.
|
13
|
+
- **Customizable Appearance**: Automatically adapts to the application's theme, ensuring visual consistency.
|
14
|
+
|
15
|
+
````
|
16
|
+
|
17
|
+
````{tab} Examples
|
18
|
+
|
19
|
+
The `SpinnerWidget` can be embedded within a GUI application through direct code instantiation or by using `QtDesigner`. Below are examples demonstrating how to create and use the `SpinnerWidget`.
|
20
|
+
|
21
|
+
## Example 1 - Creating a Spinner Widget in Code
|
22
|
+
|
23
|
+
In this example, we demonstrate how to create a `SpinnerWidget` in code and start the spinner to indicate an ongoing operation.
|
24
|
+
|
25
|
+
```python
|
26
|
+
from qtpy.QtWidgets import QApplication, QMainWindow
|
27
|
+
from bec_widgets.widgets.spinner_widget import SpinnerWidget
|
28
|
+
|
29
|
+
app = QApplication([])
|
30
|
+
|
31
|
+
# Create a main window
|
32
|
+
window = QMainWindow()
|
33
|
+
|
34
|
+
# Create a SpinnerWidget instance
|
35
|
+
spinner = SpinnerWidget()
|
36
|
+
|
37
|
+
# Start the spinner
|
38
|
+
spinner.start()
|
39
|
+
|
40
|
+
# Set the spinner as the central widget
|
41
|
+
window.setCentralWidget(spinner)
|
42
|
+
window.show()
|
43
|
+
|
44
|
+
app.exec_()
|
45
|
+
```
|
46
|
+
|
47
|
+
## Example 2 - Stopping the Spinner
|
48
|
+
|
49
|
+
You can stop the spinner to indicate that an operation has completed.
|
50
|
+
|
51
|
+
```python
|
52
|
+
# Stop the spinner
|
53
|
+
spinner.stop()
|
54
|
+
```
|
55
|
+
|
56
|
+
## Example 3 - Integrating the Spinner Widget in QtDesigner
|
57
|
+
|
58
|
+
The `SpinnerWidget` can be added to your GUI layout using `QtDesigner`. Once added, you can control the spinner using the `start` and `stop` methods, similar to the code examples above.
|
59
|
+
|
60
|
+
```python
|
61
|
+
# Example: Start the spinner in a QtDesigner-based application
|
62
|
+
self.spinner_widget.start()
|
63
|
+
|
64
|
+
# Example: Stop the spinner in a QtDesigner-based application
|
65
|
+
self.spinner_widget.stop()
|
66
|
+
```
|
67
|
+
|
68
|
+
````
|
69
|
+
|
70
|
+
````{tab} API
|
71
|
+
|
72
|
+
```{eval-rst}
|
73
|
+
.. include:: /api_reference/_autosummary/bec_widgets.widgets.spinner.spinner.SpinnerWidget.rst
|
74
|
+
```
|
75
|
+
````
|
@@ -0,0 +1,74 @@
|
|
1
|
+
(user.widgets.text_box)=
|
2
|
+
|
3
|
+
# Text Box Widget
|
4
|
+
|
5
|
+
````{tab} Overview
|
6
|
+
|
7
|
+
The [`Text Box Widget`](/api_reference/_autosummary/bec_widgets.cli.client.TextBox) is a versatile widget that allows users to display text within the BEC GUI. It supports both plain text and HTML, making it useful for displaying simple messages or more complex formatted content. This widget is particularly suited for integrating textual content directly into the user interface, whether as a standalone message box or as part of a larger application interface.
|
8
|
+
|
9
|
+
## Key Features:
|
10
|
+
- **Text Display**: Display either plain text or HTML content, with automatic detection of the format.
|
11
|
+
- **Customizable Appearance**: Set the background and font colors to match the design of your application.
|
12
|
+
- **Font Size Adjustment**: Customize the font size of the displayed text for better readability.
|
13
|
+
|
14
|
+
````
|
15
|
+
|
16
|
+
````{tab} Examples - CLI
|
17
|
+
|
18
|
+
The `TextBox` widget can be integrated 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 customize the `TextBox` widget in various scenarios.
|
19
|
+
|
20
|
+
## Example 1 - Adding Text Box Widget to BECDockArea
|
21
|
+
|
22
|
+
In this example, we demonstrate how to add a `TextBox` widget to a `BECDockArea` and set the text to be displayed.
|
23
|
+
|
24
|
+
```python
|
25
|
+
# Add a new dock with a TextBox widget
|
26
|
+
text_box = gui.add_dock().add_widget("TextBox")
|
27
|
+
|
28
|
+
# Set the text to display
|
29
|
+
text_box.set_text("Hello, World!")
|
30
|
+
```
|
31
|
+
|
32
|
+
## Example 2 - Displaying HTML Content
|
33
|
+
|
34
|
+
The `TextBox` widget can automatically detect and render HTML content. This example shows how to display formatted HTML text.
|
35
|
+
|
36
|
+
```python
|
37
|
+
# Set the text to display as HTML
|
38
|
+
text_box.set_text("<h1>Welcome to BEC Widgets</h1><p>This is an example of displaying <strong>HTML</strong> text.</p>")
|
39
|
+
```
|
40
|
+
|
41
|
+
## Example 3 - Customizing Appearance
|
42
|
+
|
43
|
+
The `TextBox` widget allows you to customize the background and font colors to fit your application's design. Below is an example of how to set these properties.
|
44
|
+
|
45
|
+
```python
|
46
|
+
# Set the background color to white and the font color to black
|
47
|
+
text_box.set_color(background_color="#FFF", font_color="#000")
|
48
|
+
```
|
49
|
+
|
50
|
+
## Example 4 - Adjusting Font Size
|
51
|
+
|
52
|
+
To improve readability or fit more text within the widget, you can adjust the font size.
|
53
|
+
|
54
|
+
```python
|
55
|
+
# Set the font size to 14 pixels
|
56
|
+
text_box.set_font_size(14)
|
57
|
+
```
|
58
|
+
|
59
|
+
````
|
60
|
+
|
61
|
+
````{tab} API
|
62
|
+
```{eval-rst}
|
63
|
+
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.TextBox.rst
|
64
|
+
```
|
65
|
+
````
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
@@ -0,0 +1,66 @@
|
|
1
|
+
(user.widgets.toggle)=
|
2
|
+
|
3
|
+
# Toggle Switch Widget
|
4
|
+
|
5
|
+
````{tab} Overview
|
6
|
+
|
7
|
+
The [`Toggle Switch`](/api_reference/_autosummary/bec_widgets.cli.client.ToggleSwitch) widget provides a simple, customizable toggle switch that can be used to represent binary states (e.g., on/off, true/false) within a GUI. This widget is designed to be used directly in code or added through `QtDesigner`, making it versatile for various applications where a user-friendly switch is needed.
|
8
|
+
|
9
|
+
## Key Features:
|
10
|
+
- **Binary State Representation**: Represents a simple on/off state with a smooth toggle animation.
|
11
|
+
- **Customizable Appearance**: Allows customization of track and thumb colors for both active and inactive states.
|
12
|
+
- **Smooth Animation**: Includes a smooth animation when toggling between states, enhancing user interaction.
|
13
|
+
- **QtDesigner Integration**: Can be added directly through `QtDesigner` or instantiated in code.
|
14
|
+
|
15
|
+
````
|
16
|
+
|
17
|
+
````{tab} Examples
|
18
|
+
|
19
|
+
The `Toggle Switch` widget can be integrated within a GUI application either through direct code instantiation or by using `QtDesigner`. Below are examples demonstrating how to create and customize the `Toggle Switch` widget.
|
20
|
+
|
21
|
+
## Example 1 - Creating a Toggle Switch in Code
|
22
|
+
|
23
|
+
In this example, we demonstrate how to create a `ToggleSwitch` widget in code and customize its appearance.
|
24
|
+
|
25
|
+
```python
|
26
|
+
from qtpy.QtWidgets import QApplication, QVBoxLayout, QWidget
|
27
|
+
from bec_widgets.widgets.toggle_switch import ToggleSwitch
|
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 ToggleSwitch to the layout
|
35
|
+
self.toggle_switch = ToggleSwitch()
|
36
|
+
self.layout().addWidget(self.toggle_switch)
|
37
|
+
|
38
|
+
# Example of how this custom GUI might be used:
|
39
|
+
app = QApplication([])
|
40
|
+
my_gui = MyGui()
|
41
|
+
my_gui.show()
|
42
|
+
app.exec_()
|
43
|
+
```
|
44
|
+
|
45
|
+
## Example 2 - Customizing the Toggle Switch Appearance
|
46
|
+
|
47
|
+
The `ToggleSwitch` widget allows you to customize its appearance by changing the track and thumb colors for both active and inactive states. Below is an example of how to set these properties.
|
48
|
+
|
49
|
+
```python
|
50
|
+
# Set the active and inactive track and thumb colors
|
51
|
+
self.toggle_switch.active_track_color = QColor(0, 122, 204) # Active state track color (blue)
|
52
|
+
self.toggle_switch.inactive_track_color = QColor(200, 200, 200) # Inactive state track color (grey)
|
53
|
+
self.toggle_switch.active_thumb_color = QColor(255, 255, 255) # Active state thumb color (white)
|
54
|
+
self.toggle_switch.inactive_thumb_color = QColor(255, 255, 255) # Inactive state thumb color (white)
|
55
|
+
```
|
56
|
+
|
57
|
+
## Example 3 - Integrating the Toggle Switch in QtDesigner
|
58
|
+
|
59
|
+
The `ToggleSwitch` can be added as a custom widget in `QtDesigner`. Once integrated, you can configure its properties through the designer's property editor. After adding the widget to a form in QtDesigner, you can manipulate it in your PyQt/PySide application:
|
60
|
+
|
61
|
+
```python
|
62
|
+
# For instance:
|
63
|
+
self.toggle_switch.setChecked(True)
|
64
|
+
```
|
65
|
+
|
66
|
+
````
|
@@ -0,0 +1,132 @@
|
|
1
|
+
(user.widgets.waveform_widget)=
|
2
|
+
|
3
|
+
# Waveform Widget
|
4
|
+
|
5
|
+
````{tab} Overview
|
6
|
+
|
7
|
+
The Waveform Widget is used to display 1D detector signals. The widget is directly integrated with the `BEC` framework and can display real-time data from detectors loaded in the current `BEC` session as well as custom data from users.
|
8
|
+
|
9
|
+
## Key Features:
|
10
|
+
- **Flexible Integration**: The widget can be integrated into both [`BECFigure`](user.widgets.bec_figure) and [`BECDockArea`](user.widgets.bec_dock_area), or used as an individual component in your application through `BECDesigner`.
|
11
|
+
- **Data Visualization**: Real-time plotting of positioner versus detector values from the BEC session, as well as static plotting of custom data.
|
12
|
+
- **Real-time Data Processing**: Add real-time Data Processing Pipeline (DAP) to the real-time acquisition.
|
13
|
+
- **Data Export**: Export data to CSV, H5, and other formats.
|
14
|
+
- **Customizable Visual Elements**: Customize visual elements such as line color and style.
|
15
|
+
- **Interactive Controls**: Interactive controls for zooming and panning through the data.
|
16
|
+
|
17
|
+

|
18
|
+
````
|
19
|
+
|
20
|
+
````{tab} Examples - CLI
|
21
|
+
|
22
|
+
`WaveformWidget` can be embedded in both `BECFigure` and `BECDockArea`, or used as an individual component in your application through `BECDesigner`. However, the command-line API is the same for all cases.
|
23
|
+
|
24
|
+
## Example 1 - Adding Waveform Widget to BECFigure
|
25
|
+
|
26
|
+
In this example, we will demonstrate how to add two different `WaveformWidgets` into a single `BECFigure` widget.
|
27
|
+
|
28
|
+
```python
|
29
|
+
# Add new dock with BECFigure widget
|
30
|
+
fig = gui.add_dock().add_widget('BECFigure')
|
31
|
+
|
32
|
+
# Add two WaveformWidgets to the BECFigure
|
33
|
+
plt1 = fig.plot(x_name='samx', y_name='bpm4i')
|
34
|
+
plt2 = fig.plot(x_name='samx', y_name='bpm3i')
|
35
|
+
```
|
36
|
+
|
37
|
+
## Example 2 - Adding Waveform Widget as a dock with BECDockArea
|
38
|
+
|
39
|
+
Adding `WaveformWidget` into a `BECDockArea` is similar to adding any other widget. The widget has the same API as the one in BECFigure; however, as an independent widget outside BECFigure, it has its own toolbar, allowing users to configure the widget without needing CLI commands.
|
40
|
+
|
41
|
+
```python
|
42
|
+
# Add new WaveformWidgets to the BECDockArea
|
43
|
+
plt1 = gui.add_dock().add_widget('BECWaveformWidget')
|
44
|
+
plt2 = gui.add_dock().add_widget('BECWaveformWidget')
|
45
|
+
|
46
|
+
# Add signals to the WaveformWidget
|
47
|
+
plt1.plot(x_name='samx', y_name='bpm4i')
|
48
|
+
plt2.plot(x_name='samx', y_name='bpm3i')
|
49
|
+
```
|
50
|
+
|
51
|
+
## Example 3 - Adding Waveform Widget with curves
|
52
|
+
```python
|
53
|
+
# adds a new dock, a new BECFigure and a BECWaveForm to the dock
|
54
|
+
plt = gui.add_dock().add_widget('BECFigure').plot(x_name='samx', y_name='bpm4i')
|
55
|
+
|
56
|
+
# add a second curve to the same plot
|
57
|
+
plt.plot(x_name='samx', y_name='bpm3i')
|
58
|
+
|
59
|
+
# set axis labels
|
60
|
+
plt.set_title("Gauss plots vs. samx")
|
61
|
+
plt.set_x_label("Motor X")
|
62
|
+
plt.set_y_label("Gauss Signal (A.U.")
|
63
|
+
```
|
64
|
+
|
65
|
+
```{note}
|
66
|
+
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 for the [simulation](https://bec.readthedocs.io/en/latest/developer/devices/bec_sim.html).
|
67
|
+
```
|
68
|
+
|
69
|
+
```python
|
70
|
+
# bpm4i uses GaussianModel and samx as a reference; default settings
|
71
|
+
dev.bpm4i.sim.select_sim_model("GaussianModel")
|
72
|
+
|
73
|
+
# bpm3i uses StepModel and samx as a reference; default settings
|
74
|
+
dev.bpm3i.sim.select_sim_model("StepModel")
|
75
|
+
```
|
76
|
+
## Example 4 - Adding Data Processing Pipeline Curve with LMFit Models
|
77
|
+
|
78
|
+
In addition to the scan curve, you can also add a second curve that fits the signal using a specified model from [LMFit](https://lmfit.github.io/lmfit-py/builtin_models.html). The following code snippet demonstrates how to create a 1D waveform curve with an attached DAP process, or how to add a DAP process to an existing curve using the BEC CLI. Please note that for this example, both devices were set as Gaussian signals.
|
79
|
+
|
80
|
+
```python
|
81
|
+
# Add a new dock, a new BECFigure, and a BECWaveForm to the dock with a GaussianModel DAP
|
82
|
+
plt = gui.add_dock().add_widget('BECFigure').plot(x_name='samx', y_name='bpm4i', dap="GaussianModel")
|
83
|
+
|
84
|
+
# Add a second curve to the same plot without DAP
|
85
|
+
plt.plot(x_name='samx', y_name='bpm3a')
|
86
|
+
|
87
|
+
# Add DAP to the second curve
|
88
|
+
plt.add_dap(x_name='samx', y_name='bpm3a', dap="GaussianModel")
|
89
|
+
|
90
|
+
```
|
91
|
+
|
92
|
+
To get the parameters of the fit, you need to retrieve the curve objects and call the `dap_params` property.
|
93
|
+
|
94
|
+
```python
|
95
|
+
# Get the curve object by name from the legend
|
96
|
+
dap_bpm4i = plt.get_curve("bpm4i-bpm4i-GaussianModel")
|
97
|
+
dap_bpm3a = plt.get_curve("bpm3a-bpm3a-GaussianModel")
|
98
|
+
|
99
|
+
# Get the parameters of the fit
|
100
|
+
print(dap_bpm4i.dap_params)
|
101
|
+
# Output
|
102
|
+
{'amplitude': 197.399639720862,
|
103
|
+
'center': 5.013486095404885,
|
104
|
+
'sigma': 0.9820868875739888}
|
105
|
+
|
106
|
+
print(dap_bpm3a.dap_params)
|
107
|
+
# Output
|
108
|
+
{'amplitude': 698.3072786185278,
|
109
|
+
'center': 0.9702840866173836,
|
110
|
+
'sigma': 1.97139754785518}
|
111
|
+
```
|
112
|
+
|
113
|
+

|
114
|
+
|
115
|
+
## Example 5 - 2D Waveform Scatter Plot
|
116
|
+
|
117
|
+
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.
|
118
|
+
|
119
|
+
```python
|
120
|
+
# adds a new dock, a new BECFigure and a BECWaveForm to the dock
|
121
|
+
plt = gui.add_dock().add_widget('BECFigure').add_plot(x_name='samx', y_name='samy', z_name='bpm4i')
|
122
|
+
```
|
123
|
+
|
124
|
+

|
125
|
+
|
126
|
+
````
|
127
|
+
|
128
|
+
````{tab} API
|
129
|
+
```{eval-rst}
|
130
|
+
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.BECWaveform.rst
|
131
|
+
```
|
132
|
+
````
|