bec-widgets 0.94.5__py3-none-any.whl → 0.94.7__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,17 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v0.94.7 (2024-08-20)
4
+
5
+ ### Fix
6
+
7
+ * fix: formatting of stdout, stderr captured text for logger ([`939f834`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/939f834a26ddbac0bdead0b60b1cdf52014f182f))
8
+
9
+ ## v0.94.6 (2024-08-14)
10
+
11
+ ### Fix
12
+
13
+ * fix(server): emit heartbeat with state ([`bc2abe9`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/bc2abe945fb5adeec89ed5ac45e966db86ce6ffc))
14
+
3
15
  ## v0.94.5 (2024-08-14)
4
16
 
5
17
  ### Build
@@ -140,18 +152,6 @@ This reverts commit fd6ae91993a23a7b8dbb2cf3c4b7c3eda6d2b0f6 ([`5aad401`](https:
140
152
 
141
153
  * fix(status_box): fix cleanup of status box ([`1f30dd7`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/1f30dd73a9c1e3135087a5eef92c7329f54a604e))
142
154
 
143
- ### Refactor
144
-
145
- * refactor(queue): refactored bec queue to inherit only from qwidget ([`7616ca0`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/7616ca0e145e233ccb48029a8c0b54b54b5b4194))
146
-
147
155
  ### Test
148
156
 
149
157
  * test: register all widgets with qtbot and close them ([`73cd11e`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/73cd11e47277e4437554b785a9551b28a572094f))
150
-
151
- ## v0.92.4 (2024-07-31)
152
-
153
- ### Fix
154
-
155
- * fix: fix missmatch of signal/slot in image and motormap ([`dcc5fd7`](https://gitlab.psi.ch/bec/bec_widgets/-/commit/dcc5fd71ee9f51767a7b2b1ed6200e89d1ef754c))
156
-
157
- ## v0.92.3 (2024-07-28)
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.94.5
3
+ Version: 0.94.7
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
@@ -100,6 +100,7 @@ def _start_plot_process(gui_id: str, gui_class: type, config: dict | str, logger
100
100
 
101
101
  env_dict = os.environ.copy()
102
102
  env_dict["PYTHONUNBUFFERED"] = "1"
103
+
103
104
  if logger is None:
104
105
  stdout_redirect = subprocess.DEVNULL
105
106
  stderr_redirect = subprocess.DEVNULL
@@ -331,4 +332,8 @@ class RPCBase:
331
332
  Check if the GUI is alive.
332
333
  """
333
334
  heart = self._client.connector.get(MessageEndpoints.gui_heartbeat(self._root._gui_id))
334
- return heart is not None
335
+ if heart is None:
336
+ return False
337
+ if heart.status == messages.BECStatus.RUNNING:
338
+ return True
339
+ return False
bec_widgets/cli/server.py CHANGED
@@ -28,12 +28,13 @@ class BECWidgetsCLIServer:
28
28
 
29
29
  def __init__(
30
30
  self,
31
- gui_id: str = None,
31
+ gui_id: str,
32
32
  dispatcher: BECDispatcher = None,
33
33
  client=None,
34
34
  config=None,
35
35
  gui_class: Union[BECFigure, BECDockArea] = BECFigure,
36
36
  ) -> None:
37
+ self.status = messages.BECStatus.BUSY
37
38
  self.dispatcher = BECDispatcher(config=config) if dispatcher is None else dispatcher
38
39
  self.client = self.dispatcher.client if client is None else client
39
40
  self.client.start()
@@ -47,11 +48,12 @@ class BECWidgetsCLIServer:
47
48
  )
48
49
 
49
50
  # Setup QTimer for heartbeat
50
- self._shutdown_event = False
51
51
  self._heartbeat_timer = QTimer()
52
52
  self._heartbeat_timer.timeout.connect(self.emit_heartbeat)
53
53
  self._heartbeat_timer.start(200)
54
54
 
55
+ self.status = messages.BECStatus.RUNNING
56
+
55
57
  def on_rpc_update(self, msg: dict, metadata: dict):
56
58
  request_id = metadata.get("request_id")
57
59
  try:
@@ -111,16 +113,16 @@ class BECWidgetsCLIServer:
111
113
  return obj
112
114
 
113
115
  def emit_heartbeat(self):
114
- if self._shutdown_event is False:
115
- self.client.connector.set(
116
- MessageEndpoints.gui_heartbeat(self.gui_id),
117
- messages.StatusMessage(name=self.gui_id, status=1, info={}),
118
- expire=1,
119
- )
116
+ self.client.connector.set(
117
+ MessageEndpoints.gui_heartbeat(self.gui_id),
118
+ messages.StatusMessage(name=self.gui_id, status=self.status, info={}),
119
+ expire=10,
120
+ )
120
121
 
121
122
  def shutdown(self): # TODO not sure if needed when cleanup is done at level of BECConnector
122
- self._shutdown_event = True
123
+ self.status = messages.BECStatus.IDLE
123
124
  self._heartbeat_timer.stop()
125
+ self.emit_heartbeat()
124
126
  self.gui.close()
125
127
  self.client.shutdown()
126
128
 
@@ -128,15 +130,15 @@ class BECWidgetsCLIServer:
128
130
  class SimpleFileLikeFromLogOutputFunc:
129
131
  def __init__(self, log_func):
130
132
  self._log_func = log_func
133
+ self._buffer = []
131
134
 
132
135
  def write(self, buffer):
133
- for line in buffer.rstrip().splitlines():
134
- line = line.rstrip()
135
- if line:
136
- self._log_func(line)
136
+ self._buffer.append(buffer)
137
137
 
138
138
  def flush(self):
139
- return
139
+ lines, _, remaining = "".join(self._buffer).rpartition("\n")
140
+ self._log_func(lines)
141
+ self._buffer = [remaining]
140
142
 
141
143
  def close(self):
142
144
  return
@@ -231,4 +233,5 @@ def main():
231
233
 
232
234
 
233
235
  if __name__ == "__main__": # pragma: no cover
236
+ sys.argv = ["bec_widgets.cli.server", "--id", "test", "--gui_class", "BECDockArea"]
234
237
  main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bec_widgets
3
- Version: 0.94.5
3
+ Version: 0.94.7
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=AyMvWke1tWeCvkvs9EWcNaIC75E7qlOfzgBNyQGO1ks,6719
5
+ CHANGELOG.md,sha256=jhchcfzJ4tJmB9TztZ_Y-TqfZeNKL5OTUzpD1bbpHEs,6689
6
6
  LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
7
- PKG-INFO,sha256=R5qONexTNA-N-SUHcQY1xSlCgOesmiI9osI0vnQIMec,1325
7
+ PKG-INFO,sha256=M__c_RIR9v7_7Trd7jo-9px8tawl3Kmt7RFufR3ntxw,1325
8
8
  README.md,sha256=Od69x-RS85Hph0-WwWACwal4yUd67XkEn4APEfHhHFw,2649
9
- pyproject.toml,sha256=32PfrgJSI6hyIzuMrPw4QtjsWpuLjvKkEZmQhMpR7ms,2416
9
+ pyproject.toml,sha256=RplPX3vctU3wArBQBFJ_zildzghVjSgH2LTuVCFAXAc,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
@@ -83,11 +83,11 @@ bec_widgets/assets/toolbar_icons/waveform.svg,sha256=darXWaIww4HEu9skFUd8Vs1NSAg
83
83
  bec_widgets/cli/__init__.py,sha256=d0Q6Fn44e7wFfLabDOBxpcJ1DPKWlFunGYDUBmO-4hA,22
84
84
  bec_widgets/cli/auto_updates.py,sha256=DwzRChcFIWPH2kCYvp8H7dXvyYSKGYv6LwCmK2sDR2E,5676
85
85
  bec_widgets/cli/client.py,sha256=HjBxjthimBvbyVrjvLZoeBN1NdezupowRYjZxqDlOX8,76261
86
- bec_widgets/cli/client_utils.py,sha256=isk0bUcubdbqzIstN3peQpjV9pLuNUBZsHlIedIhCCw,11594
86
+ bec_widgets/cli/client_utils.py,sha256=l35LtTkD7PdvVCckjMU8-y6f5a5pp1u6cFPpD-Dkvow,11713
87
87
  bec_widgets/cli/generate_cli.py,sha256=Ea5px9KblUlcGg-1JbJBTIU7laGg2n8PM7Efw9WVVzM,5889
88
88
  bec_widgets/cli/rpc_register.py,sha256=QxXUZu5XNg00Yf5O3UHWOXg3-f_pzKjjoZYMOa-MOJc,2216
89
89
  bec_widgets/cli/rpc_wigdet_handler.py,sha256=6kQng2DyS6rhLJqSJ7xa0kdgSxp-35A2upcf833dJRE,1483
90
- bec_widgets/cli/server.py,sha256=y0GrBpDF3bHvYFZM20j2eDlsYxb-hT1ki_zmVI_OEiM,7752
90
+ bec_widgets/cli/server.py,sha256=I3gZ5xwygEOnL4ga3zOoD3jRUXNjPRop4u7a0emfejs,7921
91
91
  bec_widgets/examples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
92
92
  bec_widgets/examples/general_app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
93
93
  bec_widgets/examples/general_app/general_app.py,sha256=Ks9CKtIQIFOzKosh204zVg1ltSnp07LDqkwoVAaCd9k,3046
@@ -378,8 +378,8 @@ tests/unit_tests/test_configs/config_device_no_entry.yaml,sha256=hdvue9KLc_kfNzG
378
378
  tests/unit_tests/test_configs/config_scan.yaml,sha256=vo484BbWOjA_e-h6bTjSV9k7QaQHrlAvx-z8wtY-P4E,1915
379
379
  tests/unit_tests/test_msgs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
380
380
  tests/unit_tests/test_msgs/available_scans_message.py,sha256=m_z97hIrjHXXMa2Ex-UvsPmTxOYXfjxyJaGkIY6StTY,46532
381
- bec_widgets-0.94.5.dist-info/METADATA,sha256=R5qONexTNA-N-SUHcQY1xSlCgOesmiI9osI0vnQIMec,1325
382
- bec_widgets-0.94.5.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
383
- bec_widgets-0.94.5.dist-info/entry_points.txt,sha256=3otEkCdDB9LZJuBLzG4pFLK5Di0CVybN_12IsZrQ-58,166
384
- bec_widgets-0.94.5.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
385
- bec_widgets-0.94.5.dist-info/RECORD,,
381
+ bec_widgets-0.94.7.dist-info/METADATA,sha256=M__c_RIR9v7_7Trd7jo-9px8tawl3Kmt7RFufR3ntxw,1325
382
+ bec_widgets-0.94.7.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
383
+ bec_widgets-0.94.7.dist-info/entry_points.txt,sha256=3otEkCdDB9LZJuBLzG4pFLK5Di0CVybN_12IsZrQ-58,166
384
+ bec_widgets-0.94.7.dist-info/licenses/LICENSE,sha256=YRKe85CBRyP7UpEAWwU8_qSIyuy5-l_9C-HKg5Qm8MQ,1511
385
+ bec_widgets-0.94.7.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 = "0.94.5"
7
+ version = "0.94.7"
8
8
  description = "BEC Widgets"
9
9
  requires-python = ">=3.10"
10
10
  classifiers = [