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
docs/user/customisation.md
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
(user.customisation)=
|
2
|
-
# Customisation
|
3
|
-
|
4
|
-
## Leveraging BEC Widgets in custom GUI applications
|
5
|
-
|
6
|
-
BEC Widgets can be used to compose a complete Qt graphical application, along with
|
7
|
-
other QWidgets. The only requirement is to connect to BEC servers in order to get
|
8
|
-
data, or to interact with BEC components. This role is devoted to the BECDispatcher,
|
9
|
-
a singleton object which has to be instantiated **after the QApplication is created**.
|
10
|
-
|
11
|
-
A typical BEC Widgets custom application "main" entry point should follow the template
|
12
|
-
below:
|
13
|
-
|
14
|
-
```
|
15
|
-
import argparse
|
16
|
-
import sys
|
17
|
-
|
18
|
-
from bec_widgets.utils.bec_dispatcher import BECDispatcher
|
19
|
-
from qtpy.QtWidgets import QApplication
|
20
|
-
|
21
|
-
# optional command line arguments processing
|
22
|
-
parser = argparse.ArgumentParser(description="...")
|
23
|
-
parser.add_argument( ...)
|
24
|
-
...
|
25
|
-
args = parser.parse_args()
|
26
|
-
|
27
|
-
# creation of the Qt application
|
28
|
-
app = QApplication([])
|
29
|
-
|
30
|
-
# creation of BEC Dispatcher
|
31
|
-
# /!\ important: after the QApplication has been instantiated
|
32
|
-
bec_dispatcher = BECDispatcher()
|
33
|
-
client = bec_dispatcher.client
|
34
|
-
client.start()
|
35
|
-
|
36
|
-
# (optional) processing of command line args,
|
37
|
-
# creation of a main window depending on the command line arguments (or not)
|
38
|
-
if args.xxx == "...":
|
39
|
-
window = ...
|
40
|
-
|
41
|
-
# display of the main window and start of Qt event loop
|
42
|
-
window.show()
|
43
|
-
sys.exit(app.exec())
|
44
|
-
```
|
45
|
-
|
46
|
-
The main "window" object presents the layout of widgets to the user and allows
|
47
|
-
users to interact. BEC Widgets must be placed in the window:
|
48
|
-
|
49
|
-
```
|
50
|
-
from qtpy.QWidgets import QMainWindow
|
51
|
-
from bec_widgets.widgets.figure import BECFigure
|
52
|
-
|
53
|
-
window = QMainWindow()
|
54
|
-
bec_figure = BECFigure(gui_id="my_gui_app_id")
|
55
|
-
window.setCentralWidget(bec_figure)
|
56
|
-
|
57
|
-
# prepare to plot samx motor vs bpm4i value
|
58
|
-
bec_figure.plot(x_name="samx", y_name="bpm4i")
|
59
|
-
```
|
60
|
-
|
61
|
-
In the example just above, the resulting application will show a plot of samx
|
62
|
-
positions on the horizontal axis, and beam intensity on the vertical axis
|
63
|
-
(when the next scan will be started).
|
64
|
-
|
65
|
-
It is important to ensure proper cleanup of the resources is done when application
|
66
|
-
quits:
|
67
|
-
|
68
|
-
```
|
69
|
-
def final_cleanup():
|
70
|
-
bec_figure.clear_all()
|
71
|
-
bec_figure.client.shutdown()
|
72
|
-
|
73
|
-
window.aboutToQuit.connect(final_cleanup)
|
74
|
-
```
|
75
|
-
|
76
|
-
Final example:
|
77
|
-
|
78
|
-
```
|
79
|
-
import sys
|
80
|
-
from qtpy.QtWidgets import QMainWindow, QApplication
|
81
|
-
from bec_widgets.widgets.figure import BECFigure
|
82
|
-
from bec_widgets.utils.bec_dispatcher import BECDispatcher
|
83
|
-
|
84
|
-
# creation of the Qt application
|
85
|
-
app = QApplication([])
|
86
|
-
|
87
|
-
# creation of BEC Dispatcher
|
88
|
-
bec_dispatcher = BECDispatcher()
|
89
|
-
client = bec_dispatcher.client
|
90
|
-
client.start()
|
91
|
-
|
92
|
-
# creation of main window
|
93
|
-
window = QMainWindow()
|
94
|
-
|
95
|
-
# inserting BEC Widgets
|
96
|
-
bec_figure = BECFigure(parent=window, gui_id="my_gui_app_id")
|
97
|
-
window.setCentralWidget(bec_figure)
|
98
|
-
|
99
|
-
bec_figure.plot(x_name="samx", y_name="bpm4i")
|
100
|
-
|
101
|
-
# ensuring proper cleanup
|
102
|
-
def final_cleanup():
|
103
|
-
bec_figure.clear_all()
|
104
|
-
bec_figure.client.shutdown()
|
105
|
-
|
106
|
-
app.aboutToQuit.connect(final_cleanup)
|
107
|
-
|
108
|
-
# execution
|
109
|
-
window.show()
|
110
|
-
sys.exit(app.exec())
|
111
|
-
```
|
112
|
-
|
113
|
-
## Writing applications using Qt Designer
|
114
|
-
|
115
|
-
BEC Widgets are designed to be used with QtDesigner to quickly design GUI.
|
116
|
-
|
117
|
-
## Example of promoting widgets in Qt Designer
|
118
|
-
|
119
|
-
_Work in progress_
|
120
|
-
|
121
|
-
## Implementation of plugins into Qt Designer
|
122
|
-
|
123
|
-
_Work in progress_
|
Binary file
|
@@ -1,82 +0,0 @@
|
|
1
|
-
(user.auto_updates)=
|
2
|
-
# Auto updates
|
3
|
-
BEC Widgets provides a simple way to update the entire GUI configuration based on events. These events can be of different types, such as a new scan being started or completed, a button being pressed, a device reporting an error or the existence of a specific metadata key. This allows the users to streamline the experience of the GUI and to focus on the data and the analysis, rather than on the GUI itself.
|
4
|
-
|
5
|
-
The default auto update only takes control over a single `BECFigure` widget, which is automatically added to the GUI instance. The update instance is accessible via the `bec.gui.auto_updates` object. The user can disable / enable the auto updates by setting the `enabled` attribute of the `bec.gui.auto_updates` object, e.g.
|
6
|
-
|
7
|
-
```python
|
8
|
-
bec.gui.auto_updates.enabled = False
|
9
|
-
```
|
10
|
-
|
11
|
-
Without further customization, the auto update will automatically update the `BECFigure` widget based on the currently performed scan. The behaviour is determined by the `handler` method of the `AutoUpdate` class:
|
12
|
-
|
13
|
-
````{dropdown} Auto Updates Handler
|
14
|
-
:icon: code-square
|
15
|
-
:animate: fade-in-slide-down
|
16
|
-
:open:
|
17
|
-
```{literalinclude} ../../../bec_widgets/cli/auto_updates.py
|
18
|
-
:pyobject: AutoUpdates.handler
|
19
|
-
```
|
20
|
-
````
|
21
|
-
|
22
|
-
As shown, the default handler switches between different scan names and updates the `BECFigure` widget accordingly. If the scan is a line scan, the `simple_line_scan` update method is executed.
|
23
|
-
|
24
|
-
````{dropdown} Auto Updates Simple Line Scan
|
25
|
-
:icon: code-square
|
26
|
-
:animate: fade-in-slide-down
|
27
|
-
:open:
|
28
|
-
```{literalinclude} ../../../bec_widgets/cli/auto_updates.py
|
29
|
-
:pyobject: AutoUpdates.simple_line_scan
|
30
|
-
```
|
31
|
-
````
|
32
|
-
|
33
|
-
As it can be seen from the above snippet, the update method gets the default figure by calling the `get_default_figure` method. If the figure is not found, maybe because the user has deleted or closed it, no update is performed. If the figure is found, the scan info is used to extract the first reported device for the x axis and the first device of the monitored devices for the y axis. The y axis can also be set by the user using the `selected_device` attribute:
|
34
|
-
|
35
|
-
```python
|
36
|
-
bec.gui.auto_updates.selected_device = 'bpm4i'
|
37
|
-
```
|
38
|
-
|
39
|
-
|
40
|
-
````{dropdown} Auto Updates Code
|
41
|
-
:icon: code-square
|
42
|
-
:animate: fade-in-slide-down
|
43
|
-
```{literalinclude} ../../../bec_widgets/cli/auto_updates.py
|
44
|
-
```
|
45
|
-
````
|
46
|
-
|
47
|
-
## Custom Auto Updates
|
48
|
-
The beamline can customize their default behaviour through customized auto update classes. This can be achieved by modifying the class located in the beamline plugin repository: `<beamline_plugin>/bec_widgets/auto_updates.py`. The class should inherit from the `AutoUpdates` class and overwrite the `handler` method.
|
49
|
-
|
50
|
-
```python
|
51
|
-
from bec_widgets.cli.auto_updates import AutoUpdates, ScanInfo
|
52
|
-
|
53
|
-
|
54
|
-
class PlotUpdate(AutoUpdates):
|
55
|
-
create_default_dock = True
|
56
|
-
enabled = True
|
57
|
-
|
58
|
-
# def simple_line_scan(self, info: ScanInfo) -> None:
|
59
|
-
# """
|
60
|
-
# Simple line scan.
|
61
|
-
# """
|
62
|
-
# fig = self.get_default_figure()
|
63
|
-
# if not fig:
|
64
|
-
# return
|
65
|
-
# dev_x = info.scan_report_devices[0]
|
66
|
-
# dev_y = self.get_selected_device(info.monitored_devices, self.gui.selected_device)
|
67
|
-
# if not dev_y:
|
68
|
-
# return
|
69
|
-
# fig.clear_all()
|
70
|
-
# plt = fig.plot(x_name=dev_x, y_name=dev_y)
|
71
|
-
# plt.set(title=f"Custom Plot {info.scan_number}", x_label=dev_x, y_label=dev_y)
|
72
|
-
|
73
|
-
def handler(self, info: ScanInfo) -> None:
|
74
|
-
# EXAMPLES:
|
75
|
-
# if info.scan_name == "line_scan" and info.scan_report_devices:
|
76
|
-
# self.simple_line_scan(info)
|
77
|
-
# return
|
78
|
-
# if info.scan_name == "grid_scan" and info.scan_report_devices:
|
79
|
-
# self.run_grid_scan_update(info)
|
80
|
-
# return
|
81
|
-
super().handler(info)
|
82
|
-
```
|
@@ -1,15 +0,0 @@
|
|
1
|
-
(user.getting_started)=
|
2
|
-
# Getting Started
|
3
|
-
This section provides a comprehensive guide to getting started with BEC Widgets. Whether you are new to BEC Widgets or looking to refresh your knowledge, this guide will help you set up and navigate the framework with ease.
|
4
|
-
|
5
|
-
```{toctree}
|
6
|
-
---
|
7
|
-
maxdepth: 2
|
8
|
-
hidden: true
|
9
|
-
---
|
10
|
-
|
11
|
-
installation/
|
12
|
-
quick_start/
|
13
|
-
auto_updates/
|
14
|
-
video_tutorials/
|
15
|
-
```
|
Binary file
|
@@ -1,33 +0,0 @@
|
|
1
|
-
(user.installation)=
|
2
|
-
# Installation
|
3
|
-
**Prerequisites**
|
4
|
-
|
5
|
-
Before installing BEC Widgets, please ensure the following requirements are met:
|
6
|
-
|
7
|
-
1. **Python Version:** BEC Widgets requires Python version 3.10 or higher. Verify your Python version to ensure compatibility.
|
8
|
-
2. **BEC Installation:** BEC Widgets works in conjunction with BEC. While BEC is a dependency and will be installed automatically, you can find more information about BEC and its installation process in the [BEC documentation](https://beamline-experiment-control.readthedocs.io/en/latest/).
|
9
|
-
|
10
|
-
**Standard Installation**
|
11
|
-
|
12
|
-
To install BEC Widgets using the pip package manager, execute the following command in your terminal for getting the default PyQT6 version into your python environment for BEC:
|
13
|
-
|
14
|
-
|
15
|
-
```bash
|
16
|
-
pip install 'bec_widgets[pyqt6]'
|
17
|
-
```
|
18
|
-
|
19
|
-
In case you want to use Pyside6, you can install it by using the following command:
|
20
|
-
|
21
|
-
```bash
|
22
|
-
pip install 'bec_widgets[pyside6]'
|
23
|
-
```
|
24
|
-
|
25
|
-
**Troubleshooting**
|
26
|
-
|
27
|
-
If you encounter issues during installation, particularly with PyQt, try purging the pip cache:
|
28
|
-
|
29
|
-
```bash
|
30
|
-
pip cache purge
|
31
|
-
```
|
32
|
-
|
33
|
-
This can resolve conflicts or issues with package installations.
|
@@ -1,110 +0,0 @@
|
|
1
|
-
(user.command_line_introduction)=
|
2
|
-
# Quick start
|
3
|
-
In order to use BEC Widgets as a plotting tool for BEC, it needs to be [installed](#user.installation) in the same Python environment as the BEC IPython client (please refer to the [BEC documentation](https://bec.readthedocs.io/en/latest/user/command_line_interface.html#start-up) for more details). Upon startup, the client will automatically launch a GUI and store it as a `bec.gui` object in the client. The GUI backend will also be automatically connect to the BEC server, giving access to all information on the server and allowing the user to visualize the data in real-time.
|
4
|
-
|
5
|
-
## BECDockArea
|
6
|
-
The `bec.gui` object is your entry point to BEC Widgets. It is a [`BECDockArea`](/api_reference/_autosummary/bec_widgets.cli.client.BECDockArea) instance that can be composed of multiple [`BECDock`](/api_reference/_autosummary/bec_widgets.cli.client.BECDock)s that can be attached / detached to the main area. These docks allow users to freely arrange and customize the widgets they add to the gui, providing a flexible and customizable interface to visualize data.
|
7
|
-
|
8
|
-
**Schema of the BECDockArea**
|
9
|
-
|
10
|
-

|
11
|
-
|
12
|
-
## Widgets
|
13
|
-
Widgets are the building blocks of the BEC Widgets framework. They are the visual components that allow users to interact with the data and control the behavior of the application. Each dock can contain multiple widgets, albeit we recommend for most use cases a single widget per dock. BEC Widgets provides a set of core widgets (cf. [widgets](#user.widgets)). More widgets can be added by the users, and we invite you to explore the [developer documentation](developer.widgets) to learn how to create custom widgets.
|
14
|
-
For the introduction given here, we will focus on the `BECFigure` widget, as it is the most commonly used widget for visualizing data from BEC. The same access pattern can be used for all other widgets.
|
15
|
-
|
16
|
-
**BECFigure**
|
17
|
-
|
18
|
-
The [`BECFigure`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure) widget is one of the core widgets developed for BEC and can be used to visualize different plot types, such as [1D waveforms](user.widgets.waveform_1d), [2D scatter plots](user.widgets.scatter_2d), [position maps](user.widgets.motor_map) and [2D images](user.widgets.image_2d).
|
19
|
-
If BEC Widgets is installed, the default behaviour of BEC is to automatically add a BECFigure Widget to the existing GUI instance. This widget is directly accessible via the `fig` object from the client. Moreover, a best-effort attempt is made to automatically determine the best plot type based on the currently performed scan. This behaviour can be changed or disabled by the user. For more details, please refer to the [auto update](user.auto_updates) section.
|
20
|
-
|
21
|
-
<!-- We also provide two methods [`plot()`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.plot), [`image()`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.image) and [`motor_map()`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.motor_map) as shortcuts to add a plot, image or motor map to the BECFigure. -->
|
22
|
-
|
23
|
-
**Waveform Plot**
|
24
|
-
|
25
|
-
The [`BECWaveForm`](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform) is a widget that can be used to visualize 1D waveform data, i.e. to plot data of a monitor against a motor position. The method [`plot()`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.plot) of BECFigure adds a BECWaveForm widget to the figure, and returns the plot object.
|
26
|
-
|
27
|
-
```python
|
28
|
-
plt = fig.plot(x_name='samx', y_name='bpm4i')
|
29
|
-
```
|
30
|
-
Here, we create a new plot with a subscription to the devices `samx` and `bpm4i` and assign the plot to the object `plt`. We can now use this object to further customize the plot, e.g. changing the title ([`set_title()`](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform.rst#bec_widgets.cli.client.BECWaveform.set_title)), axis labels ([`set_x_label()`](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform.rst#bec_widgets.cli.client.BECWaveform.set_x_label)) or limits ([`set_x_lim()`](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveform.rst#bec_widgets.cli.client.BECWaveform.set_x_lim)). We invite you to explore the API of the BECWaveForm in the [documentation](user.widgets.waveform_1d) or directly in the command line.
|
31
|
-
|
32
|
-
To plot custom data, i.e. data that is not directly available through a scan in BEC, we can use the same method, but provide the data directly to the plot.
|
33
|
-
|
34
|
-
```python
|
35
|
-
plt = fig.plot([1,2,3,4], [1,4,9,16])
|
36
|
-
# or
|
37
|
-
plt = fig.plot(x=[1,2,3,4], y=[1,4,9,16])
|
38
|
-
# or
|
39
|
-
plt = fig.plot(x=np.array([1,2,3,4]), y=np.array([1,4,9,16]))
|
40
|
-
# or
|
41
|
-
plt = fig.plot(np.random.rand(10,2))
|
42
|
-
```
|
43
|
-
|
44
|
-
**Scatter Plot**
|
45
|
-
|
46
|
-
The [`BECWaveForm`](/api_reference/_autosummary/bec_widgets.cli.client.BECWaveForm) widget can also be used to visualize 2D scatter plots. More details on setting up the scatter plot are available in the widget documentation of the [scatter plot](user.widgets.scatter_2d).
|
47
|
-
|
48
|
-
**Motor Map**
|
49
|
-
|
50
|
-
The [`BECMotorMap`](/api_reference/_autosummary/bec_widgets.cli.client.BECMotorMap) widget can be used to visualize the position of motors. It's focused on tracking and visualizing the position of motors, crucial for precise alignment and movement tracking during scans. More details on setting up the motor map are available in the widget documentation of the [motor map](user.widgets.motor_map).
|
51
|
-
|
52
|
-
**Image Plot**
|
53
|
-
|
54
|
-
The [`BECImageItem`](/api_reference/_autosummary/bec_widgets.cli.client.BECImageItem) widget can be used to visualize 2D image data for example a camera. More details on setting up the image plot are available in the widget documentation of the [image plot](user.widgets.image).
|
55
|
-
|
56
|
-
### Useful Commands
|
57
|
-
We recommend users to explore the API of the widgets by themselves since we assume that the user interface is supposed to be intuitive and self-explanatory. We appreciate feedback from user in order to constantly improve the experience and allow easy access to the gui, widgets and their functionality. We recommend checking the [API documentation](user.api_reference), but also by using BEC Widgets, exploring the available functions and check their dockstrings.
|
58
|
-
```python
|
59
|
-
gui.add_dock? # shows the dockstring of the add_dock method
|
60
|
-
```
|
61
|
-
|
62
|
-
In addition, we list below a few useful commands that can be used to interface with the widgets:
|
63
|
-
|
64
|
-
```python
|
65
|
-
gui.panels # returns a dictionary of all docks in the gui
|
66
|
-
gui.add_dock() # adds a new dock to the gui
|
67
|
-
|
68
|
-
dock = gui.panels['dock_2']
|
69
|
-
dock.add_widget('BECFigure') # adds a new widget of BECFigure to the dock
|
70
|
-
dock.widget_list # returns a list of all widgets in the dock
|
71
|
-
|
72
|
-
figure = dock.widget_list[0] # assigns the created BECFigure to figure
|
73
|
-
plt = figure.plot(x_name='samx', y_name='bpm4i') # adds a BECWaveForm plot to the figure
|
74
|
-
plt.curves # returns a list of all curves in the plot
|
75
|
-
```
|
76
|
-
|
77
|
-
We note that commands can also be chained. For example, `gui.add_dock().add_widget('BECFigure')` will add a new dock to the gui and add a new widget of `BECFigure` to the dock.
|
78
|
-
|
79
|
-
## Composing a larger GUI
|
80
|
-
The example given above introduces BEC Widgets with its different components, and provides an overview of how to interact with the widgets. Nevertheless, another power aspect of BEC Widgets lies in the ability to compose a larger GUI with multiple docks and widgets. This section aims to provide a tutorial like guide on how to compose a more complex GUI that (A) live-plots a 1D waveform, (B) plots data from a camera, and (C) tracks the positions of two motors.
|
81
|
-
Let's assume BEC was just started and the `gui` object is available in the client. A single dock is already attached together with a BEC Figure. Let's add the 1D waveform to this dock, change the color of the line to white and add the title *1D Waveform* to the plot.
|
82
|
-
|
83
|
-
```python
|
84
|
-
plt = fig.plot(x_name='samx', y_name='bpm4i')
|
85
|
-
plt.curves[0].set_color(color="white")
|
86
|
-
plt.set_title('1D Waveform')
|
87
|
-
```
|
88
|
-
|
89
|
-
Next, we add 2 new docks to the gui, one to plot the data of a camera and one to track the positions of two motors.
|
90
|
-
```ipython
|
91
|
-
cam_widget= gui.add_dock(name="cam_dock").add_widget('BECFigure').image("eiger")
|
92
|
-
motor_widget = gui.add_dock(name="mot_dock").add_widget('BECFigure').motor_map("samx", "samy")
|
93
|
-
```
|
94
|
-
Note, we chain commands here which is possible since the `add_dock` and `add_widget` methods return the dock and the widget respectively. We can now further customize the widgets by changing the title, axis labels, etc.
|
95
|
-
|
96
|
-
```python
|
97
|
-
cam_widget.set_title("Camera Image Eiger")
|
98
|
-
cam_widget.set_vrange(vmin=0, vmax=100)
|
99
|
-
```
|
100
|
-
As a final step, we can now add also a RingProgressBar to a new dock, and perform a grid_scan with the motors *samx* and *samy*.
|
101
|
-
As you see in the example below, all docks are arranged below each other. This is the default behavior of the `add_dock` method. However, the docks can be freely arranged by drag and drop as desired by the user. We invite you to explore this by yourself following the example in the video, and build your custom GUI with BEC Widgets.
|
102
|
-
|
103
|
-
```python
|
104
|
-
prog_bar = gui.add_dock(name="prog_dock").add_widget('RingProgressBar')
|
105
|
-
prog_bar.set_line_widths(15)
|
106
|
-
scans.grid_scan(dev.samy, -2, 2, 10, dev.samx, -5, 5, 10, exp_time=0.1, relative=False)
|
107
|
-
```
|
108
|
-
|
109
|
-

|
110
|
-
|
@@ -1,17 +0,0 @@
|
|
1
|
-
(user.video_tutorials)=
|
2
|
-
|
3
|
-
# Video Tutorials
|
4
|
-
|
5
|
-
This section includes video tutorials that demonstrate various use cases of `bec-widgets`, including video tutorials,
|
6
|
-
presentations, and conference talks.
|
7
|
-
|
8
|
-
## BSEG Meeting 24th July 2024
|
9
|
-
|
10
|
-
This video is a presentation of the BEC Widgets project at the BSEG meeting on the 24th July 2024. The presentation
|
11
|
-
covers the basic interactions, including visualization of live data acquisition and how to steer experiments using
|
12
|
-
user-friendly tools. Learn how BEC Widgets can enhance your experimental control projects with its intuitive interface
|
13
|
-
and powerful features.
|
14
|
-
|
15
|
-
Used version of BEC Widgets: 0.91.0
|
16
|
-
|
17
|
-
<iframe width="560" height="315" src="https://www.youtube.com/embed/qZ8fWXRAdHE" frameborder="0" allowfullscreen></iframe>
|
docs/user/user.md
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
(user)=
|
2
|
-
# User
|
3
|
-
Welcome to the User section of the BEC Widgets documentation! BEC Widgets is a versatile GUI framework tailored for beamline scientists, enabling efficient and intuitive interaction with beamline experiments. This section is designed to guide both new and experienced users through the essential aspects of utilizing BEC Widgets.
|
4
|
-
|
5
|
-
```{toctree}
|
6
|
-
---
|
7
|
-
maxdepth: 2
|
8
|
-
hidden: true
|
9
|
-
---
|
10
|
-
|
11
|
-
getting_started/getting_started.md
|
12
|
-
applications/applications.md
|
13
|
-
widgets/widgets.md
|
14
|
-
api_reference/api_reference.md
|
15
|
-
```
|
16
|
-
|
17
|
-
|
18
|
-
***
|
19
|
-
|
20
|
-
````{grid} 2
|
21
|
-
:gutter: 5
|
22
|
-
|
23
|
-
```{grid-item-card}
|
24
|
-
:link: user.getting_started
|
25
|
-
:link-type: ref
|
26
|
-
:img-top: /assets/rocket_launch_48dp.svg
|
27
|
-
:text-align: center
|
28
|
-
:class-item: index-card
|
29
|
-
|
30
|
-
## Getting Started
|
31
|
-
|
32
|
-
Learn how to install BEC Widgets and get started with the framework.
|
33
|
-
```
|
34
|
-
|
35
|
-
```{grid-item-card}
|
36
|
-
:link: user.applications
|
37
|
-
:link-type: ref
|
38
|
-
:img-top: /assets/display_settings_48dp.svg
|
39
|
-
:text-align: center
|
40
|
-
:class-item: index-card
|
41
|
-
|
42
|
-
## Applications
|
43
|
-
|
44
|
-
Learn how to use BEC Widgets Applications, to modify and create new applications.
|
45
|
-
|
46
|
-
```
|
47
|
-
|
48
|
-
```{grid-item-card}
|
49
|
-
:link: user.widgets
|
50
|
-
:link-type: ref
|
51
|
-
:img-top: /assets/apps_48dp.svg
|
52
|
-
:text-align: center
|
53
|
-
:class-item: index-card
|
54
|
-
|
55
|
-
## Widgets
|
56
|
-
|
57
|
-
Learn about the building blocks of larger applications: widgets.
|
58
|
-
```
|
59
|
-
|
60
|
-
```{grid-item-card}
|
61
|
-
:link: user.api_reference
|
62
|
-
:link-type: ref
|
63
|
-
:img-top: /assets/index_api.svg
|
64
|
-
:text-align: center
|
65
|
-
:class-item: index-card
|
66
|
-
|
67
|
-
## API reference
|
68
|
-
|
69
|
-
Comprehensive reference of all user-facing classes, functions, and methods.
|
70
|
-
```
|
71
|
-
````
|
Binary file
|
@@ -1,105 +0,0 @@
|
|
1
|
-
(user.widgets.bec_figure)=
|
2
|
-
# BECFigure
|
3
|
-
|
4
|
-
````{tab} Overview
|
5
|
-
|
6
|
-
[`BECFigure`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure) is a robust framework that provides a fast, flexible plotting environment, similar to the Matplotlib figure. With BECFigure, users can dynamically change layouts, add or remove subplots, and customize their plotting environment in real-time. This flexibility makes BECFigure an ideal tool for both rapid prototyping and detailed data visualization.
|
7
|
-
|
8
|
-
- **Dynamic Layout Management**: Easily add, remove, and rearrange subplots within `BECFigure`, enabling tailored visualization setups.
|
9
|
-
- **Widget Integration**: Incorporate various specialized widgets like [`WaveformWidget`](user.widgets.waveform_widget), [`ImageWidget`](user.widgets.image_widget) , and [`MotorMapWidget`](user.widgets.motor_map) into `BECFigure`. Note that these widgets can also be used individually. For more details, please refer to the documentation for each individual widget.
|
10
|
-
- **Interactive Controls**: Provides interactive tools for zooming, panning, and adjusting plots on the fly, streamlining the data exploration process.
|
11
|
-
|
12
|
-
**Schema of the BECFigure components**
|
13
|
-
|
14
|
-

|
15
|
-
|
16
|
-
````
|
17
|
-
|
18
|
-
````{tab} Examples - CLI
|
19
|
-
In the following examples, we will use `BECIPythonClient` with a predefined `BECDockArea` as the `gui` object. These tutorials focus on how to work with the `BECFigure` framework, such as changing layouts, adding new elements, and accessing them. For more detailed examples of each individual component, please refer to the example sections of each individual widget: [`WaveformWidget`](user.widgets.waveform_widget), [`MotorMapWidget`](user.widgets.motor_map), [`ImageWidget`](user.widgets.image_widget).
|
20
|
-
|
21
|
-
## Example 1 - Adding subplots to BECFigure
|
22
|
-
|
23
|
-
In this example, we will demonstrate how to add different subplots to a single `BECFigure` widget.
|
24
|
-
|
25
|
-
```python
|
26
|
-
# Add a new dock with BECFigure widget
|
27
|
-
fig = gui.add_dock().add_widget('BECFigure')
|
28
|
-
|
29
|
-
# Add a WaveformWidget to the BECFigure
|
30
|
-
plt1 = fig.plot(x_name='samx', y_name='bpm4i')
|
31
|
-
|
32
|
-
# Add a second WaveformWidget to the BECFigure, specifying new=True to add it as a new subplot
|
33
|
-
plt2 = fig.plot(x_name='samx', y_name='bpm3i', new=True)
|
34
|
-
|
35
|
-
# Add a MotorMapWidget to the BECFigure
|
36
|
-
mm = fig.motor_map(motor_x='samx', motor_y='samy')
|
37
|
-
|
38
|
-
# Add an ImageWidget to the BECFigure
|
39
|
-
img = fig.image('eiger')
|
40
|
-
```
|
41
|
-
```{note}
|
42
|
-
By default, the [`.plot`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.plot), [`.image`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.image), and [`.motor_map`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.motor_map) methods always find the first widget of that type in the layout and interact with it. If you want to add a new subplot of the same type, you must either specify the coordinates of the new subplot or use the `new=True` keyword argument, as shown above when adding the second WaveformWidget. Additionally, you can directly add a subplot to a specific, unoccupied position in the layout by specifying the `row` and `col` arguments, such as `fig.plot(x_name='samx', y_name='bpm4i', row=1, col=1)`.
|
43
|
-
```
|
44
|
-
|
45
|
-
## Example 2 - Changing the layout of BECFigure
|
46
|
-
|
47
|
-
The previous example added four subplots into a single `BECFigure` widget. By default, new widgets are always added to the bottom of the BECFigure. However, you can change the layout of the BECFigure by using the [`change_layout`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.change_layout) method, specifying the number of rows and/or columns.
|
48
|
-
|
49
|
-
```python
|
50
|
-
# Change the layout of the BECFigure to have 4 columns -> 4x1 matrix layout
|
51
|
-
fig.change_layout(max_columns=4)
|
52
|
-
|
53
|
-
# Change the layout of the BECFigure to have 2 rows -> 2x2 matrix layout
|
54
|
-
fig.change_layout(max_rows=2)
|
55
|
-
```
|
56
|
-
|
57
|
-
## Example 3 - Accessing Subplots in BECFigure
|
58
|
-
|
59
|
-
The subplots in BECFigure can be accessed in a similar way to Matplotlib figures using the [`axes`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.axes) property. Each subplot can be accessed by its index coordinates within the layout, specified by the row and column index (starting at 0). In following example, we will access the subplots and modify their titles. The layout is a 2x2 matrix, so the subplots are indexed as follows:
|
60
|
-
|
61
|
-
```python
|
62
|
-
# Access the first subplot in the first row and first column (0, 0)
|
63
|
-
subplot1 = fig.axes(0, 0)
|
64
|
-
|
65
|
-
# Access the second subplot in the first row and second column (0, 1)
|
66
|
-
subplot2 = fig.axes(0, 1)
|
67
|
-
|
68
|
-
# Access the first subplot in the second row and first column (1, 0)
|
69
|
-
subplot3 = fig.axes(1, 0)
|
70
|
-
|
71
|
-
# Example: Set title for the first subplot
|
72
|
-
subplot1.set_title("Waveform 1")
|
73
|
-
|
74
|
-
# Example: Set title for the second subplot
|
75
|
-
subplot2.set_title("Waveform 2")
|
76
|
-
|
77
|
-
# Example: Set title for the third subplot
|
78
|
-
subplot3.set_title("Motor Map")
|
79
|
-
```
|
80
|
-
|
81
|
-
In this example, we accessed three different subplots based on their row and column positions and modified their titles.
|
82
|
-
|
83
|
-
## Example 4 - Removing Subplots from BECFigure
|
84
|
-
|
85
|
-
You may want to remove certain subplots from the `BECFigure`. This can be done using the [`remove`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.remove) method, which takes the row and column index of the subplot you want to remove. The [`remove`](/api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst#bec_widgets.cli.client.BECFigure.remove) method could be also called on the subplot itself.
|
86
|
-
|
87
|
-
```python
|
88
|
-
|
89
|
-
# Remove the subplot in the second row and second column (1, 1)
|
90
|
-
fig.remove(1, 1)
|
91
|
-
|
92
|
-
# Remove the subplot in the first row and first column (0, 0)
|
93
|
-
fig.remove(0, 0)
|
94
|
-
|
95
|
-
# Remove previously accessed subplot plt2 from Example 1
|
96
|
-
plt2.remove()
|
97
|
-
```
|
98
|
-
|
99
|
-
````
|
100
|
-
|
101
|
-
````{tab} API
|
102
|
-
```{eval-rst}
|
103
|
-
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.BECFigure.rst
|
104
|
-
```
|
105
|
-
````
|
Binary file
|
@@ -1,38 +0,0 @@
|
|
1
|
-
(user.widgets.bec_status_box)=
|
2
|
-
# BEC Status Box
|
3
|
-
|
4
|
-
````{tab} Overview
|
5
|
-
|
6
|
-
The [`BEC Status Box`](/api_reference/_autosummary/bec_widgets.cli.client.BECStatusBox) widget is designed to monitor the status and health of all running BEC processes. This widget provides a real-time overview of the BEC core services, including DeviceServer, ScanServer, SciHub, ScanBundler, and FileWriter. The top-level display indicates the overall state of the BEC services, while the collapsed view allows users to delve into the status of each individual process. By double-clicking on a specific process, users can access a detailed popup window with live updates of the metrics for that process.
|
7
|
-
|
8
|
-
## Key Features:
|
9
|
-
- **Comprehensive Service Monitoring**: Track the state of individual BEC services, including real-time updates on their health and status.
|
10
|
-
- **Automatic Service Tracking**: Automatically detects and monitors additional clients connecting to the BEC services.
|
11
|
-
- **Detailed Metrics**: Provides live updates of the metrics for each process, accessible through an interactive popup window.
|
12
|
-
|
13
|
-

|
14
|
-
````
|
15
|
-
|
16
|
-
````{tab} Examples
|
17
|
-
|
18
|
-
The `BECStatusBox` 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 `BECStatusBox` widget.
|
19
|
-
|
20
|
-
## Example 1 - Adding BEC Status Box to BECDockArea
|
21
|
-
|
22
|
-
In this example, we demonstrate how to add a `BECStatusBox` widget to a `BECDockArea`, allowing users to monitor the status of BEC processes directly from the GUI.
|
23
|
-
|
24
|
-
```python
|
25
|
-
# Add a new dock with a BECStatusBox widget
|
26
|
-
bec_status_box = gui.add_dock().add_widget("BECStatusBox")
|
27
|
-
```
|
28
|
-
|
29
|
-
```{hint}
|
30
|
-
Once the `BECStatusBox` is added, users can interact with it to view the status of individual processes. By expanding the view, you can see the status of each BEC service in detail.
|
31
|
-
```
|
32
|
-
````
|
33
|
-
|
34
|
-
````{tab} API
|
35
|
-
```{eval-rst}
|
36
|
-
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.BECStatusBox.rst
|
37
|
-
```
|
38
|
-
````
|