bec-widgets 0.94.7__py3-none-any.whl → 0.95.0__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 +30 -34
- PKG-INFO +1 -1
- bec_widgets/cli/client.py +19 -0
- 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 +54 -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-0.94.7.dist-info → bec_widgets-0.95.0.dist-info}/METADATA +1 -1
- {bec_widgets-0.94.7.dist-info → bec_widgets-0.95.0.dist-info}/RECORD +73 -33
- 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/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
- 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.0.dist-info}/WHEEL +0 -0
- {bec_widgets-0.94.7.dist-info → bec_widgets-0.95.0.dist-info}/entry_points.txt +0 -0
- {bec_widgets-0.94.7.dist-info → bec_widgets-0.95.0.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
docs/_static/custom.css
CHANGED
@@ -59,29 +59,29 @@
|
|
59
59
|
|
60
60
|
/* Main index page overview cards */
|
61
61
|
|
62
|
-
.sd-card {
|
62
|
+
.index-card .sd-card {
|
63
63
|
background: #fff;
|
64
64
|
border-radius: 0;
|
65
65
|
padding: 30px 10px 20px 10px;
|
66
66
|
margin: 10px 0px;
|
67
67
|
}
|
68
68
|
|
69
|
-
.
|
69
|
+
.index-card .sd-card-header {
|
70
70
|
text-align: center;
|
71
71
|
}
|
72
72
|
|
73
|
-
.
|
73
|
+
.index-card .sd-card-header .sd-card-text {
|
74
74
|
margin: 0px;
|
75
75
|
}
|
76
76
|
|
77
|
-
.
|
77
|
+
.index-card .sd-card-img-top {
|
78
78
|
height: 52px;
|
79
79
|
width: 52px;
|
80
80
|
margin-left: auto;
|
81
81
|
margin-right: auto;
|
82
82
|
}
|
83
83
|
|
84
|
-
.
|
84
|
+
.index-card .sd-card-header {
|
85
85
|
border: none;
|
86
86
|
background-color:white;
|
87
87
|
color: #150458 !important;
|
@@ -91,13 +91,13 @@
|
|
91
91
|
border-bottom: none !important;
|
92
92
|
}
|
93
93
|
|
94
|
-
.
|
94
|
+
.index-card .sd-card-footer {
|
95
95
|
border: none;
|
96
96
|
background-color:white;
|
97
97
|
border-top: none !important;
|
98
98
|
}
|
99
99
|
|
100
|
-
.
|
100
|
+
.index-card .sd-card-footer .sd-card-text{
|
101
101
|
max-width: 220px;
|
102
102
|
margin-left: auto;
|
103
103
|
margin-right: auto;
|
@@ -143,7 +143,7 @@
|
|
143
143
|
|
144
144
|
/* Main index page overview cards */
|
145
145
|
|
146
|
-
html[data-theme=dark] .sd-card {
|
146
|
+
html[data-theme=dark] .index-card .sd-card {
|
147
147
|
background-color:var(--pst-color-background);
|
148
148
|
border: none
|
149
149
|
}
|
@@ -152,12 +152,12 @@
|
|
152
152
|
box-shadow: 0 .1rem 0.5rem rgba(250, 250, 250, .2) !important
|
153
153
|
}
|
154
154
|
|
155
|
-
html[data-theme=dark] .
|
155
|
+
html[data-theme=dark] .index-card .sd-card-header {
|
156
156
|
background-color:var(--pst-color-background);
|
157
157
|
color: #150458 !important;
|
158
158
|
}
|
159
159
|
|
160
|
-
html[data-theme=dark] .
|
160
|
+
html[data-theme=dark] .index-card .sd-card-footer {
|
161
161
|
background-color:var(--pst-color-background);
|
162
162
|
}
|
163
163
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
docs/conf.py
CHANGED
docs/developer/developer.md
CHANGED
@@ -27,6 +27,7 @@ api_reference/api_reference.md
|
|
27
27
|
:link-type: ref
|
28
28
|
:img-top: /assets/rocket_launch_48dp.svg
|
29
29
|
:text-align: center
|
30
|
+
:class-item: index-card
|
30
31
|
|
31
32
|
## Introduction
|
32
33
|
|
@@ -38,6 +39,7 @@ An introduction into the single-resposibility principle and the modular design o
|
|
38
39
|
:link-type: ref
|
39
40
|
:img-top: /assets/apps_48dp.svg
|
40
41
|
:text-align: center
|
42
|
+
:class-item: index-card
|
41
43
|
|
42
44
|
## Widget Development
|
43
45
|
|
docs/index.md
CHANGED
@@ -14,6 +14,7 @@ A flexible and extensible framework for building graphical user interfaces in Py
|
|
14
14
|
:link-type: ref
|
15
15
|
:img-top: /assets/index_getting_started.svg
|
16
16
|
:text-align: center
|
17
|
+
:class-item: index-card
|
17
18
|
|
18
19
|
## Introduction
|
19
20
|
|
@@ -25,6 +26,7 @@ General information about BEC Widgets.
|
|
25
26
|
:link-type: ref
|
26
27
|
:img-top: /assets/index_user_guide.svg
|
27
28
|
:text-align: center
|
29
|
+
:class-item: index-card
|
28
30
|
|
29
31
|
## User guide
|
30
32
|
|
@@ -36,6 +38,7 @@ Information for users of BEC Widgets.
|
|
36
38
|
:link-type: ref
|
37
39
|
:img-top: /assets/index_contribute.svg
|
38
40
|
:text-align: center
|
41
|
+
:class-item: index-card
|
39
42
|
|
40
43
|
## Developer guide
|
41
44
|
|
@@ -47,6 +50,7 @@ Information for developers of BEC Widgets.
|
|
47
50
|
:link-type: ref
|
48
51
|
:img-top: /assets/index_api.svg
|
49
52
|
:text-align: center
|
53
|
+
:class-item: index-card
|
50
54
|
|
51
55
|
## API reference
|
52
56
|
|
docs/requirements.txt
CHANGED
docs/user/user.md
CHANGED
@@ -25,6 +25,7 @@ api_reference/api_reference.md
|
|
25
25
|
:link-type: ref
|
26
26
|
:img-top: /assets/rocket_launch_48dp.svg
|
27
27
|
:text-align: center
|
28
|
+
:class-item: index-card
|
28
29
|
|
29
30
|
## Getting Started
|
30
31
|
|
@@ -36,6 +37,7 @@ Learn how to install BEC Widgets and get started with the framework.
|
|
36
37
|
:link-type: ref
|
37
38
|
:img-top: /assets/display_settings_48dp.svg
|
38
39
|
:text-align: center
|
40
|
+
:class-item: index-card
|
39
41
|
|
40
42
|
## Applications
|
41
43
|
|
@@ -48,6 +50,7 @@ Learn how to use BEC Widgets Applications, to modify and create new applications
|
|
48
50
|
:link-type: ref
|
49
51
|
:img-top: /assets/apps_48dp.svg
|
50
52
|
:text-align: center
|
53
|
+
:class-item: index-card
|
51
54
|
|
52
55
|
## Widgets
|
53
56
|
|
@@ -59,6 +62,7 @@ Learn about the building blocks of larger applications: widgets.
|
|
59
62
|
:link-type: ref
|
60
63
|
:img-top: /assets/index_api.svg
|
61
64
|
:text-align: center
|
65
|
+
:class-item: index-card
|
62
66
|
|
63
67
|
## API reference
|
64
68
|
|
@@ -0,0 +1,105 @@
|
|
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
|
+
````
|
@@ -0,0 +1,38 @@
|
|
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
|
+
````
|
@@ -0,0 +1,50 @@
|
|
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
|
+
````
|
18
|
+
|
19
|
+
````{tab} Examples
|
20
|
+
|
21
|
+
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`.
|
22
|
+
|
23
|
+
## Example 1 - Embedding a Stop Button in a Custom GUI Layout
|
24
|
+
|
25
|
+
This example shows how to create a simple GUI layout with a `StopButton` integrated, allowing the user to halt processes directly from the interface.
|
26
|
+
|
27
|
+
```python
|
28
|
+
from qtpy.QtWidgets import QWidget, QVBoxLayout
|
29
|
+
from bec_widgets.widgets.buttons import StopButton
|
30
|
+
|
31
|
+
class MyGui(QWidget):
|
32
|
+
def __init__(self):
|
33
|
+
super().__init__()
|
34
|
+
self.setLayout(QVBoxLayout(self)) # Initialize the layout for the widget
|
35
|
+
|
36
|
+
# Create and add the StopButton to the layout
|
37
|
+
self.stop_button = StopButton()
|
38
|
+
self.layout().addWidget(self.stop_button)
|
39
|
+
|
40
|
+
# Example of how this custom GUI might be used:
|
41
|
+
my_gui = MyGui()
|
42
|
+
my_gui.show()
|
43
|
+
```
|
44
|
+
````
|
45
|
+
|
46
|
+
````{tab} API
|
47
|
+
```{eval-rst}
|
48
|
+
.. include:: /api_reference/_autosummary/bec_widgets.cli.client.StopButton.rst
|
49
|
+
```
|
50
|
+
````
|
@@ -0,0 +1,36 @@
|
|
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
|
@@ -0,0 +1,100 @@
|
|
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
|
@@ -0,0 +1,107 @@
|
|
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
|
+
|