bec-widgets 1.21.0__py3-none-any.whl → 1.21.2__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,6 +1,22 @@
1
1
  # CHANGELOG
2
2
 
3
3
 
4
+ ## v1.21.2 (2025-02-18)
5
+
6
+ ### Bug Fixes
7
+
8
+ - **client_utils**: Autoupdate has correct propagation of BECDockArea to plugin repos
9
+ ([`056731c`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/056731c9add7d92f7da7fa833343cf65e8f383a8))
10
+
11
+
12
+ ## v1.21.1 (2025-02-17)
13
+
14
+ ### Bug Fixes
15
+
16
+ - **bec_connector**: Workers stored in reference to not be cleaned up with garbage collector
17
+ ([`383936f`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/383936ffc2bd7d2e088d3367c76b14efa3d1732c))
18
+
19
+
4
20
  ## v1.21.0 (2025-02-17)
5
21
 
6
22
  ### Features
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bec_widgets
3
- Version: 1.21.0
3
+ Version: 1.21.2
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
@@ -16,7 +16,7 @@ Requires-Dist: black~=24.0
16
16
  Requires-Dist: isort>=5.13.2,~=5.13
17
17
  Requires-Dist: pydantic~=2.0
18
18
  Requires-Dist: pyqtgraph~=0.13
19
- Requires-Dist: pyside6==6.7.2
19
+ Requires-Dist: pyside6>=6.8
20
20
  Requires-Dist: pyte
21
21
  Requires-Dist: qtconsole>=5.5.1,~=5.5
22
22
  Requires-Dist: qtpy~=2.4
@@ -199,7 +199,7 @@ class BECGuiClient(RPCBase):
199
199
  # if the module is not found, we skip it
200
200
  if spec is None:
201
201
  continue
202
- return ep.load()(gui=self)
202
+ return ep.load()(gui=self._top_level["main"].widget)
203
203
  except Exception as e:
204
204
  logger.error(f"Error loading auto update script from plugin: {str(e)}")
205
205
  return None
@@ -111,7 +111,7 @@ class BECConnector:
111
111
 
112
112
  # register widget to rpc register
113
113
  # be careful: when registering, and the object is not a BECWidget,
114
- # cleanup has to called manually since there is no 'closeEvent'
114
+ # cleanup has to be called manually since there is no 'closeEvent'
115
115
  self.rpc_register = RPCRegister()
116
116
  self.rpc_register.add_rpc(self)
117
117
 
@@ -119,6 +119,8 @@ class BECConnector:
119
119
  self.error_utility = ErrorPopupUtility()
120
120
 
121
121
  self._thread_pool = QThreadPool.globalInstance()
122
+ # Store references to running workers so they're not garbage collected prematurely.
123
+ self._workers = []
122
124
 
123
125
  def submit_task(self, fn, *args, on_complete: pyqtSlot = None, **kwargs) -> Worker:
124
126
  """
@@ -147,11 +149,14 @@ class BECConnector:
147
149
  >>> def on_complete():
148
150
  >>> print("Task complete")
149
151
  >>> self.submit_task(my_function, 1, 2, on_complete=on_complete)
150
-
151
152
  """
152
153
  worker = Worker(fn, *args, **kwargs)
153
154
  if on_complete:
154
155
  worker.signals.completed.connect(on_complete)
156
+ # Keep a reference to the worker so it is not garbage collected.
157
+ self._workers.append(worker)
158
+ # When the worker is done, remove it from our list.
159
+ worker.signals.completed.connect(lambda: self._workers.remove(worker))
155
160
  self._thread_pool.start(worker)
156
161
  return worker
157
162
 
@@ -183,10 +188,10 @@ class BECConnector:
183
188
  @_config_dict.setter
184
189
  def _config_dict(self, config: BaseModel) -> None:
185
190
  """
186
- Get the configuration of the widget.
191
+ Set the configuration of the widget.
187
192
 
188
- Returns:
189
- dict: The configuration of the widget.
193
+ Args:
194
+ config (BaseModel): The new configuration model.
190
195
  """
191
196
  self.config = config
192
197
 
@@ -195,8 +200,8 @@ class BECConnector:
195
200
  Apply the configuration to the widget.
196
201
 
197
202
  Args:
198
- config(dict): Configuration settings.
199
- generate_new_id(bool): If True, generate a new GUI ID for the widget.
203
+ config (dict): Configuration settings.
204
+ generate_new_id (bool): If True, generate a new GUI ID for the widget.
200
205
  """
201
206
  self.config = ConnectionConfig(**config)
202
207
  if generate_new_id is True:
@@ -212,8 +217,8 @@ class BECConnector:
212
217
  Load the configuration of the widget from YAML.
213
218
 
214
219
  Args:
215
- path(str): Path to the configuration file for non-GUI dialog mode.
216
- gui(bool): If True, use the GUI dialog to load the configuration file.
220
+ path (str | None): Path to the configuration file for non-GUI dialog mode.
221
+ gui (bool): If True, use the GUI dialog to load the configuration file.
217
222
  """
218
223
  if gui is True:
219
224
  config = load_yaml_gui(self)
@@ -232,8 +237,8 @@ class BECConnector:
232
237
  Save the configuration of the widget to YAML.
233
238
 
234
239
  Args:
235
- path(str): Path to save the configuration file for non-GUI dialog mode.
236
- gui(bool): If True, use the GUI dialog to save the configuration file.
240
+ path (str | None): Path to save the configuration file for non-GUI dialog mode.
241
+ gui (bool): If True, use the GUI dialog to save the configuration file.
237
242
  """
238
243
  if gui is True:
239
244
  save_yaml_gui(self, self._config_dict)
@@ -241,7 +246,6 @@ class BECConnector:
241
246
  if path is None:
242
247
  path = os.getcwd()
243
248
  file_path = os.path.join(path, f"{self.__class__.__name__}_config.yaml")
244
-
245
249
  save_yaml(file_path, self._config_dict)
246
250
 
247
251
  @pyqtSlot(str)
@@ -250,7 +254,7 @@ class BECConnector:
250
254
  Set the GUI ID for the widget.
251
255
 
252
256
  Args:
253
- gui_id(str): GUI ID
257
+ gui_id (str): GUI ID.
254
258
  """
255
259
  self.config.gui_id = gui_id
256
260
  self.gui_id = gui_id
@@ -271,7 +275,7 @@ class BECConnector:
271
275
  """Update the client and device manager from BEC and create object for BEC shortcuts.
272
276
 
273
277
  Args:
274
- client: BEC client
278
+ client: BEC client.
275
279
  """
276
280
  self.client = client
277
281
  self.get_bec_shortcuts()
@@ -282,12 +286,10 @@ class BECConnector:
282
286
  Update the configuration for the widget.
283
287
 
284
288
  Args:
285
- config(ConnectionConfig): Configuration settings.
289
+ config (ConnectionConfig | dict): Configuration settings.
286
290
  """
287
291
  if isinstance(config, dict):
288
292
  config = ConnectionConfig(**config)
289
- # TODO add error handler
290
-
291
293
  self.config = config
292
294
 
293
295
  def get_config(self, dict_output: bool = True) -> dict | BaseModel:
@@ -295,12 +297,45 @@ class BECConnector:
295
297
  Get the configuration of the widget.
296
298
 
297
299
  Args:
298
- dict_output(bool): If True, return the configuration as a dictionary. If False, return the configuration as a pydantic model.
300
+ dict_output (bool): If True, return the configuration as a dictionary.
301
+ If False, return the configuration as a pydantic model.
299
302
 
300
303
  Returns:
301
- dict: The configuration of the plot widget.
304
+ dict | BaseModel: The configuration of the widget.
302
305
  """
303
306
  if dict_output:
304
307
  return self.config.model_dump()
305
308
  else:
306
309
  return self.config
310
+
311
+
312
+ # --- Example usage of BECConnector: running a simple task ---
313
+ if __name__ == "__main__": # pragma: no cover
314
+ import sys
315
+
316
+ # Create a QApplication instance (required for QThreadPool)
317
+ app = QApplication(sys.argv)
318
+
319
+ connector = BECConnector()
320
+
321
+ def print_numbers():
322
+ """
323
+ Task function that prints numbers 1 to 10 with a 0.5 second delay between each.
324
+ """
325
+ for i in range(1, 11):
326
+ print(i)
327
+ time.sleep(0.5)
328
+
329
+ def task_complete():
330
+ """
331
+ Called when the task is complete.
332
+ """
333
+ print("Task complete")
334
+ # Exit the application after the task completes.
335
+ app.quit()
336
+
337
+ # Submit the task using the connector's submit_task method.
338
+ connector.submit_task(print_numbers, on_complete=task_complete)
339
+
340
+ # Start the Qt event loop.
341
+ sys.exit(app.exec_())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bec_widgets
3
- Version: 1.21.0
3
+ Version: 1.21.2
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
@@ -16,7 +16,7 @@ Requires-Dist: black~=24.0
16
16
  Requires-Dist: isort>=5.13.2,~=5.13
17
17
  Requires-Dist: pydantic~=2.0
18
18
  Requires-Dist: pyqtgraph~=0.13
19
- Requires-Dist: pyside6==6.7.2
19
+ Requires-Dist: pyside6>=6.8
20
20
  Requires-Dist: pyte
21
21
  Requires-Dist: qtconsole>=5.5.1,~=5.5
22
22
  Requires-Dist: qtpy~=2.4
@@ -2,11 +2,11 @@
2
2
  .gitlab-ci.yml,sha256=PuL-FmkTHm7qs467Mh9D8quWcEj4tgEA-UUGDieMuWk,8774
3
3
  .pylintrc,sha256=eeY8YwSI74oFfq6IYIbCqnx3Vk8ZncKaatv96n_Y8Rs,18544
4
4
  .readthedocs.yaml,sha256=aSOc277LqXcsTI6lgvm_JY80lMlr69GbPKgivua2cS0,603
5
- CHANGELOG.md,sha256=nwcFNPwNl0Hm-pvcpA5AGUtZ6d5S2HTS7XGYS8W0jmA,227882
5
+ CHANGELOG.md,sha256=LbeGr-hIYzolQXxcN6iorlYilR1Y49ioY-JbCc5RgxU,228355
6
6
  LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
7
- PKG-INFO,sha256=UCBSBJegtFWSYbJEwxDRB3c18aL2rojyKCuVFJV5zeg,1175
7
+ PKG-INFO,sha256=iU6yP_roYhTaeevRwlXKIslEVFj4RF_WjjK7gjKye7c,1173
8
8
  README.md,sha256=KgdKusjlvEvFtdNZCeDMO91y77MWK2iDcYMDziksOr4,2553
9
- pyproject.toml,sha256=lQdjFQkuXXHccxf9Xqtjt0kPEUCJ6tyFrCGPMuwQaMY,2542
9
+ pyproject.toml,sha256=k26w_FJ4FRTW1gAEqHZt2o8yQ3PnBOv3HNAx2TDhKPk,2540
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
@@ -25,7 +25,7 @@ bec_widgets/assets/app_icons/bec_widgets_icon.png,sha256=K8dgGwIjalDh9PRHUsSQBqg
25
25
  bec_widgets/cli/__init__.py,sha256=d0Q6Fn44e7wFfLabDOBxpcJ1DPKWlFunGYDUBmO-4hA,22
26
26
  bec_widgets/cli/auto_updates.py,sha256=Pj8OHlSlKN3JOAmuuBC5oUMzdfC8TYRY7QKT5BQ2cZo,5171
27
27
  bec_widgets/cli/client.py,sha256=k1dSiZy4CBHb9pgfpV4ygTNaDUeqtWUbigKMxk9gtsY,100272
28
- bec_widgets/cli/client_utils.py,sha256=r5z1kTEJ7Ceu0MnSpbpZTg4Kq_2e5ys9PXBf7sbvIm0,12529
28
+ bec_widgets/cli/client_utils.py,sha256=V6qhGRt3Dqj49cA468iYbiDABF8t-VepLOxTke6QsBs,12555
29
29
  bec_widgets/cli/generate_cli.py,sha256=lT-eEXEPpzk9cPrfFVf0U5gxQg7HF2oulxDH16T-SBk,6849
30
30
  bec_widgets/cli/server.py,sha256=Hzhhzhc9PQhTtjpNeu8Jmbmahad0DbyieutaRp7Vejc,10485
31
31
  bec_widgets/cli/rpc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -59,7 +59,7 @@ bec_widgets/qt_utils/toolbar.py,sha256=YY_-UGc7uZhahYn7xnTvBGbalmTkpTa4WLikpsHwn
59
59
  bec_widgets/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
60
  bec_widgets/tests/utils.py,sha256=GbQtN7qf9n-8FoAfNddZ4aAqA7oBo_hGAlnKELd6Xzw,6943
61
61
  bec_widgets/utils/__init__.py,sha256=1930ji1Jj6dVuY81Wd2kYBhHYNV-2R0bN_L4o9zBj1U,533
62
- bec_widgets/utils/bec_connector.py,sha256=xMHOn0Rq2OShd0ONYEEZCJZR3oYGnORqMgxjDqgpLMU,10171
62
+ bec_widgets/utils/bec_connector.py,sha256=r2m6AtLooYQkYUGQdolUzpDfjBsKOSK-OiKJsxBMWd8,11445
63
63
  bec_widgets/utils/bec_designer.py,sha256=XBy38NbNMoRDpvRx5lGP2XnJNG34YKZ7I-ARFkn-gzs,5017
64
64
  bec_widgets/utils/bec_dispatcher.py,sha256=OFmkx9vOz4pA4Sdc14QreyDZ870QYskJ4B5daVVeYg4,6325
65
65
  bec_widgets/utils/bec_signal_proxy.py,sha256=soKdA4pJL8S0d-93C0QqcIUxLA4rfb1-B1jyRXHmMxk,3011
@@ -355,8 +355,8 @@ bec_widgets/widgets/utility/visual/dark_mode_button/dark_mode_button.py,sha256=Z
355
355
  bec_widgets/widgets/utility/visual/dark_mode_button/dark_mode_button.pyproject,sha256=Lbi9zb6HNlIq14k6hlzR-oz6PIFShBuF7QxE6d87d64,34
356
356
  bec_widgets/widgets/utility/visual/dark_mode_button/dark_mode_button_plugin.py,sha256=CzChz2SSETYsR8-36meqWnsXCT-FIy_J_xeU5coWDY8,1350
357
357
  bec_widgets/widgets/utility/visual/dark_mode_button/register_dark_mode_button.py,sha256=rMpZ1CaoucwobgPj1FuKTnt07W82bV1GaSYdoqcdMb8,521
358
- bec_widgets-1.21.0.dist-info/METADATA,sha256=UCBSBJegtFWSYbJEwxDRB3c18aL2rojyKCuVFJV5zeg,1175
359
- bec_widgets-1.21.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
360
- bec_widgets-1.21.0.dist-info/entry_points.txt,sha256=dItMzmwA1wizJ1Itx15qnfJ0ZzKVYFLVJ1voxT7K7D4,214
361
- bec_widgets-1.21.0.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
362
- bec_widgets-1.21.0.dist-info/RECORD,,
358
+ bec_widgets-1.21.2.dist-info/METADATA,sha256=iU6yP_roYhTaeevRwlXKIslEVFj4RF_WjjK7gjKye7c,1173
359
+ bec_widgets-1.21.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
360
+ bec_widgets-1.21.2.dist-info/entry_points.txt,sha256=dItMzmwA1wizJ1Itx15qnfJ0ZzKVYFLVJ1voxT7K7D4,214
361
+ bec_widgets-1.21.2.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
362
+ bec_widgets-1.21.2.dist-info/RECORD,,
pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bec_widgets"
7
- version = "1.21.0"
7
+ version = "1.21.2"
8
8
  description = "BEC Widgets"
9
9
  requires-python = ">=3.10"
10
10
  classifiers = [
@@ -20,7 +20,7 @@ dependencies = [
20
20
  "isort~=5.13, >=5.13.2", # needed for bw-generate-cli
21
21
  "pydantic~=2.0",
22
22
  "pyqtgraph~=0.13",
23
- "PySide6==6.7.2",
23
+ "PySide6>=6.8",
24
24
  "pyte", # needed for vt100 console
25
25
  "qtconsole~=5.5, >=5.5.1", # needed for jupyter console
26
26
  "qtpy~=2.4",