bec-widgets 2.15.0__py3-none-any.whl → 2.15.1__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,17 @@
1
1
  # CHANGELOG
2
2
 
3
3
 
4
+ ## v2.15.1 (2025-06-16)
5
+
6
+ ### Bug Fixes
7
+
8
+ - **main_window**: Added expiration timer for scroll label for ClientInfoMessage
9
+ ([`187bf49`](https://github.com/bec-project/bec_widgets/commit/187bf493a5b18299a10939901b9ed7e308435092))
10
+
11
+ - **scroll_label**: Updating label during scrolling is done imminently, regardless scrolling
12
+ ([`1612933`](https://github.com/bec-project/bec_widgets/commit/1612933dd9689f2bf480ad81811c051201a9ff70))
13
+
14
+
4
15
  ## v2.15.0 (2025-06-15)
5
16
 
6
17
  ### Bug Fixes
PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bec_widgets
3
- Version: 2.15.0
3
+ Version: 2.15.1
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
@@ -25,17 +25,29 @@ class ScrollLabel(QLabel):
25
25
  self._step_px = step_px
26
26
 
27
27
  def setText(self, text):
28
+ """
29
+ Overridden to ensure that new text replaces the current one
30
+ immediately.
31
+ If the label was already scrolling (or in its delay phase),
32
+ the next message starts **without** the extra delay.
33
+ """
34
+ # Determine whether the widget was already in a scrolling cycle
35
+ was_scrolling = self._timer.isActive() or self._delay_timer.isActive()
36
+
28
37
  super().setText(text)
38
+
29
39
  fm = QFontMetrics(self.font())
30
40
  self._text_width = fm.horizontalAdvance(text)
31
41
  self._offset = 0
32
- self._update_timer()
42
+
43
+ # Skip the delay when we were already scrolling
44
+ self._update_timer(skip_delay=was_scrolling)
33
45
 
34
46
  def resizeEvent(self, event):
35
47
  super().resizeEvent(event)
36
48
  self._update_timer()
37
49
 
38
- def _update_timer(self):
50
+ def _update_timer(self, *, skip_delay: bool = False):
39
51
  """
40
52
  Decide whether to start or stop scrolling.
41
53
 
@@ -46,10 +58,19 @@ class ScrollLabel(QLabel):
46
58
  needs_scroll = self._text_width > self.width()
47
59
 
48
60
  if needs_scroll:
61
+ # Reset any running timers
49
62
  if self._timer.isActive():
50
63
  self._timer.stop()
64
+ if self._delay_timer.isActive():
65
+ self._delay_timer.stop()
66
+
51
67
  self._offset = 0
52
- if not self._delay_timer.isActive():
68
+
69
+ # Start scrolling immediately when we should skip the delay,
70
+ # otherwise apply the configured delay_ms interval
71
+ if skip_delay:
72
+ self._timer.start()
73
+ else:
53
74
  self._delay_timer.start()
54
75
  else:
55
76
  if self._delay_timer.isActive():
@@ -1,7 +1,7 @@
1
1
  import os
2
2
 
3
3
  from bec_lib.endpoints import MessageEndpoints
4
- from qtpy.QtCore import QEvent, QSize, Qt
4
+ from qtpy.QtCore import QEvent, QSize, Qt, QTimer
5
5
  from qtpy.QtGui import QAction, QActionGroup, QIcon
6
6
  from qtpy.QtWidgets import QApplication, QFrame, QLabel, QMainWindow, QStyle, QVBoxLayout, QWidget
7
7
 
@@ -80,6 +80,11 @@ class BECMainWindow(BECWidget, QMainWindow):
80
80
  )
81
81
  status_bar.addWidget(self._client_info_label, 1)
82
82
 
83
+ # Timer to automatically clear client messages once they expire
84
+ self._client_info_expire_timer = QTimer(self)
85
+ self._client_info_expire_timer.setSingleShot(True)
86
+ self._client_info_expire_timer.timeout.connect(lambda: self._client_info_label.setText(""))
87
+
83
88
  def _add_separator(self):
84
89
  """
85
90
  Add a vertically centred separator to the status bar.
@@ -222,9 +227,24 @@ class BECMainWindow(BECWidget, QMainWindow):
222
227
 
223
228
  @SafeSlot(dict, dict)
224
229
  def display_client_message(self, msg: dict, meta: dict):
230
+ """
231
+ Display a client message in the status bar.
232
+
233
+ Args:
234
+ msg(dict): The message to display, should contain:
235
+ meta(dict): Metadata about the message, usually empty.
236
+ """
237
+ # self._client_info_label.setText("")
225
238
  message = msg.get("message", "")
239
+ expiration = msg.get("expire", 0) # 0 → never expire
226
240
  self._client_info_label.setText(message)
227
241
 
242
+ # Restart the expiration timer if necessary
243
+ if hasattr(self, "_client_info_expire_timer") and self._client_info_expire_timer.isActive():
244
+ self._client_info_expire_timer.stop()
245
+ if expiration and expiration > 0:
246
+ self._client_info_expire_timer.start(int(expiration * 1000))
247
+
228
248
  ################################################################################
229
249
  # General and Cleanup Methods
230
250
  ################################################################################
@@ -259,6 +279,8 @@ class BECMainWindow(BECWidget, QMainWindow):
259
279
  child.close()
260
280
  child.deleteLater()
261
281
 
282
+ if hasattr(self, "_client_info_expire_timer") and self._client_info_expire_timer.isActive():
283
+ self._client_info_expire_timer.stop()
262
284
  # Status bar widgets cleanup
263
285
  self._client_info_label.cleanup()
264
286
  super().cleanup()
@@ -266,3 +288,12 @@ class BECMainWindow(BECWidget, QMainWindow):
266
288
 
267
289
  class UILaunchWindow(BECMainWindow):
268
290
  RPC = True
291
+
292
+
293
+ if __name__ == "__main__":
294
+ import sys
295
+
296
+ app = QApplication(sys.argv)
297
+ main_window = UILaunchWindow()
298
+ main_window.show()
299
+ sys.exit(app.exec())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bec_widgets
3
- Version: 2.15.0
3
+ Version: 2.15.1
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=1nMYldzVk0tFkBWYTcUjumOrdSADASheWOAc0kOFDYs,9509
3
3
  .pylintrc,sha256=eeY8YwSI74oFfq6IYIbCqnx3Vk8ZncKaatv96n_Y8Rs,18544
4
4
  .readthedocs.yaml,sha256=ivqg3HTaOxNbEW3bzWh9MXAkrekuGoNdj0Mj3SdRYuw,639
5
- CHANGELOG.md,sha256=n_bLGhoWteR3IlmPcheOc1NmwwuA9YT-U8wH9qdqvTc,300622
5
+ CHANGELOG.md,sha256=BGd-zRzWE7KTMPqaa3CPc_JyROlDYD5DZ95PQMUjKzQ,301055
6
6
  LICENSE,sha256=Daeiu871NcAp8uYi4eB_qHgvypG-HX0ioRQyQxFwjeg,1531
7
- PKG-INFO,sha256=UG0NtEIGEXUQb9P-vMk67mOQHLGP06_1SRQ3Hdf8D0U,1252
7
+ PKG-INFO,sha256=gTntcRGnhQPrg5vyZPQgQOjlhlKK-Y5r__82UIsiJXA,1252
8
8
  README.md,sha256=oY5Jc1uXehRASuwUJ0umin2vfkFh7tHF-LLruHTaQx0,3560
9
- pyproject.toml,sha256=A3AL_HaiNQUaOAmO1eBS6lIrkDjfJb8DIP-BwuqMeLw,2827
9
+ pyproject.toml,sha256=HMdAYHc2bpPYaYYmgAWgbC3HiiptNXdnHyTMOQmdXg8,2827
10
10
  .git_hooks/pre-commit,sha256=n3RofIZHJl8zfJJIUomcMyYGFi_rwq4CC19z0snz3FI,286
11
11
  .github/pull_request_template.md,sha256=F_cJXzooWMFgMGtLK-7KeGcQt0B4AYFse5oN0zQ9p6g,801
12
12
  .github/ISSUE_TEMPLATE/bug_report.yml,sha256=WdRnt7HGxvsIBLzhkaOWNfg8IJQYa_oV9_F08Ym6znQ,1081
@@ -121,9 +121,9 @@ bec_widgets/widgets/containers/dock/register_dock_area.py,sha256=L7BL4qknCjtqsDP
121
121
  bec_widgets/widgets/containers/layout_manager/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
122
122
  bec_widgets/widgets/containers/layout_manager/layout_manager.py,sha256=V7s8mtB3VLPstyGVaR9YKcoTVlfMMOYNpIJUsw2WQVc,35198
123
123
  bec_widgets/widgets/containers/main_window/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
124
- bec_widgets/widgets/containers/main_window/main_window.py,sha256=vp3KiHg0uCA2z9JeeV1ArFNYAdrWRWqDKhct8AOab4g,9169
124
+ bec_widgets/widgets/containers/main_window/main_window.py,sha256=-qDkmL-DO6wJV1EnZdauGXzAh_nwRJJPWed1eSJR80Y,10425
125
125
  bec_widgets/widgets/containers/main_window/addons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
126
- bec_widgets/widgets/containers/main_window/addons/scroll_label.py,sha256=ERZVE5J4uRyuizf9nbvnHAJZo2xGaVmgLBlrJaYpVSg,2943
126
+ bec_widgets/widgets/containers/main_window/addons/scroll_label.py,sha256=RDiLWDkIrXFAdCXNMm6eE6U9h3zjfPhJDqVwdV8aSL8,3743
127
127
  bec_widgets/widgets/containers/main_window/addons/web_links.py,sha256=d5OgzgI9zb-NAC0pOGanOtJX3nZoe4x8QuQTw-_hK_8,434
128
128
  bec_widgets/widgets/control/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
129
129
  bec_widgets/widgets/control/buttons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -409,8 +409,8 @@ bec_widgets/widgets/utility/visual/dark_mode_button/dark_mode_button.py,sha256=O
409
409
  bec_widgets/widgets/utility/visual/dark_mode_button/dark_mode_button.pyproject,sha256=Lbi9zb6HNlIq14k6hlzR-oz6PIFShBuF7QxE6d87d64,34
410
410
  bec_widgets/widgets/utility/visual/dark_mode_button/dark_mode_button_plugin.py,sha256=CzChz2SSETYsR8-36meqWnsXCT-FIy_J_xeU5coWDY8,1350
411
411
  bec_widgets/widgets/utility/visual/dark_mode_button/register_dark_mode_button.py,sha256=rMpZ1CaoucwobgPj1FuKTnt07W82bV1GaSYdoqcdMb8,521
412
- bec_widgets-2.15.0.dist-info/METADATA,sha256=UG0NtEIGEXUQb9P-vMk67mOQHLGP06_1SRQ3Hdf8D0U,1252
413
- bec_widgets-2.15.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
414
- bec_widgets-2.15.0.dist-info/entry_points.txt,sha256=dItMzmwA1wizJ1Itx15qnfJ0ZzKVYFLVJ1voxT7K7D4,214
415
- bec_widgets-2.15.0.dist-info/licenses/LICENSE,sha256=Daeiu871NcAp8uYi4eB_qHgvypG-HX0ioRQyQxFwjeg,1531
416
- bec_widgets-2.15.0.dist-info/RECORD,,
412
+ bec_widgets-2.15.1.dist-info/METADATA,sha256=gTntcRGnhQPrg5vyZPQgQOjlhlKK-Y5r__82UIsiJXA,1252
413
+ bec_widgets-2.15.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
414
+ bec_widgets-2.15.1.dist-info/entry_points.txt,sha256=dItMzmwA1wizJ1Itx15qnfJ0ZzKVYFLVJ1voxT7K7D4,214
415
+ bec_widgets-2.15.1.dist-info/licenses/LICENSE,sha256=Daeiu871NcAp8uYi4eB_qHgvypG-HX0ioRQyQxFwjeg,1531
416
+ bec_widgets-2.15.1.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 = "2.15.0"
7
+ version = "2.15.1"
8
8
  description = "BEC Widgets"
9
9
  requires-python = ">=3.10"
10
10
  classifiers = [