From 491e31b4d64d10876a0c4d5aec9b7ca2b8263812 Mon Sep 17 00:00:00 2001 From: trav Date: Sat, 10 Oct 2026 01:54:59 -0700 Subject: [PATCH] v0.44.1: Preferences headings stay bold under the app's style sheet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The headings were set with setFont, which the app's own style sheet (theme.apply_theme) overrides on re-polish — bold in a bare dialog, plain in the running app. A style sheet on the heading itself wins. The test now applies the theme first, as the app does. --- lintunes/__init__.py | 2 +- lintunes/gui/preferences_dialog.py | 7 +++---- tests/test_round79.py | 9 +++++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lintunes/__init__.py b/lintunes/__init__.py index 1b8ed32..35a48f3 100644 --- a/lintunes/__init__.py +++ b/lintunes/__init__.py @@ -1,3 +1,3 @@ """LinTunes — iTunes-style music library manager and player for Linux.""" -__version__ = "0.44.0" +__version__ = "0.44.1" diff --git a/lintunes/gui/preferences_dialog.py b/lintunes/gui/preferences_dialog.py index 09cbe36..8ff71ff 100644 --- a/lintunes/gui/preferences_dialog.py +++ b/lintunes/gui/preferences_dialog.py @@ -191,10 +191,9 @@ class PreferencesDialog(QDialog): the UI size changes, since the app font moves with it.""" size = QFontInfo(QApplication.font()).pixelSize() + HEADING_EXTRA_PX for header in self._headings: - font = QFont(QApplication.font()) - font.setPixelSize(size) - font.setBold(True) - header.setFont(font) + # A style sheet, not setFont: the app's own style sheet (theme) + # re-polishes widgets and would quietly put the plain font back. + header.setStyleSheet(f"font-weight: bold; font-size: {size}px;") def _show_page(self, row: int): self.pages.setCurrentIndex(row) diff --git a/tests/test_round79.py b/tests/test_round79.py index 85e71fd..444820f 100644 --- a/tests/test_round79.py +++ b/tests/test_round79.py @@ -161,14 +161,19 @@ def _prefs_dialog(prefs): class TestHeadings: def test_bold_and_two_px_larger(self, qapp, tmp_path): - dialog = _prefs_dialog(Preferences(tmp_path)) + from lintunes import theme + prefs = Preferences(tmp_path) + theme.apply_theme(QApplication.instance(), prefs) # as the app runs + dialog = _prefs_dialog(prefs) + dialog.show() text_px = QFontInfo(QApplication.font()).pixelSize() headings = dialog.findChildren(QLabel, "prefs-heading") assert {h.text() for h in headings} >= {"Interface", "Visualizer", "Colors", "Last.fm"} for heading in headings: assert heading.font().bold() - assert heading.font().pixelSize() == text_px + 2 + assert QFontInfo(heading.font()).pixelSize() == text_px + 2 + dialog.close() def test_the_boxes_contents_stay_plain(self, qapp, tmp_path): dialog = _prefs_dialog(Preferences(tmp_path))