WIP: playlists.py refactor
Reset background colour of current track when track ended.
This commit is contained in:
parent
0794f061ee
commit
19377a8e1c
@ -722,17 +722,20 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
# doesn't see player=None and kick off end-of-track actions
|
||||
self.playing = False
|
||||
|
||||
# Remove currently playing track colour
|
||||
if (
|
||||
self.current_track and
|
||||
self.current_track.playlist_tab and
|
||||
self.current_track.plr_id
|
||||
):
|
||||
self.current_track.playlist_tab.reset_plr_row_colour(
|
||||
self.current_track.plr_id)
|
||||
|
||||
# Reset PlaylistTrack objects
|
||||
if self.current_track.track_id:
|
||||
self.previous_track = self.current_track
|
||||
self.current_track = PlaylistTrack()
|
||||
|
||||
# Repaint playlist to remove currently playing track colour
|
||||
# What was current track is now previous track
|
||||
with Session() as session:
|
||||
if self.previous_track.playlist_tab:
|
||||
self.previous_track.playlist_tab.update_display(session)
|
||||
|
||||
# Reset clocks
|
||||
self.frame_fade.setStyleSheet("")
|
||||
self.frame_silent.setStyleSheet("")
|
||||
|
||||
@ -830,6 +830,15 @@ class PlaylistTab(QTableWidget):
|
||||
# Reset drag mode
|
||||
self.setDragEnabled(False)
|
||||
|
||||
def reset_plr_row_colour(self, plr_id: int) -> None:
|
||||
"""Reset background of row pointed to by plr_id"""
|
||||
|
||||
row = self._plrid_to_row_number(plr_id)
|
||||
if not row:
|
||||
return
|
||||
|
||||
self._set_row_colour(row, None)
|
||||
|
||||
def save_playlist(self, session: scoped_session) -> None:
|
||||
"""
|
||||
Get the PlaylistRow objects for each row in the display. Correct
|
||||
|
||||
Loading…
Reference in New Issue
Block a user