From 15c10431e6229a21caae39e139d16e607b7ad386 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Tue, 28 Nov 2023 07:19:09 +0000 Subject: [PATCH] V3 polish: header with "-" echoes section start text --- app/playlistmodel.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/playlistmodel.py b/app/playlistmodel.py index a8b46bb..c75ec22 100644 --- a/app/playlistmodel.py +++ b/app/playlistmodel.py @@ -358,8 +358,7 @@ class PlaylistModel(QAbstractTableModel): Return text for display """ - if not prd.path: - # No track so this is a header row + if self.is_header_row(row): if column == HEADER_NOTES_COLUMN: self.signals.span_cells_signal.emit( row, HEADER_NOTES_COLUMN, 1, self.columnCount() - 1 @@ -653,6 +652,19 @@ class PlaylistModel(QAbstractTableModel): unplayed_count += 1 duration += row_prd.duration + elif prd.note == "-": + # If the hyphen is the only thing on the line, echo the note + # tha started the section without the trailing "+". + for row_number in range(prd.plr_rownum - 1, -1, -1): + row_prd = self.playlist_rows[row_number] + if self.is_header_row(row_number): + if row_prd.note.endswith("-"): + # We didn't find a matching section start + break + if row_prd.note.endswith("+"): + return f"[End: {row_prd.note[:-1]}]" + return "-" + return prd.note def hide_played_tracks(self, hide: bool) -> None: