Skip to content

Commit a26525d

Browse files
authored
fix(gui): Crash in "Manage profiles" dialog when using "qt6ct"
Fix #2128
1 parent 0f0aa42 commit a26525d

File tree

5 files changed

+85
-36
lines changed

5 files changed

+85
-36
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
Back In Time
23

34
Version 1.6.0-dev (development of upcoming release)
@@ -17,6 +18,7 @@ Version 1.6.0-dev (development of upcoming release)
1718
* Fixed: Re-design about dialog (#1936)
1819
* Fixed: Stop waking up monitor when inhibit suspend on backup starts (#714, #1090)
1920
* Fixed: Avoid shutdown confirmation dialog on Budgie and Cinnamon desktop environments (#788)
21+
* Fixed: Crash in "Manage profiles" dialog when using "qt6ct" (#2128)
2022

2123
Version 1.5.4 (2025-03-24)
2224
* Breaking Change: Auto-remove rules "Free inodes" and "Free space" disabled by default in new created profiles (#1976)

doc/maintain/BiT_release_process.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -325,15 +325,23 @@ expected. The following list suggests several actions and scenarios.
325325
or distros based on them. Additionally use a none-systemd distro like _Devuan
326326
GNU/Linux_.
327327
- Run _Back In Time_ and perform the following actions as user and as root.
328-
- Always start from terminal to catch silent errors and warnings.
329-
- Create snapshot profils in all available flavors (Local, SSH, with and
330-
without encryption).
331-
- Run the snapshots.
332-
- Restore snapshots.
333-
- Delete snapshots.
334-
- Schedule the snapshots using regular cron (e.g. _Every 5 minutes_) and
335-
anacron-like cron (_Repeatedly (anacran)_). Additionally schedule with udev
336-
(_When drive gets connected (udev)_).
328+
- Always start from terminal to catch silent errors and warnings.
329+
- Create backup profils in all available flavors (Local, SSH, each with and
330+
without encryption).
331+
- Take backup.
332+
- Restore backup.
333+
- Delete backup.
334+
- Schedule backups using
335+
- regular cron (e.g. _Every 5 minutes_)
336+
- anacron-like cron (_Repeatedly (anacran)_)
337+
- driven by USB-event using udev (_When drive gets connected (udev)_).
338+
- GUI Tests
339+
- Open and all available dialogs, check how they look and if BIT might
340+
crash.
341+
- Additionally use `qt6ct` and repeat the tests.
342+
- Try some fancy desktop environments (Mate, Budgie, …)
343+
- As the cherry on top of the ice cream, check the translation of the GUI
344+
in your native language(s).
337345
338346
## Other noteworthy things
339347

qt/manageprofiles/tab_general.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
QLabel,
2424
QLineEdit,
2525
QMessageBox,
26-
QStyle,
2726
QToolButton,
2827
QToolTip,
2928
QVBoxLayout,
@@ -576,14 +575,7 @@ def _cipher_combobox(self) -> combobox.BitComboBox:
576575
return combobox.BitComboBox(self, self.config.SSH_CIPHERS)
577576

578577
def _create_label_encfs_deprecation(self):
579-
# Icon
580-
icon = self.style().standardIcon(
581-
QStyle.StandardPixmap.SP_MessageBoxWarning)
582-
size = self.style().pixelMetric(
583-
QStyle.PixelMetric.PM_LargeIconSize)
584-
icon_label = QLabel(self)
585-
pixmap = icon.pixmap(size*2)
586-
icon_label.setPixmap(pixmap)
578+
icon_label = qttools.create_icon_label_warning()
587579

588580
# encfs deprecation warning (see #1734, #1735)
589581
txt = _('EncFS profile creation will be removed in the next minor '

qt/manageprofiles/tab_remove_retention.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
QHBoxLayout,
1818
QLabel,
1919
QSpinBox,
20-
QStyle,
2120
QToolTip,
2221
QWidget)
2322
from PyQt6.QtCore import Qt
@@ -174,17 +173,7 @@ def update_items_state(self, enabled):
174173
self.cbSmartRemoveRunRemoteInBackground.setVisible(enabled)
175174

176175
def _label_rule_execute_order(self) -> QWidget:
177-
# Icon
178-
icon = self.style().standardPixmap(
179-
QStyle.StandardPixmap.SP_MessageBoxInformation)
180-
icon = icon.scaled(
181-
icon.width()*2,
182-
icon.height()*2,
183-
Qt.AspectRatioMode.KeepAspectRatio)
184-
185-
icon_label = QLabel(self)
186-
icon_label.setPixmap(icon)
187-
icon_label.setFixedSize(icon.size())
176+
icon_label = qttools.create_icon_label_info(fixed_size_widget=True)
188177

189178
# Info text
190179
txt = _(

qt/qttools.py

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,17 @@
3232
QLibraryInfo,
3333
QT_VERSION_STR,
3434
QUrl)
35-
from PyQt6.QtWidgets import (QWidget,
35+
from PyQt6.QtWidgets import (QAbstractItemView,
36+
QApplication,
37+
QDialog,
3638
QFileDialog,
37-
QAbstractItemView,
39+
QLabel,
3840
QListView,
39-
QTreeView,
40-
QDialog,
41-
QApplication,
41+
QSystemTrayIcon,
42+
QStyle,
4243
QStyleFactory,
43-
QSystemTrayIcon)
44+
QTreeView,
45+
QWidget)
4446

4547
from packaging.version import Version
4648

@@ -185,6 +187,62 @@ def update_combo_profiles(config, combo_profiles, current_profile_id):
185187
if profile_id == current_profile_id:
186188
combo_profiles.set_current_profile_id(profile_id)
187189

190+
191+
def create_icon_label(
192+
icon_type: QStyle.StandardPixmap,
193+
icon_size: QStyle.PixelMetric = QStyle.PixelMetric.PM_LargeIconSize,
194+
fixed_size_widget: bool = False) -> QLabel:
195+
"""Return a ``QLabel`` instance containing an icon.
196+
197+
Args:
198+
icon_type: The icon, eg. info or warning.
199+
icon_size: Size reference.
200+
fixed_size_widget: Fix label size to its icon (default: False)
201+
202+
Returns:
203+
The QLabel
204+
"""
205+
style = QApplication.style()
206+
ico = style.standardIcon(icon_type)
207+
sz = style.pixelMetric(icon_size)
208+
209+
pixmap = ico.pixmap(sz)
210+
211+
label = QLabel()
212+
label.setPixmap(pixmap)
213+
214+
if fixed_size_widget:
215+
label.setFixedSize(pixmap.size())
216+
217+
return label
218+
219+
220+
def create_icon_label_info(
221+
icon_size: QStyle.PixelMetric = QStyle.PixelMetric.PM_LargeIconSize,
222+
fixed_size_widget: bool = False) -> QLabel:
223+
"""Return a QLabel with an info icon.
224+
225+
See `create_icon_label` for details.
226+
"""
227+
return create_icon_label(
228+
icon_type=QStyle.StandardPixmap.SP_MessageBoxInformation,
229+
icon_size=icon_size,
230+
fixed_size_widget=fixed_size_widget)
231+
232+
233+
def create_icon_label_warning(
234+
icon_size: QStyle.PixelMetric = QStyle.PixelMetric.PM_LargeIconSize,
235+
fixed_size_widget: bool = False) -> QLabel:
236+
"""Return a QLabel with a warning icon.
237+
238+
See `create_icon_label` for details.
239+
"""
240+
return create_icon_label(
241+
icon_type=QStyle.StandardPixmap.SP_MessageBoxWarning,
242+
icon_size=icon_size,
243+
fixed_size_widget=fixed_size_widget)
244+
245+
188246
# |---------------------|
189247
# | Misc / Uncatgorized |
190248
# |---------------------|

0 commit comments

Comments
 (0)