fix(2.03.35): settings pages no longer widen the dialog

_switch_row description labels had set_line_wrap(True) but no
set_max_width_chars, so GTK computed their natural width as the full
un-wrapped text (~700px for 87-char descriptions). With NEVER horizontal
policy on the page ScrolledWindow this propagated to the dialog, making
Keyboard/Wakeword/Engines/Benchmark pages 1000–1360px wide.

Fix: add set_max_width_chars(50) to description labels, and change the
page SW horizontal policy from NEVER to AUTOMATIC as a safety net.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mARTin-B78 2026-06-10 14:52:28 +02:00
parent 1f3bbf2668
commit 79d6020fc6
3 changed files with 16 additions and 2 deletions

View File

@ -9,6 +9,19 @@ The version is defined in [`blitztext/__init__.py`](blitztext/__init__.py).
## [Unreleased]
## [2.03.35] - 2026-06-10
### Fixed
- **Settings pages no longer widen the dialog.** `_switch_row` description
labels had `set_line_wrap(True)` but no `set_max_width_chars`, so GTK
computed their natural width as the full un-wrapped text (87 chars × ~8 px
= ~700 px). With `NEVER` horizontal policy on the page `ScrolledWindow`,
that propagated directly to the dialog width, making Keyboard, Wakeword,
STT Engines, and Benchmark pages ~10001360 px wide. Fixed by adding
`set_max_width_chars(50)` (≈ 375 px) to description labels, and changed the
page `ScrolledWindow` horizontal policy from `NEVER` to `AUTOMATIC` as a
safety net for any other wide widget.
## [2.03.34] - 2026-06-10
### Fixed

View File

@ -6,4 +6,4 @@ counterpart to the macOS Blitztext menu bar app: it runs natively on the host
(not in a container) so it can type into any application via xdotool.
"""
__version__ = "2.03.34"
__version__ = "2.03.35"

View File

@ -267,6 +267,7 @@ def _switch_row(parent, label: str, switch: Gtk.Switch, description: str = "",
desc = Gtk.Label(label=description, xalign=0.0)
desc.set_line_wrap(True)
desc.set_max_width_chars(50) # bound natural width so NEVER-policy SW doesn't grow the dialog
desc.get_style_context().add_class("dim-label")
row.pack_start(desc, True, True, 0)
@ -882,7 +883,7 @@ class SettingsDialog:
def _stack_page(title: str) -> Gtk.Box:
outer = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
sw = Gtk.ScrolledWindow()
sw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.ALWAYS)
sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS)
sw.set_overlay_scrolling(False)
outer.pack_start(sw, True, True, 0)
inner = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=2)