V3 polish: header with "-" echoes section start text

This commit is contained in:
Keith Edmunds 2023-11-28 07:19:09 +00:00
parent 0f1d5117cc
commit 15c10431e6

View File

@ -358,8 +358,7 @@ class PlaylistModel(QAbstractTableModel):
Return text for display Return text for display
""" """
if not prd.path: if self.is_header_row(row):
# No track so this is a header row
if column == HEADER_NOTES_COLUMN: if column == HEADER_NOTES_COLUMN:
self.signals.span_cells_signal.emit( self.signals.span_cells_signal.emit(
row, HEADER_NOTES_COLUMN, 1, self.columnCount() - 1 row, HEADER_NOTES_COLUMN, 1, self.columnCount() - 1
@ -653,6 +652,19 @@ class PlaylistModel(QAbstractTableModel):
unplayed_count += 1 unplayed_count += 1
duration += row_prd.duration 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 return prd.note
def hide_played_tracks(self, hide: bool) -> None: def hide_played_tracks(self, hide: bool) -> None: