bec-widgets 0.95.1__py3-none-any.whl → 0.96.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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.96.0 (2024-08-22)
4
+
5
+ ### Documentation
6
+
7
+ * docs(scan_control): added designer options ([`9d7718c`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/9d7718c3d9badf14150174410b9958a3134a1e23))
8
+
9
+ ### Feature
10
+
11
+ * feat(scan_control): added the ability to configure the scan control widget from designer ([`9d8fb0b`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/9d8fb0b761efa92972399bcd9aea28e956074380))
12
+
3
13
  ## v0.95.1 (2024-08-22)
4
14
 
5
15
  ### Documentation
@@ -148,12 +158,6 @@ Terminating client connections has to be done at the application level ([`198c1d
148
158
 
149
159
  * fix(dock): properly shut down docks and temp areas ([`99ee545`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/99ee545e41c6078654958b668b5b329f85553d16))
150
160
 
151
- * fix(settings): shut down settings dialog ([`b50b3a2`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/b50b3a27e68956e10e8169a0aa698c911d2d9642))
152
-
153
- * fix(website): fixed teardown of website widgets ([`a3d4f5a`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/a3d4f5ac4bc52acfed2791a1724fade6972ed320))
154
-
155
161
  ### Test
156
162
 
157
163
  * test: removed quit from teardown ([`cf94599`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/cf94599c2544d6831c8afbe7b340082077557ed1))
158
-
159
- * test: removed explicit call to close the widget ([`bf6294e`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/bf6294ecbfd494565d2dc215e4d7e0c280ac7745))
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.95.1
3
+ Version: 0.96.0
4
4
  Summary: BEC Widgets
5
5
  Project-URL: Bug Tracker, https://gitlab.psi.ch/bec/bec_widgets/issues
6
6
  Project-URL: Homepage, https://gitlab.psi.ch/bec/bec_widgets
@@ -1,9 +1,11 @@
1
1
  from bec_lib.endpoints import MessageEndpoints
2
+ from qtpy.QtCore import Property, Signal, Slot
2
3
  from qtpy.QtWidgets import (
3
4
  QApplication,
4
5
  QComboBox,
5
6
  QGridLayout,
6
7
  QGroupBox,
8
+ QHBoxLayout,
7
9
  QPushButton,
8
10
  QSizePolicy,
9
11
  QVBoxLayout,
@@ -18,6 +20,9 @@ from bec_widgets.widgets.stop_button.stop_button import StopButton
18
20
 
19
21
  class ScanControl(BECWidget, QWidget):
20
22
 
23
+ scan_started = Signal()
24
+ scan_selected = Signal(str)
25
+
21
26
  def __init__(
22
27
  self, parent=None, client=None, gui_id: str | None = None, allowed_scans: list | None = None
23
28
  ):
@@ -50,11 +55,26 @@ class ScanControl(BECWidget, QWidget):
50
55
  self.layout.addWidget(self.scan_selection_group)
51
56
 
52
57
  # Connect signals
53
- self.comboBox_scan_selection.currentIndexChanged.connect(self.on_scan_selected)
58
+ self.comboBox_scan_selection.currentIndexChanged.connect(self.on_scan_selection_changed)
54
59
  self.button_run_scan.clicked.connect(self.run_scan)
60
+
61
+ # Add bundle button
62
+ self.button_add_bundle = QPushButton("Add Bundle")
63
+ self.button_add_bundle.setVisible(False)
64
+ # Remove bundle button
65
+ self.button_remove_bundle = QPushButton("Remove Bundle")
66
+ self.button_remove_bundle.setVisible(False)
67
+
68
+ bundle_layout = QHBoxLayout()
69
+ bundle_layout.addWidget(self.button_add_bundle)
70
+ bundle_layout.addWidget(self.button_remove_bundle)
71
+ self.layout.addLayout(bundle_layout)
72
+
55
73
  self.button_add_bundle.clicked.connect(self.add_arg_bundle)
56
74
  self.button_remove_bundle.clicked.connect(self.remove_arg_bundle)
57
75
 
76
+ self.scan_selected.connect(self.scan_select)
77
+
58
78
  # Initialize scan selection
59
79
  self.populate_scans()
60
80
 
@@ -69,21 +89,16 @@ class ScanControl(BECWidget, QWidget):
69
89
  scan_selection_group = QGroupBox("Scan Selection", self)
70
90
  self.scan_selection_layout = QGridLayout(scan_selection_group)
71
91
  self.comboBox_scan_selection = QComboBox(scan_selection_group)
92
+
72
93
  # Run button
73
94
  self.button_run_scan = QPushButton("Start", scan_selection_group)
74
95
  self.button_run_scan.setStyleSheet("background-color: #559900; color: white")
75
96
  # Stop button
76
97
  self.button_stop_scan = StopButton(parent=scan_selection_group)
77
- # Add bundle button
78
- self.button_add_bundle = QPushButton("Add Bundle", scan_selection_group)
79
- # Remove bundle button
80
- self.button_remove_bundle = QPushButton("Remove Bundle", scan_selection_group)
81
98
 
82
99
  self.scan_selection_layout.addWidget(self.comboBox_scan_selection, 0, 0, 1, 2)
83
100
  self.scan_selection_layout.addWidget(self.button_run_scan, 1, 0)
84
101
  self.scan_selection_layout.addWidget(self.button_stop_scan, 1, 1)
85
- self.scan_selection_layout.addWidget(self.button_add_bundle, 2, 0)
86
- self.scan_selection_layout.addWidget(self.button_remove_bundle, 2, 1)
87
102
 
88
103
  return scan_selection_group
89
104
 
@@ -104,23 +119,65 @@ class ScanControl(BECWidget, QWidget):
104
119
  allowed_scans = self.allowed_scans
105
120
  self.comboBox_scan_selection.addItems(allowed_scans)
106
121
 
107
- def on_scan_selected(self):
122
+ def on_scan_selection_changed(self, index: int):
108
123
  """Callback for scan selection combo box"""
109
- self.reset_layout()
110
124
  selected_scan_name = self.comboBox_scan_selection.currentText()
111
- selected_scan_info = self.available_scans.get(selected_scan_name, {})
125
+ self.scan_selected.emit(selected_scan_name)
126
+
127
+ @Property(bool)
128
+ def hide_scan_control_buttons(self):
129
+ return not self.button_run_scan.isVisible()
130
+
131
+ @hide_scan_control_buttons.setter
132
+ def hide_scan_control_buttons(self, hide: bool):
133
+ self.show_scan_control_buttons(not hide)
134
+
135
+ @Slot(bool)
136
+ def show_scan_control_buttons(self, show: bool):
137
+ """Shows or hides the scan control buttons."""
138
+ self.button_run_scan.setVisible(show)
139
+ self.button_stop_scan.setVisible(show)
140
+
141
+ show_group = show or self.button_run_scan.isVisible()
142
+ self.scan_selection_group.setVisible(show_group)
143
+
144
+ @Property(bool)
145
+ def hide_scan_selection_combobox(self):
146
+ return not self.comboBox_scan_selection.isVisible()
147
+
148
+ @hide_scan_selection_combobox.setter
149
+ def hide_scan_selection_combobox(self, hide: bool):
150
+ self.show_scan_selection_combobox(not hide)
151
+
152
+ @Slot(bool)
153
+ def show_scan_selection_combobox(self, show: bool):
154
+ """Shows or hides the scan selection combobox."""
155
+ self.comboBox_scan_selection.setVisible(show)
156
+
157
+ show_group = show or self.button_run_scan.isVisible()
158
+ self.scan_selection_group.setVisible(show_group)
159
+
160
+ @Slot(str)
161
+ def scan_select(self, scan_name: str):
162
+ """
163
+ Slot for scan selection. Updates the scan control layout based on the selected scan.
164
+
165
+ Args:
166
+ scan_name(str): Name of the selected scan.
167
+ """
168
+ self.reset_layout()
169
+ selected_scan_info = self.available_scans.get(scan_name, {})
112
170
 
113
171
  gui_config = selected_scan_info.get("gui_config", {})
114
172
  self.arg_group = gui_config.get("arg_group", None)
115
173
  self.kwarg_groups = gui_config.get("kwarg_groups", None)
116
174
 
117
- if self.arg_box is None:
118
- self.button_add_bundle.setEnabled(False)
119
- self.button_remove_bundle.setEnabled(False)
175
+ show_bundle_buttons = bool(self.arg_group["arg_inputs"])
176
+
177
+ self.button_add_bundle.setVisible(show_bundle_buttons)
178
+ self.button_remove_bundle.setVisible(show_bundle_buttons)
120
179
 
121
- if len(self.arg_group["arg_inputs"]) > 0:
122
- self.button_add_bundle.setEnabled(True)
123
- self.button_remove_bundle.setEnabled(True)
180
+ if show_bundle_buttons:
124
181
  self.add_arg_group(self.arg_group)
125
182
  if len(self.kwarg_groups) > 0:
126
183
  self.add_kwargs_boxes(self.kwarg_groups)
@@ -151,9 +208,11 @@ class ScanControl(BECWidget, QWidget):
151
208
  self.arg_box.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
152
209
  self.layout.addWidget(self.arg_box)
153
210
 
211
+ @Slot()
154
212
  def add_arg_bundle(self):
155
213
  self.arg_box.add_widget_bundle()
156
214
 
215
+ @Slot()
157
216
  def remove_arg_bundle(self):
158
217
  self.arg_box.remove_widget_bundle()
159
218
 
@@ -172,7 +231,9 @@ class ScanControl(BECWidget, QWidget):
172
231
  box.deleteLater()
173
232
  self.kwarg_boxes = []
174
233
 
234
+ @Slot()
175
235
  def run_scan(self):
236
+ self.scan_started.emit()
176
237
  args = []
177
238
  kwargs = {}
178
239
  if self.arg_box is not None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.95.1
3
+ Version: 0.96.0
4
4
  Summary: BEC Widgets
5
5
  Project-URL: Bug Tracker, https://gitlab.psi.ch/bec/bec_widgets/issues
6
6
  Project-URL: Homepage, https://gitlab.psi.ch/bec/bec_widgets
@@ -2,11 +2,11 @@
2
2
  .gitlab-ci.yml,sha256=BtKhZI3dhK09En1BfpglYi-ZJwG6ZdC-iJr7kXFVfCg,8346
3
3
  .pylintrc,sha256=eeY8YwSI74oFfq6IYIbCqnx3Vk8ZncKaatv96n_Y8Rs,18544
4
4
  .readthedocs.yaml,sha256=aSOc277LqXcsTI6lgvm_JY80lMlr69GbPKgivua2cS0,603
5
- CHANGELOG.md,sha256=fG-xnuzKLzH0m71vhqcb8WPat38owyxfhx9KE5gJzVg,6787
5
+ CHANGELOG.md,sha256=cn9vMVxfaE1aginGiTCdUyQqJGCeFJ8LjFsmXsuI8Gg,6733
6
6
  LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
7
- PKG-INFO,sha256=LfNoUqnLb3yWVkPszaOR7AxQJiHoryDrodbow5LQzHY,1325
7
+ PKG-INFO,sha256=wPwVfj4xSkopVoH2p_P6HnIWGsIpRruwbtMoyn-TEW0,1325
8
8
  README.md,sha256=Od69x-RS85Hph0-WwWACwal4yUd67XkEn4APEfHhHFw,2649
9
- pyproject.toml,sha256=4RUSw-USwHLp_gv-hNEjAcfTVt0Z4GoGDHW6Qlcs4Es,2416
9
+ pyproject.toml,sha256=K2NOh1jWSsA8Lu9cm-ed-LPb1LoORhaFvSNJcmFGcy4,2416
10
10
  .git_hooks/pre-commit,sha256=n3RofIZHJl8zfJJIUomcMyYGFi_rwq4CC19z0snz3FI,286
11
11
  .gitlab/issue_templates/bug_report_template.md,sha256=gAuyEwl7XlnebBrkiJ9AqffSNOywmr8vygUFWKTuQeI,386
12
12
  .gitlab/issue_templates/documentation_update_template.md,sha256=FHLdb3TS_D9aL4CYZCjyXSulbaW5mrN2CmwTaeLPbNw,860
@@ -211,7 +211,7 @@ bec_widgets/widgets/ring_progress_bar/ring_progress_bar.pyproject,sha256=ZNYDnKD
211
211
  bec_widgets/widgets/ring_progress_bar/ring_progress_bar_plugin.py,sha256=f6eAuDEvmnl0gy-cBwUkuUS4yr1VGjVEa40N5MIXwF0,1511
212
212
  bec_widgets/widgets/scan_control/__init__.py,sha256=IOfHl15vxb_uC6KN62-PeUzbBha_vQyqkkXbJ2HU674,38
213
213
  bec_widgets/widgets/scan_control/register_scan_control.py,sha256=xUX2yR0-MaIMg9_y9qe50yDDphzsh2x1b5PMrF90yPM,475
214
- bec_widgets/widgets/scan_control/scan_control.py,sha256=YT3Vvy27_FY3UY7IXvy87o9ZB_syauuEKzkJFOpbP4s,7610
214
+ bec_widgets/widgets/scan_control/scan_control.py,sha256=30pcaVaBVo6JxJuMH1ul1s-sPuWqCUKsUQ-XfAgzRZ8,9384
215
215
  bec_widgets/widgets/scan_control/scan_control.pyproject,sha256=eTgVDFKToIH8_BbJjM2RvbOLr7HnYoidX0SAHx640DM,30
216
216
  bec_widgets/widgets/scan_control/scan_control_plugin.py,sha256=t3_qTACqYcvl_Wr102bIdVDyw6uNK1B94fh_wjs-lxg,1477
217
217
  bec_widgets/widgets/scan_control/scan_group_box.py,sha256=BpX9ZphqOhdEbQnGzNeNlmuZsMS__U97CkBMical2FY,9300
@@ -329,8 +329,9 @@ docs/user/widgets/positioner_box/positioner_box.md,sha256=voOU_wfwd-qBykk-60PWoO
329
329
  docs/user/widgets/progress_bar/progress_bar.gif,sha256=5jh0Zw2BBGPuNxszV1DBLJCb4_6glIRX-U2ABjnsK2k,5263592
330
330
  docs/user/widgets/progress_bar/ring_progress_bar.md,sha256=F9q2UrwZWwNzbjs1ONfSgP1dqgb5dx8AbOoTZOJGzWA,3705
331
331
  docs/user/widgets/queue/queue.md,sha256=Re37dp_YHTa9N6TTobScO_n3Fniq2_Ca2Ms3DOb0suA,2110
332
+ docs/user/widgets/scan_control/hide_scan_control.png,sha256=juhkTBdz-WnJfPhj6UEkOiiCD6HfTinoETokF20nhsA,21890
332
333
  docs/user/widgets/scan_control/scan_control.gif,sha256=zrVOZgleMbu7Jd8AAIn2fQ08tNAEMSud3g0ZLyNUcjQ,1506739
333
- docs/user/widgets/scan_control/scan_control.md,sha256=7czdukW_C76st9tWr85tnNUi0Z-WsKfaYKrr37Vp8n8,2545
334
+ docs/user/widgets/scan_control/scan_control.md,sha256=4pMTZJHx9VMYgEVGG_ybiJxwNbdQqAqa_dvM6lz0LMs,3275
334
335
  docs/user/widgets/spinner/spinner.md,sha256=MN7LeAkNOqRZ_A6c4PGv6KsiGbjm7Q-nkGkL5CcxOeE,2465
335
336
  docs/user/widgets/text_box/text_box.md,sha256=u8UoApmnH3LilWUQ73ASd6ts0FQfM6eRqg3GG9iQhOc,2508
336
337
  docs/user/widgets/toggle/toggle.md,sha256=vmhqbTU93R9DUeR0a85gGIRPc07cSl3_vtsVN4r0yO0,2983
@@ -398,8 +399,8 @@ tests/unit_tests/test_configs/config_device_no_entry.yaml,sha256=hdvue9KLc_kfNzG
398
399
  tests/unit_tests/test_configs/config_scan.yaml,sha256=vo484BbWOjA_e-h6bTjSV9k7QaQHrlAvx-z8wtY-P4E,1915
399
400
  tests/unit_tests/test_msgs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
400
401
  tests/unit_tests/test_msgs/available_scans_message.py,sha256=m_z97hIrjHXXMa2Ex-UvsPmTxOYXfjxyJaGkIY6StTY,46532
401
- bec_widgets-0.95.1.dist-info/METADATA,sha256=LfNoUqnLb3yWVkPszaOR7AxQJiHoryDrodbow5LQzHY,1325
402
- bec_widgets-0.95.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
403
- bec_widgets-0.95.1.dist-info/entry_points.txt,sha256=3otEkCdDB9LZJuBLzG4pFLK5Di0CVybN_12IsZrQ-58,166
404
- bec_widgets-0.95.1.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
405
- bec_widgets-0.95.1.dist-info/RECORD,,
402
+ bec_widgets-0.96.0.dist-info/METADATA,sha256=wPwVfj4xSkopVoH2p_P6HnIWGsIpRruwbtMoyn-TEW0,1325
403
+ bec_widgets-0.96.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
404
+ bec_widgets-0.96.0.dist-info/entry_points.txt,sha256=3otEkCdDB9LZJuBLzG4pFLK5Di0CVybN_12IsZrQ-58,166
405
+ bec_widgets-0.96.0.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
406
+ bec_widgets-0.96.0.dist-info/RECORD,,
@@ -23,11 +23,19 @@ By default, this widget supports scans that are derived from the following base
23
23
  The full procedure how to design `gui_config` for your custom scan class is described in the [Scan GUI Configuration](https://bec.readthedocs.io/en/latest/developer/scans/scan_gui_config.html) tutorial.
24
24
  ```
25
25
 
26
+ ## BECDesigner Customization
27
+ Within the BECDesigner's [property editor](https://doc.qt.io/qt-6/designer-widget-mode.html#the-property-editor/), the `ScanControl` widget can be customized to suit your application's requirements. The widget provides the following customization options:
28
+ - **Hide Scan Control**: Allows you to hide the scan control buttons from the widget interface. This is useful when you want to place the control buttons in a different location.
29
+ - **Hide Scan Selection**: Allows you to hide the scan selection combobox from the widget interface. This is useful when you want to restrict the user to a specific scan type or implement a custom scan selection mechanism.
30
+
31
+ ```{figure} ./hide_scan_control.png
32
+ ```
33
+
26
34
  ````
27
35
 
28
36
  ````{tab} Examples
29
37
 
30
- The `ScanControl` widget can be integrated within a [`BECDockArea`](user.widgets.bec_dock_area) or used as an individual component in your application through `QtDesigner`. Below are examples demonstrating how to create and use the `ScanControl` widget.
38
+ The `ScanControl` widget can be integrated within a [`BECDockArea`](user.widgets.bec_dock_area) or used as an individual component in your application through `BECDesigner`. Below are examples demonstrating how to create and use the `ScanControl` widget.
31
39
 
32
40
  ## Example 1 - Adding Scan Control Widget to BECDockArea
33
41
 
pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bec_widgets"
7
- version = "0.95.1"
7
+ version = "0.96.0"
8
8
  description = "BEC Widgets"
9
9
  requires-python = ">=3.10"
10
10
  classifiers = [