bec-widgets 0.60.0__py3-none-any.whl → 0.61.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
@@ -2,6 +2,17 @@
2
2
 
3
3
 
4
4
 
5
+ ## v0.61.0 (2024-06-12)
6
+
7
+ ### Feature
8
+
9
+ * feat(widgets/stop_button): General stop button added ([`61ba08d`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/61ba08d0b8df9f48f5c54c7c2b4e6d395206e7e6))
10
+
11
+ ### Refactor
12
+
13
+ * refactor: improve labe of auto_update script ([`40b5688`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/40b568815893cd41af3531bb2e647ca1e2e315f4))
14
+
15
+
5
16
  ## v0.60.0 (2024-06-08)
6
17
 
7
18
  ### Ci
@@ -150,11 +161,3 @@
150
161
  ### Documentation
151
162
 
152
163
  * docs(bar): docs updated ([`4be0d14`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/4be0d14b7445c2322c2aef86257db168a841265c))
153
-
154
- ### Fix
155
-
156
- * fix(ring): automatic updates are disabled uf user specify updates manually with .set_update; 'scan_progres' do not reset number of rings ([`e883dba`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/e883dbad814dbcc0a19c341041c6d836e58a5918))
157
-
158
- * fix(ring): enable_auto_updates(True) do not reset properties of already setup bars ([`a2abad3`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/a2abad344f4c0039516eb60a825afb6822c5b19a))
159
-
160
- * fix(ring): set_min_max accepts floats ([`d44b1cf`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/d44b1cf8b107cf02deedd9154b77d01c7f9ed05d))
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.60.0
3
+ Version: 0.61.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
@@ -118,7 +118,7 @@ class AutoUpdates:
118
118
  if not dev_y:
119
119
  return
120
120
  fig.clear_all()
121
- plt = fig.plot(x_name=dev_x, y_name=dev_y)
121
+ plt = fig.plot(x_name=dev_x, y_name=dev_y, label=f"Scan {info.scan_number} - {dev_y}")
122
122
  plt.set(title=f"Scan {info.scan_number}", x_label=dev_x, y_label=dev_y)
123
123
 
124
124
  def simple_grid_scan(self, info: ScanInfo) -> None:
@@ -132,7 +132,9 @@ class AutoUpdates:
132
132
  dev_y = info.scan_report_devices[1]
133
133
  dev_z = self.get_selected_device(info.monitored_devices, self.gui.selected_device)
134
134
  fig.clear_all()
135
- plt = fig.plot(x_name=dev_x, y_name=dev_y, z_name=dev_z, label=f"Scan {info.scan_number}")
135
+ plt = fig.plot(
136
+ x_name=dev_x, y_name=dev_y, z_name=dev_z, label=f"Scan {info.scan_number} - {dev_z}"
137
+ )
136
138
  plt.set(title=f"Scan {info.scan_number}", x_label=dev_x, y_label=dev_y)
137
139
 
138
140
  def best_effort(self, info: ScanInfo) -> None:
@@ -147,5 +149,5 @@ class AutoUpdates:
147
149
  if not dev_y:
148
150
  return
149
151
  fig.clear_all()
150
- plt = fig.plot(x_name=dev_x, y_name=dev_y, label=f"Scan {info.scan_number}")
152
+ plt = fig.plot(x_name=dev_x, y_name=dev_y, label=f"Scan {info.scan_number} - {dev_y}")
151
153
  plt.set(title=f"Scan {info.scan_number}", x_label=dev_x, y_label=dev_y)
@@ -1,3 +1,4 @@
1
+ from .buttons import StopButton
1
2
  from .dock import BECDock, BECDockArea
2
3
  from .figure import BECFigure, FigureConfig
3
4
  from .scan_control import ScanControl
@@ -0,0 +1 @@
1
+ from .stop_button.stop_button import StopButton
File without changes
@@ -0,0 +1,32 @@
1
+ from qtpy.QtWidgets import QPushButton
2
+
3
+ from bec_widgets.utils import BECConnector
4
+
5
+
6
+ class StopButton(BECConnector, QPushButton):
7
+ """A button that stops the current scan."""
8
+
9
+ def __init__(self, parent=None, client=None, config=None, gui_id=None):
10
+ super().__init__(client=client, config=config, gui_id=gui_id)
11
+ QPushButton.__init__(self, parent=parent)
12
+
13
+ self.get_bec_shortcuts()
14
+ self.setText("Stop")
15
+ self.setStyleSheet("background-color: #cc181e; color: white")
16
+ self.clicked.connect(self.stop_scan)
17
+
18
+ def stop_scan(self):
19
+ """Stop the scan."""
20
+ self.queue.request_scan_abortion()
21
+ self.queue.request_queue_reset()
22
+
23
+
24
+ if __name__ == "__main__": # pragma: no cover
25
+ import sys
26
+
27
+ from qtpy.QtWidgets import QApplication
28
+
29
+ app = QApplication(sys.argv)
30
+ widget = StopButton()
31
+ widget.show()
32
+ sys.exit(app.exec_())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.60.0
3
+ Version: 0.61.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=3PU2LONUl10zIOD4UCPQgA6vVBtniabww1MQkTMce7I,7995
3
3
  .pylintrc,sha256=OstrgmEyP0smNFBKoIN5_26-UmNZgMHnbjvAWX0UrLs,18535
4
4
  .readthedocs.yaml,sha256=aSOc277LqXcsTI6lgvm_JY80lMlr69GbPKgivua2cS0,603
5
- CHANGELOG.md,sha256=ZN4q7ZllSvFOCrwCteZ0uSJr8Vc-QC8kRNdGvSjpZ8I,7022
5
+ CHANGELOG.md,sha256=M5IR-g_0B-sq_qGAYP4A8BReh6U9HcGKxeAmMGGjPHs,6792
6
6
  LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
7
- PKG-INFO,sha256=yKloOHaV8JrHipEfMkYVLZIxQU0ZvqeqXjK5kCd_2-g,1302
7
+ PKG-INFO,sha256=nwiL8DuDWzYjWMcR_JGIZL2uTa8UFyC-NfJHBKxSpEI,1302
8
8
  README.md,sha256=y4jB6wvArS7N8_iTbKWnSM_oRAqLA2GqgzUR-FMh5sU,2645
9
- pyproject.toml,sha256=lGx8dV1vE3NBrjHIHggomwMZw4LX26QN-CKc5N2-CFE,2115
9
+ pyproject.toml,sha256=itvsOSpNTbXMXrClzMA00l9i7ATGsAqrSifK5IB2u5I,2115
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
@@ -16,7 +16,7 @@ bec_widgets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  bec_widgets/assets/bec_widgets_icon.png,sha256=K8dgGwIjalDh9PRHUsSQBqgdX7a00nM3igZdc20pkYM,1747017
17
17
  bec_widgets/assets/terminal_icon.png,sha256=bJl7Tft4Fi2uxvuXI8o14uMHnI9eAWKSU2uftXCH9ws,3889
18
18
  bec_widgets/cli/__init__.py,sha256=d0Q6Fn44e7wFfLabDOBxpcJ1DPKWlFunGYDUBmO-4hA,22
19
- bec_widgets/cli/auto_updates.py,sha256=0sd7HiqOMn1jCbgVG3-H1nmQgdOMRwSjx6FAvdtVf1k,4747
19
+ bec_widgets/cli/auto_updates.py,sha256=DyBV3HnjMSH-cvVkYNcDiYKVf0Xut4Qy2qGQqkW47Bw,4833
20
20
  bec_widgets/cli/client.py,sha256=6mzmRe_pjuz-3CoBJZkxaa05VzAmPLi_cDJ3uljmw8Y,54363
21
21
  bec_widgets/cli/client_utils.py,sha256=7u8P9EYgLPJuAcHxnFiZi-gCZohO3vAn0W7dqsSrs4M,10660
22
22
  bec_widgets/cli/generate_cli.py,sha256=DIaGz7nhwef3ebIaP4LtiUC3q7MoM1swJ_e0SgAO2jo,6901
@@ -46,7 +46,10 @@ bec_widgets/utils/ui_loader.py,sha256=5NktcP1r1HQub7K82fW_jkj8rT2cqJQdMvDxwToLY4
46
46
  bec_widgets/utils/validator_delegate.py,sha256=Emj1WF6W8Ke1ruBWUfmHdVJpmOSPezuOt4zvQTay_44,442
47
47
  bec_widgets/utils/widget_io.py,sha256=f36198CvT_EzWQ_cg2G-4tRRsaMdJ3yVqsZWKJCQEfA,10880
48
48
  bec_widgets/utils/yaml_dialog.py,sha256=cMVif-39SB9WjwGH5FWBJcFs4tnfFJFs5cacydRyhy0,1853
49
- bec_widgets/widgets/__init__.py,sha256=LKgIuY3CI-NHCa_bY9pThYhxLH0MHDo8iNEJDDVIVmw,172
49
+ bec_widgets/widgets/__init__.py,sha256=2GykeIg8_dqly6ZYny8HC7OGNpmafXXV3WN61vYGvzk,204
50
+ bec_widgets/widgets/buttons/__init__.py,sha256=74ucIRU6-anoqQ-zT7wbrysmxhg_3_04xGhN_kllNUI,48
51
+ bec_widgets/widgets/buttons/stop_button/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
+ bec_widgets/widgets/buttons/stop_button/stop_button.py,sha256=x4a7RvlMkHzOd05zKOGYkyTmBza7Me7jgOL9WIgA_c4,906
50
53
  bec_widgets/widgets/dock/__init__.py,sha256=B7foHt02gnhM7mFksa7GJVwT7n0j_JvYDCt6wc6XR5g,61
51
54
  bec_widgets/widgets/dock/dock.py,sha256=WPanKj6nodVP6PiEFkRTCj5Lf0pUupmM7i-5qZA_ATY,7596
52
55
  bec_widgets/widgets/dock/dock_area.py,sha256=9c_tLzyBRllLfc4H5o9-4bvasWp5hWe1NWg4mupXVtU,7911
@@ -118,6 +121,7 @@ docs/user/getting_started/installation.md,sha256=nBl2Hfvo6ua3-tVZn1B-UG0hCTlrFY6
118
121
  docs/user/getting_started/quick_start.md,sha256=VGU880GwamcIZcBE8tjxuqX2syE-71jqZedtskCoBbA,9405
119
122
  docs/user/widgets/BECFigure.png,sha256=8dQr4u0uk_y0VV-R1Jh9yTR3Vidd9HDEno_07R0swaE,1605920
120
123
  docs/user/widgets/bec_figure.md,sha256=BwcumbhZd6a2zKmoHTvwKr8kG8WxBx9lS_QwxNiBMpQ,5155
124
+ docs/user/widgets/buttons.md,sha256=SKxhLsu_gquNSG-zMAzVzz2d6bUwtZ9y259ILoMyCu0,1214
121
125
  docs/user/widgets/image_plot.gif,sha256=_mVFhMTXGqwDOcEtrBHMZj5Thn2sLhDAHEeL2XyHN-s,14098977
122
126
  docs/user/widgets/motor.gif,sha256=FtaWdRHx4UZaGJPpq8LNhMMgX4PFcAB6IZ93JCMEh_w,2280719
123
127
  docs/user/widgets/progress_bar.gif,sha256=5jh0Zw2BBGPuNxszV1DBLJCb4_6glIRX-U2ABjnsK2k,5263592
@@ -125,11 +129,11 @@ docs/user/widgets/scatter_2D.gif,sha256=yHpsuAUseMafJjI_J5BcOhmE3nu9VFn_Xm9XHzJa
125
129
  docs/user/widgets/spiral_progress_bar.md,sha256=QTgUDIl6XPuK_HwSfB6sNijZ4bss26biDg6B_mJ8Pxk,2208
126
130
  docs/user/widgets/w1D.gif,sha256=tuHbleJpl6bJFNNC2OdndF5LF7IyfvlkFCMGZajrQPs,622773
127
131
  docs/user/widgets/website.md,sha256=wfudAupdtHX-Sfritg0xMWXZLLczJ4XwMLNWvu6ww-w,705
128
- docs/user/widgets/widgets.md,sha256=05D8R97KU84vz64G_Rm8Uu8nXy098ZRkMhNG8-Lc8Ng,361
132
+ docs/user/widgets/widgets.md,sha256=EfrElcZVh9jHt_0kIXdDtc7z3ErYGqwmVMxC_AHSGU0,370
129
133
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
130
134
  tests/end-2-end/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
131
135
  tests/end-2-end/conftest.py,sha256=taLqiYVzOhJjMre5ypgQjB7wzSXP4soKANW3XfAjems,1773
132
- tests/end-2-end/test_bec_dock_rpc_e2e.py,sha256=G-YBfOhJCyV6g74mxXuhAPA9E_BPQ6EUT6xS278aq34,8865
136
+ tests/end-2-end/test_bec_dock_rpc_e2e.py,sha256=8iJz4lITspY7eHdSgy9YvGUGTu3fsSperoVGBvTGT0U,9067
133
137
  tests/end-2-end/test_bec_figure_rpc_e2e.py,sha256=zTbB_F4Fs-QG8KhMK24xfsrCQBgZUAguMk3KFdEdP2o,5095
134
138
  tests/end-2-end/test_rpc_register_e2e.py,sha256=3dfCnSvdcRO92pzHt9WlCTK0vzTKAvPtliEoEKrtuzQ,1604
135
139
  tests/unit_tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -149,6 +153,7 @@ tests/unit_tests/test_plot_base.py,sha256=bOdlgAxh9oKk5PwiQ_MSFmzr44uJ61Tlg242RC
149
153
  tests/unit_tests/test_rpc_register.py,sha256=hECjZEimd440mwRrO0rg7L3PKN7__3DgjmESN6wx3bo,1179
150
154
  tests/unit_tests/test_scan_control.py,sha256=7dtGpE0g4FqUhhQeCkyJl-9o7NH3DFZJgEaqDmBYbBc,7551
151
155
  tests/unit_tests/test_spiral_progress_bar.py,sha256=yak3N9-TmEM3lQZPSROL4cAx9mior__se1XADlMScks,12418
156
+ tests/unit_tests/test_stop_button.py,sha256=hOoWO0emkvd5bR_EExxCnKsiZgXKqf_uIGTwzWLxhDw,704
152
157
  tests/unit_tests/test_waveform1d.py,sha256=j9-CCE0BkFVI3Gnv8pjV1gc9HwA5PYG0_ox1oZ60F6w,15272
153
158
  tests/unit_tests/test_website_widget.py,sha256=fBADIJJBAHU4Ro7u95kdemFVNv196UOcuO9oLHuHt8A,761
154
159
  tests/unit_tests/test_widget_io.py,sha256=FeL3ZYSBQnRt6jxj8VGYw1cmcicRQyHKleahw7XIyR0,3475
@@ -158,8 +163,8 @@ tests/unit_tests/test_configs/config_device_no_entry.yaml,sha256=hdvue9KLc_kfNzG
158
163
  tests/unit_tests/test_configs/config_scan.yaml,sha256=vo484BbWOjA_e-h6bTjSV9k7QaQHrlAvx-z8wtY-P4E,1915
159
164
  tests/unit_tests/test_msgs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
160
165
  tests/unit_tests/test_msgs/available_scans_message.py,sha256=m_z97hIrjHXXMa2Ex-UvsPmTxOYXfjxyJaGkIY6StTY,46532
161
- bec_widgets-0.60.0.dist-info/METADATA,sha256=yKloOHaV8JrHipEfMkYVLZIxQU0ZvqeqXjK5kCd_2-g,1302
162
- bec_widgets-0.60.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
163
- bec_widgets-0.60.0.dist-info/entry_points.txt,sha256=80s2YKCNziN2ROUYbpDRyEmiejMf_dshmiYCdN7qNsU,70
164
- bec_widgets-0.60.0.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
165
- bec_widgets-0.60.0.dist-info/RECORD,,
166
+ bec_widgets-0.61.0.dist-info/METADATA,sha256=nwiL8DuDWzYjWMcR_JGIZL2uTa8UFyC-NfJHBKxSpEI,1302
167
+ bec_widgets-0.61.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
168
+ bec_widgets-0.61.0.dist-info/entry_points.txt,sha256=80s2YKCNziN2ROUYbpDRyEmiejMf_dshmiYCdN7qNsU,70
169
+ bec_widgets-0.61.0.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
170
+ bec_widgets-0.61.0.dist-info/RECORD,,
@@ -0,0 +1,38 @@
1
+ (user.widgets.buttons)=
2
+
3
+ # Buttons Widgets
4
+
5
+ This section consolidates various custom buttons used within the BEC GUIs, facilitating the integration of these
6
+ controls into different layouts.
7
+
8
+ ## Stop Button
9
+
10
+ **Purpose:**
11
+
12
+ The `Stop Button` provides a user interface control to immediately halt the execution of the current operation in the
13
+ BEC Client. It is designed for easy integration into any BEC GUI layout.
14
+
15
+ **Key Features:**
16
+
17
+ - **Immediate Termination:** Halts the execution of the current script or process.
18
+ - **Queue Management:** Clears any pending operations in the scan queue, ensuring the system is ready for new tasks.
19
+
20
+ **Code example:**
21
+
22
+ Integrating the `StopButton` into a BEC GUI layout is straightforward. The following example demonstrates how to embed
23
+ a `StopButton` within a GUI layout:
24
+
25
+ ```python
26
+ from qtpy.QtWidgets import QWidget, QVBoxLayout
27
+ from bec_widgets.widgets import StopButton
28
+
29
+
30
+ class MyGui(QWidget):
31
+ def __init__(self):
32
+ super().__init__()
33
+ self.setLayout(QVBoxLayout(self)) # Initialize the layout for the widget
34
+
35
+ # Create and add the StopButton to the layout
36
+ self.stop_button = StopButton()
37
+ self.layout().addWidget(self.stop_button)
38
+ ```
@@ -11,6 +11,7 @@ hidden: false
11
11
  bec_figure/
12
12
  spiral_progress_bar/
13
13
  website/
14
+ buttons/
14
15
  ```
15
16
 
16
17
 
pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bec_widgets"
7
- version = "0.60.0"
7
+ version = "0.61.0"
8
8
  description = "BEC Widgets"
9
9
  requires-python = ">=3.10"
10
10
  classifiers = [
@@ -253,8 +253,14 @@ def test_auto_update(bec_client_lib, rpc_server_dock):
253
253
  plt_data = widgets[0].get_all_data()
254
254
 
255
255
  # check plotted data
256
- assert plt_data["bpm4i-bpm4i"]["x"] == last_scan_data["samx"]["samx"].val
257
- assert plt_data["bpm4i-bpm4i"]["y"] == last_scan_data["bpm4i"]["bpm4i"].val
256
+ assert (
257
+ plt_data[f"Scan {status.scan.scan_number} - bpm4i"]["x"]
258
+ == last_scan_data["samx"]["samx"].val
259
+ )
260
+ assert (
261
+ plt_data[f"Scan {status.scan.scan_number} - bpm4i"]["y"]
262
+ == last_scan_data["bpm4i"]["bpm4i"].val
263
+ )
258
264
 
259
265
  status = scans.grid_scan(
260
266
  dev.samx, -10, 10, 5, dev.samy, -5, 5, 5, exp_time=0.05, relative=False
@@ -268,5 +274,11 @@ def test_auto_update(bec_client_lib, rpc_server_dock):
268
274
  last_scan_data = queue.scan_storage.storage[-1].data
269
275
 
270
276
  # check plotted data
271
- assert plt_data[f"Scan {status.scan.scan_number}"]["x"] == last_scan_data["samx"]["samx"].val
272
- assert plt_data[f"Scan {status.scan.scan_number}"]["y"] == last_scan_data["samy"]["samy"].val
277
+ assert (
278
+ plt_data[f"Scan {status.scan.scan_number} - {dock.selected_device}"]["x"]
279
+ == last_scan_data["samx"]["samx"].val
280
+ )
281
+ assert (
282
+ plt_data[f"Scan {status.scan.scan_number} - {dock.selected_device}"]["y"]
283
+ == last_scan_data["samy"]["samy"].val
284
+ )
@@ -0,0 +1,25 @@
1
+ # pylint: disable=missing-function-docstring, missing-module-docstring, unused-import
2
+
3
+ import pytest
4
+
5
+ from bec_widgets.widgets import StopButton
6
+
7
+ from .client_mocks import mocked_client
8
+
9
+
10
+ @pytest.fixture
11
+ def stop_button(qtbot, mocked_client):
12
+ widget = StopButton(client=mocked_client)
13
+ qtbot.addWidget(widget)
14
+ qtbot.waitExposed(widget)
15
+ yield widget
16
+ widget.close()
17
+
18
+
19
+ def test_stop_button(stop_button):
20
+ assert stop_button.text() == "Stop"
21
+ assert stop_button.styleSheet() == "background-color: #cc181e; color: white"
22
+ stop_button.click()
23
+ assert stop_button.queue.request_scan_abortion.called
24
+ assert stop_button.queue.request_queue_reset.called
25
+ stop_button.close()