bec-widgets 0.99.1__py3-none-any.whl → 0.99.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- .gitlab-ci.yml +0 -1
- CHANGELOG.md +76 -70
- PKG-INFO +2 -2
- bec_widgets/cli/client.py +3 -3
- bec_widgets/qt_utils/toolbar.py +11 -5
- bec_widgets/utils/bec_widget.py +11 -2
- bec_widgets/utils/colors.py +18 -2
- bec_widgets/utils/plugin_templates/plugin.template +2 -2
- bec_widgets/widgets/bec_queue/bec_queue.py +2 -0
- bec_widgets/widgets/bec_queue/bec_queue_plugin.py +1 -1
- bec_widgets/widgets/bec_status_box/bec_status_box.py +2 -0
- bec_widgets/widgets/bec_status_box/bec_status_box_plugin.py +1 -1
- bec_widgets/widgets/color_button/color_button.py +2 -0
- bec_widgets/widgets/color_button/color_button_plugin.py +1 -1
- bec_widgets/widgets/colormap_selector/colormap_selector.py +1 -0
- bec_widgets/widgets/colormap_selector/colormap_selector_plugin.py +1 -1
- bec_widgets/widgets/dark_mode_button/dark_mode_button.py +12 -3
- bec_widgets/widgets/dark_mode_button/dark_mode_button_plugin.py +1 -1
- bec_widgets/widgets/device_browser/device_browser.py +2 -0
- bec_widgets/widgets/device_browser/device_browser_plugin.py +1 -1
- bec_widgets/widgets/device_combobox/device_combo_box_plugin.py +1 -1
- bec_widgets/widgets/device_combobox/device_combobox.py +2 -0
- bec_widgets/widgets/device_line_edit/device_line_edit.py +2 -0
- bec_widgets/widgets/device_line_edit/device_line_edit_plugin.py +1 -1
- bec_widgets/widgets/dock/dock.py +1 -0
- bec_widgets/widgets/dock/dock_area.py +30 -10
- bec_widgets/widgets/dock/dock_area_plugin.py +1 -1
- bec_widgets/widgets/figure/figure.py +1 -1
- bec_widgets/widgets/figure/plots/waveform/waveform.py +12 -7
- bec_widgets/widgets/figure/plots/waveform/waveform_curve.py +3 -3
- bec_widgets/widgets/image/bec_image_widget_plugin.py +1 -1
- bec_widgets/widgets/image/image_widget.py +1 -0
- bec_widgets/widgets/motor_map/bec_motor_map_widget_plugin.py +1 -1
- bec_widgets/widgets/motor_map/motor_map_widget.py +1 -0
- bec_widgets/widgets/position_indicator/position_indicator.py +2 -0
- bec_widgets/widgets/position_indicator/position_indicator_plugin.py +1 -1
- bec_widgets/widgets/positioner_box/positioner_box.py +1 -0
- bec_widgets/widgets/positioner_box/positioner_box_plugin.py +1 -1
- bec_widgets/widgets/positioner_box/positioner_control_line.py +2 -0
- bec_widgets/widgets/positioner_box/positioner_control_line_plugin.py +1 -1
- bec_widgets/widgets/ring_progress_bar/ring_progress_bar.py +1 -0
- bec_widgets/widgets/ring_progress_bar/ring_progress_bar_plugin.py +1 -1
- bec_widgets/widgets/scan_control/scan_control.py +2 -0
- bec_widgets/widgets/scan_control/scan_control_plugin.py +1 -4
- bec_widgets/widgets/spinner/spinner.py +2 -0
- bec_widgets/widgets/spinner/spinner_widget_plugin.py +1 -1
- bec_widgets/widgets/stop_button/stop_button.py +2 -0
- bec_widgets/widgets/stop_button/stop_button_plugin.py +1 -1
- bec_widgets/widgets/text_box/text_box.py +1 -0
- bec_widgets/widgets/text_box/text_box_plugin.py +1 -1
- bec_widgets/widgets/toggle/toggle.py +1 -0
- bec_widgets/widgets/toggle/toggle_switch_plugin.py +1 -1
- bec_widgets/widgets/vscode/vs_code_editor_plugin.py +1 -1
- bec_widgets/widgets/vscode/vscode.py +1 -0
- bec_widgets/widgets/waveform/bec_waveform_widget_plugin.py +1 -1
- bec_widgets/widgets/waveform/waveform_popups/curve_dialog/curve_dialog.py +14 -13
- bec_widgets/widgets/waveform/waveform_widget.py +3 -2
- bec_widgets/widgets/website/website.py +42 -10
- bec_widgets/widgets/website/website_widget_plugin.py +1 -1
- {bec_widgets-0.99.1.dist-info → bec_widgets-0.99.9.dist-info}/METADATA +2 -2
- bec_widgets-0.99.9.dist-info/RECORD +231 -0
- pyproject.toml +7 -2
- bec_widgets/assets/toolbar_icons/add.svg +0 -3
- bec_widgets/assets/toolbar_icons/attach_all.svg +0 -3
- bec_widgets/assets/toolbar_icons/auto_range.svg +0 -3
- bec_widgets/assets/toolbar_icons/compare.svg +0 -3
- bec_widgets/assets/toolbar_icons/connection.svg +0 -4
- bec_widgets/assets/toolbar_icons/device_line_edit.svg +0 -3
- bec_widgets/assets/toolbar_icons/drag_pan_mode.svg +0 -3
- bec_widgets/assets/toolbar_icons/export.svg +0 -9
- bec_widgets/assets/toolbar_icons/fft.svg +0 -11
- bec_widgets/assets/toolbar_icons/fitting_parameters.svg +0 -3
- bec_widgets/assets/toolbar_icons/history.svg +0 -4
- bec_widgets/assets/toolbar_icons/image.svg +0 -3
- bec_widgets/assets/toolbar_icons/image_autorange.svg +0 -3
- bec_widgets/assets/toolbar_icons/import.svg +0 -9
- bec_widgets/assets/toolbar_icons/line_axis.svg +0 -3
- bec_widgets/assets/toolbar_icons/line_curve.svg +0 -3
- bec_widgets/assets/toolbar_icons/lock_aspect_ratio.svg +0 -3
- bec_widgets/assets/toolbar_icons/log_scale.png +0 -0
- bec_widgets/assets/toolbar_icons/motor_map.svg +0 -3
- bec_widgets/assets/toolbar_icons/photo_library.svg +0 -3
- bec_widgets/assets/toolbar_icons/positioner_box.svg +0 -3
- bec_widgets/assets/toolbar_icons/progress.svg +0 -3
- bec_widgets/assets/toolbar_icons/queue.svg +0 -3
- bec_widgets/assets/toolbar_icons/rectangle_mode.svg +0 -3
- bec_widgets/assets/toolbar_icons/remove.svg +0 -5
- bec_widgets/assets/toolbar_icons/reset_settings.svg +0 -3
- bec_widgets/assets/toolbar_icons/restore_state.svg +0 -3
- bec_widgets/assets/toolbar_icons/ring_progress.svg +0 -3
- bec_widgets/assets/toolbar_icons/rotate_left.svg +0 -3
- bec_widgets/assets/toolbar_icons/rotate_right.svg +0 -3
- bec_widgets/assets/toolbar_icons/save.svg +0 -3
- bec_widgets/assets/toolbar_icons/save_state.svg +0 -3
- bec_widgets/assets/toolbar_icons/scan_control.svg +0 -3
- bec_widgets/assets/toolbar_icons/settings.svg +0 -4
- bec_widgets/assets/toolbar_icons/status.svg +0 -3
- bec_widgets/assets/toolbar_icons/terminal.svg +0 -3
- bec_widgets/assets/toolbar_icons/transform.svg +0 -3
- bec_widgets/assets/toolbar_icons/waveform.svg +0 -3
- bec_widgets-0.99.1.dist-info/RECORD +0 -415
- docs/Makefile +0 -20
- docs/_static/custom.css +0 -170
- docs/_templates/custom-class-template.rst +0 -34
- docs/_templates/custom-module-template.rst +0 -66
- docs/api_reference/api_reference.md +0 -12
- docs/assets/apps_48dp.svg +0 -1
- docs/assets/display_settings_48dp.svg +0 -1
- docs/assets/index_api.svg +0 -97
- docs/assets/index_contribute.svg +0 -76
- docs/assets/index_getting_started.svg +0 -66
- docs/assets/index_user_guide.svg +0 -67
- docs/assets/rocket_launch_48dp.svg +0 -1
- 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 +0 -82
- docs/developer/developer.md +0 -52
- docs/developer/introduction/concepts.md +0 -14
- docs/developer/introduction/contributing.md +0 -28
- docs/developer/introduction/introduction.md +0 -16
- docs/developer/introduction/useful_links.md +0 -23
- docs/developer/widget_development/bec_dispatcher.md +0 -143
- docs/developer/widget_development/widget_development.md +0 -13
- docs/index.md +0 -74
- docs/introduction/introduction.md +0 -18
- docs/make.bat +0 -35
- docs/requirements.txt +0 -12
- docs/user/api_reference/api_reference.md +0 -11
- docs/user/applications/applications.md +0 -10
- docs/user/customisation.md +0 -123
- docs/user/getting_started/BECDockArea.png +0 -0
- docs/user/getting_started/auto_updates.md +0 -82
- docs/user/getting_started/getting_started.md +0 -15
- docs/user/getting_started/gui_complex_gui.gif +0 -0
- docs/user/getting_started/installation.md +0 -33
- docs/user/getting_started/quick_start.md +0 -110
- docs/user/getting_started/video_tutorials.md +0 -17
- docs/user/user.md +0 -71
- docs/user/widgets/bec_figure/BECFigure.png +0 -0
- docs/user/widgets/bec_figure/bec_figure.md +0 -105
- docs/user/widgets/bec_status_box/bec_status_box.gif +0 -0
- docs/user/widgets/bec_status_box/bec_status_box.md +0 -38
- docs/user/widgets/buttons/buttons.md +0 -63
- docs/user/widgets/buttons/dark_mode_disabled.png +0 -0
- docs/user/widgets/buttons/dark_mode_enabled.png +0 -0
- docs/user/widgets/device_browser/device_browser.md +0 -36
- docs/user/widgets/device_browser/device_browser.png +0 -0
- docs/user/widgets/device_input/device_input.md +0 -100
- docs/user/widgets/dock_area/BECDockArea.png +0 -0
- docs/user/widgets/dock_area/bec_dock_area.md +0 -107
- docs/user/widgets/image/image_plot.gif +0 -0
- docs/user/widgets/image/image_widget.md +0 -84
- docs/user/widgets/motor_map/motor.gif +0 -0
- docs/user/widgets/motor_map/motor_map.md +0 -80
- docs/user/widgets/position_indicator/position_indicator.md +0 -76
- docs/user/widgets/positioner_box/positioner_box.md +0 -63
- docs/user/widgets/progress_bar/progress_bar.gif +0 -0
- docs/user/widgets/progress_bar/ring_progress_bar.md +0 -103
- docs/user/widgets/queue/queue.md +0 -41
- docs/user/widgets/scan_control/hide_scan_control.png +0 -0
- docs/user/widgets/scan_control/scan_control.gif +0 -0
- docs/user/widgets/scan_control/scan_control.md +0 -54
- docs/user/widgets/spinner/spinner.md +0 -75
- docs/user/widgets/text_box/text_box.md +0 -74
- docs/user/widgets/toggle/toggle.md +0 -66
- docs/user/widgets/waveform/bec_figure_dap.gif +0 -0
- docs/user/widgets/waveform/scatter_2D.gif +0 -0
- docs/user/widgets/waveform/w1D.gif +0 -0
- docs/user/widgets/waveform/waveform_widget.md +0 -132
- docs/user/widgets/website/website.md +0 -69
- docs/user/widgets/widgets.md +0 -220
- tests/__init__.py +0 -0
- tests/end-2-end/__init__.py +0 -0
- tests/end-2-end/conftest.py +0 -53
- tests/end-2-end/test_bec_dock_rpc_e2e.py +0 -298
- tests/end-2-end/test_bec_figure_rpc_e2e.py +0 -212
- tests/end-2-end/test_rpc_register_e2e.py +0 -40
- tests/end-2-end/test_scan_control_e2e.py +0 -71
- tests/references/SpinnerWidget/SpinnerWidget_darwin.png +0 -0
- tests/references/SpinnerWidget/SpinnerWidget_linux.png +0 -0
- tests/references/SpinnerWidget/SpinnerWidget_started_darwin.png +0 -0
- tests/references/SpinnerWidget/SpinnerWidget_started_linux.png +0 -0
- tests/unit_tests/__init__.py +0 -0
- tests/unit_tests/client_mocks.py +0 -189
- tests/unit_tests/conftest.py +0 -64
- tests/unit_tests/test_bec_connector.py +0 -80
- tests/unit_tests/test_bec_dispatcher.py +0 -119
- tests/unit_tests/test_bec_dock.py +0 -155
- tests/unit_tests/test_bec_figure.py +0 -270
- tests/unit_tests/test_bec_image.py +0 -63
- tests/unit_tests/test_bec_image_widget.py +0 -217
- tests/unit_tests/test_bec_motor_map.py +0 -282
- tests/unit_tests/test_bec_queue.py +0 -111
- tests/unit_tests/test_bec_status_box.py +0 -123
- tests/unit_tests/test_client_utils.py +0 -76
- tests/unit_tests/test_color_map_selector.py +0 -42
- tests/unit_tests/test_color_validation.py +0 -75
- tests/unit_tests/test_configs/config_device.yaml +0 -33
- tests/unit_tests/test_configs/config_device_no_entry.yaml +0 -27
- tests/unit_tests/test_configs/config_scan.yaml +0 -82
- tests/unit_tests/test_crosshair.py +0 -143
- tests/unit_tests/test_dark_mode_button.py +0 -70
- tests/unit_tests/test_device_browser.py +0 -83
- tests/unit_tests/test_device_input_base.py +0 -76
- tests/unit_tests/test_device_input_widgets.py +0 -178
- tests/unit_tests/test_error_utils.py +0 -63
- tests/unit_tests/test_generate_cli_client.py +0 -123
- tests/unit_tests/test_generate_plugin.py +0 -155
- tests/unit_tests/test_motor_map_widget.py +0 -194
- tests/unit_tests/test_msgs/__init__.py +0 -0
- tests/unit_tests/test_msgs/available_scans_message.py +0 -989
- tests/unit_tests/test_plot_base.py +0 -95
- tests/unit_tests/test_plugin_utils.py +0 -13
- tests/unit_tests/test_positioner_box.py +0 -130
- tests/unit_tests/test_ring_progress_bar.py +0 -337
- tests/unit_tests/test_rpc_register.py +0 -52
- tests/unit_tests/test_rpc_server.py +0 -42
- tests/unit_tests/test_rpc_widget_handler.py +0 -7
- tests/unit_tests/test_scan_control.py +0 -324
- tests/unit_tests/test_scan_control_group_box.py +0 -160
- tests/unit_tests/test_setting_dialog.py +0 -96
- tests/unit_tests/test_spinner.py +0 -31
- tests/unit_tests/test_stop_button.py +0 -27
- tests/unit_tests/test_text_box_widget.py +0 -54
- tests/unit_tests/test_toggle.py +0 -38
- tests/unit_tests/test_vscode_widget.py +0 -75
- tests/unit_tests/test_waveform1d.py +0 -712
- tests/unit_tests/test_waveform_widget.py +0 -462
- tests/unit_tests/test_website_widget.py +0 -25
- tests/unit_tests/test_widget_io.py +0 -90
- tests/unit_tests/test_yaml_dialog.py +0 -163
- {bec_widgets-0.99.1.dist-info → bec_widgets-0.99.9.dist-info}/WHEEL +0 -0
- {bec_widgets-0.99.1.dist-info → bec_widgets-0.99.9.dist-info}/entry_points.txt +0 -0
- {bec_widgets-0.99.1.dist-info → bec_widgets-0.99.9.dist-info}/licenses/LICENSE +0 -0
@@ -1,63 +0,0 @@
|
|
1
|
-
(user.widgets.buttons)=
|
2
|
-
|
3
|
-
# Service Buttons
|
4
|
-
|
5
|
-
````{tab} Overview
|
6
|
-
|
7
|
-
This section consolidates various custom buttons used within the BEC GUIs, providing essential controls for managing operations and processes. These buttons are designed for easy integration into different layouts within the BEC environment, allowing users to embed functional controls into their applications seamlessly.
|
8
|
-
|
9
|
-
## Stop Button
|
10
|
-
|
11
|
-
The `Stop Button` is a specialized control that provides an immediate interface to halt ongoing operations in the BEC Client. It is essential for scenarios where operations need to be terminated quickly, such as in the case of an error or when an operation needs to be interrupted by the user.
|
12
|
-
|
13
|
-
**Key Features:**
|
14
|
-
- **Immediate Termination**: Instantly halts the execution of the current script or process.
|
15
|
-
- **Queue Management**: Clears any pending operations in the scan queue, ensuring the system is reset and ready for new tasks.
|
16
|
-
|
17
|
-
## Dark Mode Button
|
18
|
-
|
19
|
-
The `Dark Mode Button` is a toggle control that allows users to switch between light and dark themes in the BEC GUI. It provides a convenient way to adjust the interface's appearance based on user preferences or environmental conditions.
|
20
|
-
|
21
|
-
```{figure} ./dark_mode_enabled.png
|
22
|
-
```
|
23
|
-
```{figure} ./dark_mode_disabled.png
|
24
|
-
```
|
25
|
-
|
26
|
-
**Key Features:**
|
27
|
-
- **Theme Switching**: Enables users to switch between light and dark themes with a single click.
|
28
|
-
- **Configurable from BECDesigner**: The defaults for the dark mode can be set in the BECDesigner, allowing users to customize the startup appearance of the GUI.
|
29
|
-
````
|
30
|
-
|
31
|
-
````{tab} Examples
|
32
|
-
|
33
|
-
Integrating the `StopButton` into a BEC GUI layout is straightforward. The following example demonstrates how to embed a `StopButton` within a custom GUI layout using `QtWidgets`.
|
34
|
-
|
35
|
-
## Example 1 - Embedding a Stop Button in a Custom GUI Layout
|
36
|
-
|
37
|
-
This example shows how to create a simple GUI layout with a `StopButton` integrated, allowing the user to halt processes directly from the interface.
|
38
|
-
|
39
|
-
```python
|
40
|
-
from qtpy.QtWidgets import QWidget, QVBoxLayout
|
41
|
-
from bec_widgets.widgets.buttons import StopButton
|
42
|
-
|
43
|
-
class MyGui(QWidget):
|
44
|
-
def __init__(self):
|
45
|
-
super().__init__()
|
46
|
-
self.setLayout(QVBoxLayout(self)) # Initialize the layout for the widget
|
47
|
-
|
48
|
-
# Create and add the StopButton to the layout
|
49
|
-
self.stop_button = StopButton()
|
50
|
-
self.layout().addWidget(self.stop_button)
|
51
|
-
|
52
|
-
# Example of how this custom GUI might be used:
|
53
|
-
my_gui = MyGui()
|
54
|
-
my_gui.show()
|
55
|
-
```
|
56
|
-
````
|
57
|
-
|
58
|
-
````{tab} API
|
59
|
-
```{eval-rst}
|
60
|
-
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.StopButton.rst
|
61
|
-
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.DarkModeButton.rst
|
62
|
-
```
|
63
|
-
````
|
Binary file
|
Binary file
|
@@ -1,36 +0,0 @@
|
|
1
|
-
(user.widgets.device_browser)=
|
2
|
-
|
3
|
-
# Device Browser
|
4
|
-
|
5
|
-
````{tab} Overview
|
6
|
-
|
7
|
-
The `Device Browser` widget provides a user-friendly interface for browsing through all available devices in the current BEC session. As it supports drag functionality, users can easily drag and drop device into other widgets or applications.
|
8
|
-
|
9
|
-
```{note}
|
10
|
-
The `Device Browser` widget is currently under development. Other widgets may not support drag and drop functionality yet.
|
11
|
-
```
|
12
|
-
|
13
|
-
## Key Features:
|
14
|
-
- **Device Search**: Allows users to search for devices using regular expressions.
|
15
|
-
- **Drag and Drop**: Supports drag and drop functionality for easy transfer of devices to other widgets or applications.
|
16
|
-
|
17
|
-
```{figure} ./device_browser.png
|
18
|
-
```
|
19
|
-
````
|
20
|
-
|
21
|
-
````{tab} Examples
|
22
|
-
|
23
|
-
In this example, we demonstrate how to add a `DeviceBrowser` widget to a `BECDockArea` to visualize the progress of a task.
|
24
|
-
|
25
|
-
```python
|
26
|
-
# Add a new dock with a DeviceBrowser widget
|
27
|
-
browser = gui.add_dock().add_widget("DeviceBrowser")
|
28
|
-
```
|
29
|
-
|
30
|
-
````
|
31
|
-
|
32
|
-
````{tab} API
|
33
|
-
```{eval-rst}
|
34
|
-
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.DeviceBrowser.rst
|
35
|
-
```
|
36
|
-
````
|
Binary file
|
@@ -1,100 +0,0 @@
|
|
1
|
-
(user.widgets.device_input)=
|
2
|
-
|
3
|
-
# Device Input Widgets
|
4
|
-
|
5
|
-
````{tab} Overview
|
6
|
-
|
7
|
-
The `Device Input Widgets` consist of two primary widgets: `DeviceLineEdit` and `DeviceComboBox`. Both widgets are designed to facilitate the selection of devices within the BEC environment, allowing users to filter, search, and select devices dynamically. These widgets are highly customizable and can be integrated into a GUI either through direct code instantiation or by using `QtDesigner`.
|
8
|
-
|
9
|
-
## DeviceLineEdit
|
10
|
-
The `DeviceLineEdit` widget provides a line edit interface with autocomplete functionality for device names, making it easier for users to quickly search and select devices.
|
11
|
-
|
12
|
-
## DeviceComboBox
|
13
|
-
The `DeviceComboBox` widget offers a dropdown interface for device selection, providing a more visual way to browse through available devices.
|
14
|
-
|
15
|
-
## Key Features:
|
16
|
-
- **Device Filtering**: Both widgets allow users to filter devices by their class names, ensuring that only relevant devices are shown.
|
17
|
-
- **Default Device Setting**: Users can set a default device to be pre-selected when the widget is initialized.
|
18
|
-
- **Real-Time Autocomplete (LineEdit)**: The `DeviceLineEdit` widget supports real-time autocomplete, helping users find devices faster.
|
19
|
-
- **Dropdown Selection (ComboBox)**: The `DeviceComboBox` widget displays devices in a dropdown list, making selection straightforward.
|
20
|
-
- **QtDesigner Integration**: Both widgets can be added as custom widgets in `QtDesigner` or instantiated directly in code.
|
21
|
-
|
22
|
-
````
|
23
|
-
|
24
|
-
````{tab} Examples
|
25
|
-
|
26
|
-
Both `DeviceLineEdit` and `DeviceComboBox` can be integrated within a GUI application through direct code instantiation or by using `QtDesigner`. Below are examples demonstrating how to create and use these widgets.
|
27
|
-
|
28
|
-
|
29
|
-
## Example 1 - Creating a DeviceLineEdit in Code
|
30
|
-
|
31
|
-
In this example, we demonstrate how to create a `DeviceLineEdit` widget in code and customize its behavior.
|
32
|
-
|
33
|
-
```python
|
34
|
-
from qtpy.QtWidgets import QApplication, QVBoxLayout, QWidget
|
35
|
-
from bec_widgets.widgets.device_line_edit import DeviceLineEdit
|
36
|
-
|
37
|
-
class MyGui(QWidget):
|
38
|
-
def __init__(self):
|
39
|
-
super().__init__()
|
40
|
-
self.setLayout(QVBoxLayout(self)) # Initialize the layout for the widget
|
41
|
-
|
42
|
-
# Create and add the DeviceLineEdit to the layout
|
43
|
-
self.device_line_edit = DeviceLineEdit(device_filter="Motor")
|
44
|
-
self.layout().addWidget(self.device_line_edit)
|
45
|
-
|
46
|
-
# Example of how this custom GUI might be used:
|
47
|
-
app = QApplication([])
|
48
|
-
my_gui = MyGui()
|
49
|
-
my_gui.show()
|
50
|
-
app.exec_()
|
51
|
-
```
|
52
|
-
|
53
|
-
## Example 2 - Creating a DeviceComboBox in Code
|
54
|
-
|
55
|
-
Similarly, here is an example of creating a `DeviceComboBox` widget in code and customizing its behavior.
|
56
|
-
|
57
|
-
```python
|
58
|
-
from qtpy.QtWidgets import QApplication, QVBoxLayout, QWidget
|
59
|
-
from bec_widgets.widgets.device_combo_box import DeviceComboBox
|
60
|
-
|
61
|
-
class MyGui(QWidget):
|
62
|
-
def __init__(self):
|
63
|
-
super().__init__()
|
64
|
-
self.setLayout(QVBoxLayout(self)) # Initialize the layout for the widget
|
65
|
-
|
66
|
-
# Create and add the DeviceComboBox to the layout
|
67
|
-
self.device_combo_box = DeviceComboBox(device_filter="Motor")
|
68
|
-
self.layout().addWidget(self.device_combo_box)
|
69
|
-
|
70
|
-
# Example of how this custom GUI might be used:
|
71
|
-
app = QApplication([])
|
72
|
-
my_gui = MyGui()
|
73
|
-
my_gui.show()
|
74
|
-
app.exec_()
|
75
|
-
```
|
76
|
-
|
77
|
-
## Example 3 - Setting Default Device
|
78
|
-
|
79
|
-
Both `DeviceLineEdit` and `DeviceComboBox` allow you to set a default device that will be selected when the widget is initialized.
|
80
|
-
|
81
|
-
```python
|
82
|
-
# Set default device for DeviceLineEdit
|
83
|
-
self.device_line_edit.set_default_device("motor1")
|
84
|
-
|
85
|
-
# Set default device for DeviceComboBox
|
86
|
-
self.device_combo_box.set_default_device("motor2")
|
87
|
-
```
|
88
|
-
````
|
89
|
-
|
90
|
-
````{tab} API - ComboBox
|
91
|
-
```{eval-rst}
|
92
|
-
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.DeviceComboBox.rst
|
93
|
-
```
|
94
|
-
````
|
95
|
-
|
96
|
-
````{tab} API - LineEdit
|
97
|
-
```{eval-rst}
|
98
|
-
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.DeviceLineEdit.rst
|
99
|
-
```
|
100
|
-
````
|
Binary file
|
@@ -1,107 +0,0 @@
|
|
1
|
-
(user.widgets.bec_dock_area)=
|
2
|
-
|
3
|
-
# BECDockArea
|
4
|
-
|
5
|
-
```{tab} Overview
|
6
|
-
|
7
|
-
[`BECDockArea`](/api_reference/_autosummary/bec_widgets.cli.client.BECDockArea) is a powerful and flexible container designed to host various widgets and docks within a grid layout. It provides an environment for organizing and managing complex user interfaces, making it ideal for applications that require multiple tools and data visualizations to be displayed simultaneously. BECDockArea is particularly useful for embedding not only visualization tools but also other interactive components, allowing users to tailor their workspace to their specific needs.
|
8
|
-
|
9
|
-
- **Flexible Dock Management**: Easily add, remove, and rearrange docks within `BECDockArea`, providing a customized layout for different tasks.
|
10
|
-
- **State Persistence**: Save and restore the state of the dock area, enabling consistent user experiences across sessions.
|
11
|
-
- **Dock Customization**: Add docks with customizable positions, names, and behaviors, such as floating or closable docks.
|
12
|
-
- **Integration with Widgets**: Integrate various widgets like [`WaveformWidget`](user.widgets.waveform_widget), [`ImageWidget`](user.widgets.image_widget), and [`MotorMapWidget`](user.widgets.motor_map) into `BECDockArea`, either as standalone tools or as part of a more complex interface.
|
13
|
-
```
|
14
|
-
|
15
|
-

|
16
|
-
|
17
|
-
````{tab} Examples - CLI
|
18
|
-
In the following examples, we will use `BECIPythonClient` as the main object to interact with the `BECDockArea`. These tutorials focus on how to work with the `BECDockArea` framework, such as adding and removing docks, saving and restoring layouts, and managing the docked widgets. By default the `BECDockArea` is refered as `gui` in `BECIPythonClient`. For more detailed examples of each individual component, please refer to the example sections of each individual [`widget`](user.widgets).
|
19
|
-
|
20
|
-
## Example 1 - Adding Docks to BECDockArea
|
21
|
-
|
22
|
-
In this example, we will demonstrate how to add different docks to a single `BECDockArea` widget. New docks are always added to the bottom of the dock area by default; however, you can specify the position of the dock by using the `position` and `relative_to` arguments.
|
23
|
-
|
24
|
-
```python
|
25
|
-
# Add a new dock with a WaveformWidget to the BECDockArea
|
26
|
-
dock1 = gui.add_dock(name="Waveform Dock", widget="BECWaveformWidget")
|
27
|
-
|
28
|
-
# Add a second dock with a MotorMapWidget to the BECDockArea to the right of the first dock
|
29
|
-
dock2 = gui.add_dock(name="Motor Map Dock", widget="BECMotorMapWidget",relative_to="Waveform Dock", position="right")
|
30
|
-
|
31
|
-
# Add a third dock with an ImageWidget to the BECDockArea, placing it on bottom of the dock area
|
32
|
-
dock3 = gui.add_dock(name="Image Dock", widget="BECImageWidget")
|
33
|
-
```
|
34
|
-
|
35
|
-
```{hint}
|
36
|
-
You can move docks around by dragging them with the mouse using the dock's title bar. The dock will snap to the grid layout of the dock area.
|
37
|
-
```
|
38
|
-
|
39
|
-
## Example 2 - Access of Docks in BECDockArea
|
40
|
-
|
41
|
-
Docks can be accessed by their name or by the dock object. The dock object can be used to modify the dock properties or to add widgets to the dock.
|
42
|
-
|
43
|
-
```python
|
44
|
-
# All docks can be accessed by their name from the panels dictionary
|
45
|
-
gui.panels
|
46
|
-
|
47
|
-
# Output
|
48
|
-
{'Waveform Dock': <BECDock object at 0x168b983d0>,
|
49
|
-
'Motor Map Dock': <BECDock object at 0x13a969250>,
|
50
|
-
'Image Dock': <BECDock object at 0x13f267950>}
|
51
|
-
|
52
|
-
# Access the dock by its name
|
53
|
-
dock1 = gui.panels["Waveform Dock"]
|
54
|
-
|
55
|
-
# Access the widget object of the dock
|
56
|
-
waveform_widget = dock1.widget_list[0]
|
57
|
-
```
|
58
|
-
|
59
|
-
## Example 3 - Detaching and Attaching Docks in BECDockArea
|
60
|
-
|
61
|
-
Docks in `BECDockArea` can be detached (floated) or reattached to the main dock area. This is useful when you want to temporarily undock a widget for better visibility or organization.
|
62
|
-
|
63
|
-
```python
|
64
|
-
# Detach the dock named "Waveform Dock"
|
65
|
-
gui.detach_dock(dock_name="Waveform Dock")
|
66
|
-
|
67
|
-
# Docks can be also detached by the dock object
|
68
|
-
dock2.detach()
|
69
|
-
dock3.detach()
|
70
|
-
|
71
|
-
# Docks can be individually reattached to the main dock area
|
72
|
-
dock2.attach()
|
73
|
-
|
74
|
-
# Reattach all floating docks to the main dock area
|
75
|
-
gui.attach_all()
|
76
|
-
```
|
77
|
-
|
78
|
-
```{note}
|
79
|
-
Floating docks are always returned to the original dock area if they are closed manually. Docks can also be detached by double-clicking on the dock title.
|
80
|
-
```
|
81
|
-
|
82
|
-
## Example 4 - Removing Docks from BECDockArea
|
83
|
-
|
84
|
-
Docks can be removed from the dock area by their name or by the dock object. The dock object can be used to remove the dock from the dock area.
|
85
|
-
|
86
|
-
```python
|
87
|
-
# Removing docks by their name
|
88
|
-
gui.remove_dock(dock_name="Waveform Dock")
|
89
|
-
|
90
|
-
# Removing docks by the dock object
|
91
|
-
dock2.remove()
|
92
|
-
|
93
|
-
# Removing all docks from the dock area
|
94
|
-
gui.clear_all()
|
95
|
-
```
|
96
|
-
|
97
|
-
```{warning}
|
98
|
-
When removing a dock, all widgets within the dock will be removed as well. This action cannot be undone, and all references to the dock and its widgets will be lost.
|
99
|
-
```
|
100
|
-
````
|
101
|
-
|
102
|
-
````{tab} API
|
103
|
-
```{eval-rst}
|
104
|
-
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.BECDockArea.rst
|
105
|
-
```
|
106
|
-
````
|
107
|
-
|
Binary file
|
@@ -1,84 +0,0 @@
|
|
1
|
-
(user.widgets.image_widget)=
|
2
|
-
|
3
|
-
# Image Widget
|
4
|
-
|
5
|
-
````{tab} Overview
|
6
|
-
|
7
|
-
The Image Widget is a versatile tool designed for visualizing 2D image data, such as camera images, in real-time. Directly integrated with the `BEC` framework, it can display live data streams from connected cameras or other image sources within the current `BEC` session. The widget provides advanced customization options for color maps and scale bars, allowing users to tailor the visualization to their specific needs.
|
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
|
-
- **Live Data Visualization**: Real-time plotting of 2D image data from cameras or other image sources, provided that a data stream is available in the BEC session.
|
12
|
-
- **Customizable Color Maps and Scale Bars**: Users can customize the appearance of images with various color maps and adjust scale bars to better interpret the visualized data.
|
13
|
-
- **Real-time Image Processing**: Apply real-time image processing techniques directly within the widget to enhance the quality or analyze specific aspects of the images such as rotation, log scaling, and FFT.
|
14
|
-
- **Data Export**: Export visualized image data to various formats such as PNG, TIFF, or H5 for further analysis or reporting.
|
15
|
-
- **Interactive Controls**: Offers interactive controls for zooming, panning, and adjusting the visual properties of the images on the fly.
|
16
|
-
|
17
|
-

|
18
|
-
````
|
19
|
-
|
20
|
-
````{tab} Examples - CLI
|
21
|
-
|
22
|
-
`ImageWidget` can be embedded in both [`BECFigure`](user.widgets.bec_figure) and [`BECDockArea`](user.widgets.bec_dock_area), 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 Image Widget to BECFigure
|
25
|
-
|
26
|
-
In this example, we demonstrate how to add an `ImageWidget` to a [`BECFigure`](user.widgets.bec_figure) to visualize live data from a connected camera.
|
27
|
-
|
28
|
-
```python
|
29
|
-
# Add a new dock with BECFigure widget
|
30
|
-
fig = gui.add_dock().add_widget('BECFigure')
|
31
|
-
|
32
|
-
# Add an ImageWidget to the BECFigure
|
33
|
-
img_widget = fig.image(source='eiger')
|
34
|
-
img_widget.set_title("Camera Image Eiger")
|
35
|
-
```
|
36
|
-
|
37
|
-
## Example 2 - Adding Image Widget as a Dock in BECDockArea
|
38
|
-
|
39
|
-
Adding `ImageWidget` into a [`BECDockArea`](user.widgets.bec_dock_area) is similar to adding any other widget. The widget has the same API as the one in [`BECFigure`](user.widgets.bec_figure); however, as an independent widget outside [`BECFigure`](user.widgets.bec_figure), it has its own toolbar, allowing users to configure the widget without needing CLI commands.
|
40
|
-
|
41
|
-
```python
|
42
|
-
# Add an ImageWidget to the BECDockArea
|
43
|
-
img_widget = gui.add_dock().add_widget('BECImageWidget')
|
44
|
-
|
45
|
-
# Visualize live data from a camera with range from 0 to 100
|
46
|
-
img_widget.image(source='eiger')
|
47
|
-
img_widget.set_vrange(vmin=0, vmax=100)
|
48
|
-
```
|
49
|
-
|
50
|
-
## Example 3 - Customizing Image Display
|
51
|
-
|
52
|
-
This example demonstrates how to customize the color map and scale bar for an image being visualized in an `ImageWidget`.
|
53
|
-
|
54
|
-
```python
|
55
|
-
# Set the color map and adjust the scale bar range
|
56
|
-
img_widget.set_colormap("viridis")
|
57
|
-
img_widget.set_vrange(vmin=10, vmax=200)
|
58
|
-
```
|
59
|
-
|
60
|
-
## Example 4 - Real-time Image Processing
|
61
|
-
|
62
|
-
The `ImageWidget` provides real-time image processing capabilities, such as rotating, scaling, and applying FFT to the displayed images. The following example demonstrates how to rotate an image by 90 degrees, transpose it, and apply FFT.
|
63
|
-
|
64
|
-
```python
|
65
|
-
# Rotate the image by 90 degrees
|
66
|
-
img_widget.set_rotation(deg_90=1)
|
67
|
-
|
68
|
-
# Transpose the image
|
69
|
-
img_widget.set_transpose(enable=True)
|
70
|
-
|
71
|
-
# Apply FFT to the image
|
72
|
-
img_widget.set_fft(enable=True)
|
73
|
-
|
74
|
-
# Set the logarithmic scale for the image display
|
75
|
-
img_widget.set_log(enable=True)
|
76
|
-
```
|
77
|
-
|
78
|
-
````
|
79
|
-
|
80
|
-
````{tab} API
|
81
|
-
```{eval-rst}
|
82
|
-
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.BECImageWidget.rst
|
83
|
-
```
|
84
|
-
````
|
Binary file
|
@@ -1,80 +0,0 @@
|
|
1
|
-
(user.widgets.motor_map)=
|
2
|
-
|
3
|
-
# Motor Map Widget
|
4
|
-
|
5
|
-
````{tab} Overview
|
6
|
-
|
7
|
-
The Motor Map Widget is a specialized tool for tracking and visualizing the positions of motors in real-time. This widget is crucial for applications requiring precise alignment and movement tracking during scans. It provides an intuitive way to monitor motor trajectories, ensuring accurate positioning throughout the scanning process.
|
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
|
-
- **Real-time Motor Position Visualization**: Tracks motor positions in real-time and visually represents motor trajectories.
|
12
|
-
- **Customizable Visual Elements**: The appearance of all widget components is fully customizable, including scatter size and background values.
|
13
|
-
- **Interactive Controls**: Interactive controls for zooming, panning, and adjusting the visual properties of motor trajectories on the fly.
|
14
|
-
|
15
|
-

|
16
|
-
````
|
17
|
-
|
18
|
-
````{tab} Examples CLI
|
19
|
-
`MotorMapWidget` can be embedded in both [`BECFigure`](user.widgets.bec_figure) and [`BECDockArea`](user.widgets.bec_dock_area), or used as an individual component in your application through `BECDesigner`. However, the command-line API is the same for all cases.
|
20
|
-
|
21
|
-
## Example 1 - Adding Motor Map Widget to BECFigure
|
22
|
-
|
23
|
-
In this example, we will demonstrate how to add two different `MotorMapWidgets` into a single [`BECFigure`](user.widgets.bec_figure) widget.
|
24
|
-
|
25
|
-
```python
|
26
|
-
# Add new dock with BECFigure widget
|
27
|
-
fig = gui.add_dock().add_widget('BECFigure')
|
28
|
-
|
29
|
-
# Add two WaveformWidgets to the BECFigure
|
30
|
-
mm1 = fig.motor_map(motor_x='samx', motor_y='samy')
|
31
|
-
mm2 = fig.motor_map(motor_x='aptrx', motor_y='aptry',new=True)
|
32
|
-
```
|
33
|
-
|
34
|
-
## Example 2 - Adding Motor Map Widget as a Dock in BECDockArea
|
35
|
-
|
36
|
-
Adding `MotorMapWidget` into a [`BECDockArea`](user.widgets.bec_dock_area) 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.
|
37
|
-
|
38
|
-
```python
|
39
|
-
# Add new MotorMaps to the BECDockArea
|
40
|
-
mm1 = gui.add_dock().add_widget('BECMotorMapWidget')
|
41
|
-
mm2 = gui.add_dock().add_widget('BECMotorMapWidget')
|
42
|
-
|
43
|
-
# Add signals to the MotorMaps
|
44
|
-
mm1.change_motors(motor_x='samx', motor_y='samy')
|
45
|
-
mm2.change_motors(motor_x='aptrx', motor_y='aptry')
|
46
|
-
```
|
47
|
-
|
48
|
-
## Example 3 - Customizing Motor Map Display
|
49
|
-
|
50
|
-
The `MotorMapWidget` allows customization of its visual elements to better suit the needs of your application. Below is an example of how to adjust the scatter size, set background values, and limit the number of points displayed from the position buffer.
|
51
|
-
|
52
|
-
```python
|
53
|
-
# Set scatter size
|
54
|
-
mm1.set_scatter_size(scatter_size=5)
|
55
|
-
|
56
|
-
# Set background value
|
57
|
-
mm1.set_background_value(background_value=0)
|
58
|
-
|
59
|
-
# Limit the number of points displayed and saved in the position buffer
|
60
|
-
mm1.set_max_points(max_points=500)
|
61
|
-
```
|
62
|
-
|
63
|
-
## Example 4 - Changing Motors and Resetting History
|
64
|
-
|
65
|
-
You can dynamically change the motors being tracked and reset the history of the motor trajectories during the session.
|
66
|
-
|
67
|
-
```python
|
68
|
-
# Reset the history of motor movements
|
69
|
-
mm1.reset_history()
|
70
|
-
|
71
|
-
# Change the motors being tracked
|
72
|
-
mm1.change_motors(motor_x='aptrx', motor_y='aptry')
|
73
|
-
```
|
74
|
-
````
|
75
|
-
|
76
|
-
````{tab} API
|
77
|
-
```{eval-rst}
|
78
|
-
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.BECMotorMap.rst
|
79
|
-
```
|
80
|
-
````
|
@@ -1,76 +0,0 @@
|
|
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
|
-
````
|
@@ -1,63 +0,0 @@
|
|
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
|
-
````
|
Binary file
|