bec-widgets 2.8.0__py3-none-any.whl → 2.8.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 +8 -0
- PKG-INFO +1 -1
- bec_widgets/applications/launch_window.py +69 -3
- {bec_widgets-2.8.0.dist-info → bec_widgets-2.8.1.dist-info}/METADATA +1 -1
- {bec_widgets-2.8.0.dist-info → bec_widgets-2.8.1.dist-info}/RECORD +9 -9
- pyproject.toml +1 -1
- {bec_widgets-2.8.0.dist-info → bec_widgets-2.8.1.dist-info}/WHEEL +0 -0
- {bec_widgets-2.8.0.dist-info → bec_widgets-2.8.1.dist-info}/entry_points.txt +0 -0
- {bec_widgets-2.8.0.dist-info → bec_widgets-2.8.1.dist-info}/licenses/LICENSE +0 -0
CHANGELOG.md
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
3
|
|
4
|
+
## v2.8.1 (2025-05-27)
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
- **launch_window**: Font and tile size fixed across OSs, closes #607
|
9
|
+
([`ada0977`](https://github.com/bec-project/bec_widgets/commit/ada0977a1b50e750c2e2c848ce9b80895e0e524a))
|
10
|
+
|
11
|
+
|
4
12
|
## v2.8.0 (2025-05-26)
|
5
13
|
|
6
14
|
### Bug Fixes
|
PKG-INFO
CHANGED
@@ -6,7 +6,7 @@ from typing import TYPE_CHECKING, Callable
|
|
6
6
|
|
7
7
|
from bec_lib.logger import bec_logger
|
8
8
|
from qtpy.QtCore import Qt, Signal # type: ignore
|
9
|
-
from qtpy.QtGui import QPainter, QPainterPath, QPixmap
|
9
|
+
from qtpy.QtGui import QFontMetrics, QPainter, QPainterPath, QPixmap
|
10
10
|
from qtpy.QtWidgets import (
|
11
11
|
QApplication,
|
12
12
|
QComboBox,
|
@@ -44,6 +44,7 @@ MODULE_PATH = os.path.dirname(bec_widgets.__file__)
|
|
44
44
|
|
45
45
|
|
46
46
|
class LaunchTile(RoundedFrame):
|
47
|
+
DEFAULT_SIZE = (250, 300)
|
47
48
|
open_signal = Signal()
|
48
49
|
|
49
50
|
def __init__(
|
@@ -54,9 +55,15 @@ class LaunchTile(RoundedFrame):
|
|
54
55
|
main_label: str | None = None,
|
55
56
|
description: str | None = None,
|
56
57
|
show_selector: bool = False,
|
58
|
+
tile_size: tuple[int, int] | None = None,
|
57
59
|
):
|
58
60
|
super().__init__(parent=parent, orientation="vertical")
|
59
61
|
|
62
|
+
# Provide a per‑instance TILE_SIZE so the class can compute layout
|
63
|
+
if tile_size is None:
|
64
|
+
tile_size = self.DEFAULT_SIZE
|
65
|
+
self.tile_size = tile_size
|
66
|
+
|
60
67
|
self.icon_label = QLabel(parent=self)
|
61
68
|
self.icon_label.setFixedSize(100, 100)
|
62
69
|
self.icon_label.setScaledContents(True)
|
@@ -87,12 +94,26 @@ class LaunchTile(RoundedFrame):
|
|
87
94
|
|
88
95
|
# Main label
|
89
96
|
self.main_label = QLabel(main_label)
|
97
|
+
|
98
|
+
# Desired default appearance
|
90
99
|
font_main = self.main_label.font()
|
91
100
|
font_main.setPointSize(14)
|
92
101
|
font_main.setBold(True)
|
93
102
|
self.main_label.setFont(font_main)
|
94
|
-
self.main_label.setWordWrap(True)
|
95
103
|
self.main_label.setAlignment(Qt.AlignCenter)
|
104
|
+
|
105
|
+
# Shrink font if the default would wrap on this platform / DPI
|
106
|
+
content_width = (
|
107
|
+
self.tile_size[0]
|
108
|
+
- self.layout.contentsMargins().left()
|
109
|
+
- self.layout.contentsMargins().right()
|
110
|
+
)
|
111
|
+
self._fit_label_to_width(self.main_label, content_width)
|
112
|
+
|
113
|
+
# Give every tile the same reserved height for the title so the
|
114
|
+
# description labels start at an identical y‑offset.
|
115
|
+
self.main_label.setFixedHeight(QFontMetrics(self.main_label.font()).height() + 2)
|
116
|
+
|
96
117
|
self.layout.addWidget(self.main_label)
|
97
118
|
|
98
119
|
self.spacer_top = QSpacerItem(0, 10, QSizePolicy.Fixed, QSizePolicy.Fixed)
|
@@ -133,6 +154,29 @@ class LaunchTile(RoundedFrame):
|
|
133
154
|
)
|
134
155
|
self.layout.addWidget(self.action_button, alignment=Qt.AlignCenter)
|
135
156
|
|
157
|
+
def _fit_label_to_width(self, label: QLabel, max_width: int, min_pt: int = 10):
|
158
|
+
"""
|
159
|
+
Fit the label text to the specified maximum width by adjusting the font size.
|
160
|
+
|
161
|
+
Args:
|
162
|
+
label(QLabel): The label to adjust.
|
163
|
+
max_width(int): The maximum width the label can occupy.
|
164
|
+
min_pt(int): The minimum font point size to use.
|
165
|
+
"""
|
166
|
+
font = label.font()
|
167
|
+
for pt in range(font.pointSize(), min_pt - 1, -1):
|
168
|
+
font.setPointSize(pt)
|
169
|
+
metrics = QFontMetrics(font)
|
170
|
+
if metrics.horizontalAdvance(label.text()) <= max_width:
|
171
|
+
label.setFont(font)
|
172
|
+
label.setWordWrap(False)
|
173
|
+
return
|
174
|
+
# If nothing fits, fall back to eliding
|
175
|
+
metrics = QFontMetrics(font)
|
176
|
+
label.setFont(font)
|
177
|
+
label.setWordWrap(False)
|
178
|
+
label.setText(metrics.elidedText(label.text(), Qt.ElideRight, max_width))
|
179
|
+
|
136
180
|
|
137
181
|
class LaunchWindow(BECMainWindow):
|
138
182
|
RPC = True
|
@@ -146,6 +190,8 @@ class LaunchWindow(BECMainWindow):
|
|
146
190
|
|
147
191
|
self.app = QApplication.instance()
|
148
192
|
self.tiles: dict[str, LaunchTile] = {}
|
193
|
+
# Track the smallest main‑label font size chosen so far
|
194
|
+
self._min_main_label_pt: int | None = None
|
149
195
|
|
150
196
|
# Toolbar
|
151
197
|
self.dark_mode_button = DarkModeButton(parent=self, toolbar=True)
|
@@ -250,14 +296,34 @@ class LaunchWindow(BECMainWindow):
|
|
250
296
|
main_label=main_label,
|
251
297
|
description=description,
|
252
298
|
show_selector=show_selector,
|
299
|
+
tile_size=self.TILE_SIZE,
|
253
300
|
)
|
254
|
-
tile.
|
301
|
+
tile.setFixedWidth(self.TILE_SIZE[0])
|
302
|
+
tile.setMinimumHeight(self.TILE_SIZE[1])
|
303
|
+
tile.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.MinimumExpanding)
|
255
304
|
if action_button:
|
256
305
|
tile.action_button.clicked.connect(action_button)
|
257
306
|
if show_selector and selector_items:
|
258
307
|
tile.selector.addItems(selector_items)
|
259
308
|
self.central_widget.layout.addWidget(tile)
|
260
309
|
|
310
|
+
# keep all tiles' main labels at a unified point size
|
311
|
+
current_pt = tile.main_label.font().pointSize()
|
312
|
+
if self._min_main_label_pt is None or current_pt < self._min_main_label_pt:
|
313
|
+
# New global minimum – shrink every existing tile to this size
|
314
|
+
self._min_main_label_pt = current_pt
|
315
|
+
for t in self.tiles.values():
|
316
|
+
f = t.main_label.font()
|
317
|
+
f.setPointSize(self._min_main_label_pt)
|
318
|
+
t.main_label.setFont(f)
|
319
|
+
t.main_label.setFixedHeight(QFontMetrics(f).height() + 2)
|
320
|
+
elif current_pt > self._min_main_label_pt:
|
321
|
+
# Tile is larger than global minimum – shrink it to match
|
322
|
+
f = tile.main_label.font()
|
323
|
+
f.setPointSize(self._min_main_label_pt)
|
324
|
+
tile.main_label.setFont(f)
|
325
|
+
tile.main_label.setFixedHeight(QFontMetrics(f).height() + 2)
|
326
|
+
|
261
327
|
self.tiles[name] = tile
|
262
328
|
|
263
329
|
def launch(
|
@@ -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=
|
5
|
+
CHANGELOG.md,sha256=3L7_BBe-CABry-ucSXFIclXSzJ5bCCScyEHhTT6D1mw,288801
|
6
6
|
LICENSE,sha256=Daeiu871NcAp8uYi4eB_qHgvypG-HX0ioRQyQxFwjeg,1531
|
7
|
-
PKG-INFO,sha256=
|
7
|
+
PKG-INFO,sha256=6BSOcvVZIpTyTU1dz24T2PXsYCsI-OvDy_LeMSoL-10,1273
|
8
8
|
README.md,sha256=oY5Jc1uXehRASuwUJ0umin2vfkFh7tHF-LLruHTaQx0,3560
|
9
|
-
pyproject.toml,sha256=
|
9
|
+
pyproject.toml,sha256=OE4KwC7qc4Wn8YWnyLB4yDi_ziqibPuilvcIdNhrJJA,2902
|
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
|
@@ -27,7 +27,7 @@ pyproject.toml,sha256=KdVlUHSNuwRHCenM1J4XQwYuU308mREP53faG8gmMsw,2902
|
|
27
27
|
bec_widgets/__init__.py,sha256=mZhbU6zfFt8-A7q_do74ie89budSevwpKZ6FKtEBdmo,170
|
28
28
|
bec_widgets/applications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
29
|
bec_widgets/applications/bw_launch.py,sha256=4lngXb8Ht_cvQtCwjjbAoqPNuE2V0Ja5WIPHpwgjcRI,687
|
30
|
-
bec_widgets/applications/launch_window.py,sha256=
|
30
|
+
bec_widgets/applications/launch_window.py,sha256=vKuGNv47jBYlkydk5NrDcrlZhU9wehIYfu7s-IOh7ks,21862
|
31
31
|
bec_widgets/assets/app_icons/BEC-General-App.png,sha256=hc2ktly53DZAbl_rE3cb-vdRa5gtdCmBEjfwm2y5P4g,447581
|
32
32
|
bec_widgets/assets/app_icons/alignment_1d.png,sha256=5VouaWieb4lVv3wUBNHaO5ovUW2Fk25aTKYQzOWy0mg,2071069
|
33
33
|
bec_widgets/assets/app_icons/auto_update.png,sha256=YKoAJTWAlWzreYvOm0BttDRFr29tulolZgKirRhAFlA,2197066
|
@@ -404,8 +404,8 @@ bec_widgets/widgets/utility/visual/dark_mode_button/dark_mode_button.py,sha256=O
|
|
404
404
|
bec_widgets/widgets/utility/visual/dark_mode_button/dark_mode_button.pyproject,sha256=Lbi9zb6HNlIq14k6hlzR-oz6PIFShBuF7QxE6d87d64,34
|
405
405
|
bec_widgets/widgets/utility/visual/dark_mode_button/dark_mode_button_plugin.py,sha256=CzChz2SSETYsR8-36meqWnsXCT-FIy_J_xeU5coWDY8,1350
|
406
406
|
bec_widgets/widgets/utility/visual/dark_mode_button/register_dark_mode_button.py,sha256=rMpZ1CaoucwobgPj1FuKTnt07W82bV1GaSYdoqcdMb8,521
|
407
|
-
bec_widgets-2.8.
|
408
|
-
bec_widgets-2.8.
|
409
|
-
bec_widgets-2.8.
|
410
|
-
bec_widgets-2.8.
|
411
|
-
bec_widgets-2.8.
|
407
|
+
bec_widgets-2.8.1.dist-info/METADATA,sha256=6BSOcvVZIpTyTU1dz24T2PXsYCsI-OvDy_LeMSoL-10,1273
|
408
|
+
bec_widgets-2.8.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
409
|
+
bec_widgets-2.8.1.dist-info/entry_points.txt,sha256=dItMzmwA1wizJ1Itx15qnfJ0ZzKVYFLVJ1voxT7K7D4,214
|
410
|
+
bec_widgets-2.8.1.dist-info/licenses/LICENSE,sha256=Daeiu871NcAp8uYi4eB_qHgvypG-HX0ioRQyQxFwjeg,1531
|
411
|
+
bec_widgets-2.8.1.dist-info/RECORD,,
|
pyproject.toml
CHANGED
File without changes
|
File without changes
|
File without changes
|