diff --git a/lintunes/__init__.py b/lintunes/__init__.py index 8f82ea3..20cc21a 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.73.1" +__version__ = "0.73.2" diff --git a/lintunes/gui/shazam_import.py b/lintunes/gui/shazam_import.py index aafc97b..51bfb8e 100644 --- a/lintunes/gui/shazam_import.py +++ b/lintunes/gui/shazam_import.py @@ -50,10 +50,11 @@ class ShazamPreviewDialog(QDialog): self._tree.setRootIsDecorated(False) self._tree.setUniformRowHeights(True) header = self._tree.header() - header.setSectionResizeMode(0, QHeaderView.ResizeMode.Stretch) - header.setSectionResizeMode(1, QHeaderView.ResizeMode.ResizeToContents) - header.setSectionResizeMode(2, QHeaderView.ResizeMode.ResizeToContents) - header.setStretchLastSection(False) + # Every boundary drags; the note takes what's left. + header.setSectionResizeMode(QHeaderView.ResizeMode.Interactive) + header.resizeSection(0, 420) + header.resizeSection(1, 150) + header.setStretchLastSection(True) self._tree.itemChanged.connect(self._refresh_button) layout.addWidget(self._tree, 1) @@ -193,10 +194,11 @@ class ShazamImportWindow(QDialog): self._tree.setRootIsDecorated(False) self._tree.setUniformRowHeights(True) header = self._tree.header() - header.setSectionResizeMode(0, QHeaderView.ResizeMode.Stretch) - header.setSectionResizeMode(1, QHeaderView.ResizeMode.Interactive) - header.resizeSection(1, 230) - header.setStretchLastSection(False) + # The song's edge drags; the status (a long reason, often) takes + # what's left. + header.setSectionResizeMode(QHeaderView.ResizeMode.Interactive) + header.resizeSection(0, 420) + header.setStretchLastSection(True) for song in songs: item = QTreeWidgetItem([song.label(), WAITING]) item.setToolTip(0, f"{song.label()}\nShazamed {_when(song)}") diff --git a/tests/test_round103.py b/tests/test_round103.py index 4fe3163..90e9ec9 100644 --- a/tests/test_round103.py +++ b/tests/test_round103.py @@ -535,3 +535,17 @@ def test_import_shazams_end_to_end(window, qapp, monkeypatch): [track] = library.tracks.values() assert track.name == "Alpha (AcoustID)" assert shazam_window.status("n").startswith("Couldn't import") + + +def test_every_column_edge_can_be_dragged(qapp): + # A Stretch column beside the last one left no edge to drag, so a long + # "Couldn't import: …" was cut off for good (v0.73.2). + from PyQt6.QtWidgets import QHeaderView + from lintunes.gui import shazam_import as ui + window = ui.ShazamImportWindow([_song("a")]) + preview = ui.ShazamPreviewDialog(_Reader([_song("a")]), set(), [], None) + for tree in (window._tree, preview._tree): + header = tree.header() + for i in range(header.count() - 1): + assert header.sectionResizeMode(i) == QHeaderView.ResizeMode.Interactive + assert header.stretchLastSection()