From 04f0e95653c6ce95e8eb3f0a318e57087c21f9e1 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Mon, 27 Nov 2023 15:21:20 +0000 Subject: [PATCH] WIP V3: fix minor issues --- app/playlistmodel.py | 30 ++++++++++++++++-------------- app/playlists.py | 2 +- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/app/playlistmodel.py b/app/playlistmodel.py index 0603b50..8cc8622 100644 --- a/app/playlistmodel.py +++ b/app/playlistmodel.py @@ -1269,20 +1269,22 @@ class PlaylistProxyModel(QSortFilterProxyModel): 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 + if track_sequence.next.plr_id: + 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 + if track_sequence.now.plr_id: + 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) diff --git a/app/playlists.py b/app/playlists.py index 4aa11f9..1d59c20 100644 --- a/app/playlists.py +++ b/app/playlists.py @@ -618,7 +618,7 @@ class PlaylistTab(QTableView): self.menu.addSeparator() # Mark unplayed - if track_row and model.is_unplayed_row(model_row_number): + if track_row and model.is_played_row(model_row_number): self._add_context_menu( "Mark unplayed", lambda: self._mark_as_unplayed(self.get_selected_rows()),