From 042c253d2f45868d2233e90dddd3135a81dc97c7 Mon Sep 17 00:00:00 2001 From: EKNr1 Date: Mon, 27 Jan 2025 14:30:45 +0100 Subject: [PATCH] Added playing mark to tabs of currently playing playlist. --- wobuzz/ui/playlist.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/wobuzz/ui/playlist.py b/wobuzz/ui/playlist.py index f2ac0db..0a4c047 100644 --- a/wobuzz/ui/playlist.py +++ b/wobuzz/ui/playlist.py @@ -121,8 +121,17 @@ class PlaylistView(QTreeWidget): self.app.player.play_track_in_playlist(index) def on_track_change(self, previous_track, track): - # unmark the previous track and mark the current track as playing + # unmark the previous track and playlist and mark the current track and playlist as playing + + playlist_tabs = self.parent().parent() + index = playlist_tabs.indexOf(self) # tab index of this playlist + if previous_track: + # unmark all playlists by looping through the tabs + for i in range(playlist_tabs.count()): + playlist_tabs.setTabIcon(i, QIcon(None)) + + # unmark the previous track in all playlists for item in previous_track.items: item.setIcon(0, QIcon(None)) item.setFont(1, self.normal_font) @@ -130,6 +139,9 @@ class PlaylistView(QTreeWidget): item.setFont(3, self.normal_font) if track: + playlist_tabs.setTabIcon(index, self.playing_mark) # mark this playlist + + # mark the current track in this playlist item = self.topLevelItem(self.app.player.current_playlist.current_track_index) item.setIcon(0, self.playing_mark) item.setFont(1, self.bold_font)