From dfb45dd0ffbfa97118498576b5009d846282e81e Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Mon, 27 Nov 2023 11:52:29 +0000 Subject: [PATCH] WIP V3: Don't hide next/current row --- app/playlistmodel.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/app/playlistmodel.py b/app/playlistmodel.py index 3aabf76..0603b50 100644 --- a/app/playlistmodel.py +++ b/app/playlistmodel.py @@ -1031,12 +1031,14 @@ class PlaylistModel(QAbstractTableModel): Set row_number as next track. If row_number is None, clear next track. """ + next_row_was = track_sequence.next.plr_rownum + if next_row_was is not None: + self.invalidate_row(next_row_was) + if row_number is None: - next_row_was = track_sequence.next.plr_rownum if next_row_was is None: return track_sequence.next = PlaylistTrack() - self.invalidate_row(next_row_was) self.signals.next_track_changed_signal.emit() return @@ -1265,6 +1267,22 @@ class PlaylistProxyModel(QSortFilterProxyModel): if self.playlist_model.played_tracks_hidden: if self.playlist_model.is_played_row(source_row): + # Don't hide current or next track + with Session() as session: + next_plr = session.get(PlaylistRows, track_sequence.next.plr_id) + if ( + next_plr + and next_plr.plr_rownum == source_row + and next_plr.playlist_id == self.playlist_model.playlist_id + ): + return True + now_plr = session.get(PlaylistRows, track_sequence.now.plr_id) + if ( + now_plr + and now_plr.plr_rownum == source_row + and now_plr.playlist_id == self.playlist_model.playlist_id + ): + return True return False return super().filterAcceptsRow(source_row, source_parent)