From 6ede0ab7eac6b38bd3ed4346a6eb22e53c093d82 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Sun, 4 Sep 2022 20:55:40 +0100 Subject: [PATCH] Pull playlist changes from v2_editor - minimum row height - intelligent row resizing --- app/playlists.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/playlists.py b/app/playlists.py index 0639e44..8e1d626 100644 --- a/app/playlists.py +++ b/app/playlists.py @@ -57,6 +57,7 @@ from models import ( start_time_re = re.compile(r"@\d\d:\d\d:\d\d") HEADER_NOTES_COLUMN = 2 +MINIMUM_ROW_HEIGHT = 30 class RowMeta: @@ -149,6 +150,8 @@ class PlaylistTab(QTableWidget): [a.heading for a in list(sorted(columns.values(), key=lambda item: item.idx))] ) + self.horizontalHeader().sectionResized.connect( + self.resizeRowsToContents) self.setAcceptDrops(True) self.viewport().setAcceptDrops(True) @@ -1021,9 +1024,6 @@ class PlaylistTab(QTableWidget): (self.item(row, columns['row_notes'].idx) .setBackground(QColor(note_colour))) - # Ensure content is visible by wrapping cells - self.resizeRowToContents(row) - # Highlight low bitrates if track.bitrate: if track.bitrate < Config.BITRATE_LOW_THRESHOLD: @@ -1125,8 +1125,6 @@ class PlaylistTab(QTableWidget): self._set_row_colour(row, QColor(note_colour)) # Section headers are always bold self._set_row_bold(row) - # Ensure content is visible by wrapping cells - self.resizeRowToContents(row) continue # Have we had a section start but not end? @@ -1136,10 +1134,12 @@ class PlaylistTab(QTableWidget): self._get_section_timing_string(section_time, no_end=True) ) + # Ensure content is visible by wrapping cells + self.resizeRowToContents(row) + # Scroll to put next track Config.SCROLL_TOP_MARGIN from the # top. Rows number from zero, so set (current_row - # Config.SCROLL_TOP_MARGIN + 1) row to be top row - if next_row is not None: top_row = max(0, next_row - Config.SCROLL_TOP_MARGIN + 1) scroll_item = self.item(top_row, 0)