v0.73.2: Import Shazams' columns can be resized

The song column was Stretch beside the last column, so there was no edge
to drag and a long "Couldn't import: …" stayed cut off. Every edge now
drags and the last column (status / note) takes what's left.
This commit is contained in:
2026-10-20 22:29:16 -07:00
parent b76a69f504
commit 5f985929bf
3 changed files with 25 additions and 9 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
"""LinTunes — iTunes-style music library manager and player for Linux."""
__version__ = "0.73.1"
__version__ = "0.73.2"
+10 -8
View File
@@ -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)}")
+14
View File
@@ -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()