Compare commits

...

5 Commits

Author SHA1 Message Date
Keith Edmunds
c9c47c3133 Retain current/next colours when pasting tracks 2023-03-17 23:07:14 +00:00
Keith Edmunds
0b2e7c7e31 Update last played time when track ends 2023-03-17 22:50:54 +00:00
Keith Edmunds
a30f054eb0 Set tab colours correctly 2023-03-17 22:43:36 +00:00
Keith Edmunds
eafacc3b21 Retain current/next colouring after editing notes 2023-03-17 18:28:32 +00:00
Keith Edmunds
a29bf3fce5 Fix first track staying green after end 2023-03-17 16:27:01 +00:00
2 changed files with 22 additions and 21 deletions

View File

@ -1210,14 +1210,6 @@ class Window(QMainWindow, Ui_MainWindow):
# If there's currently a track playing, fade it.
self.stop_playing(fade=True)
# Ensure playlist tabs are the correct colour
# If next track is on a different playlist_tab to the
# current track, reset the current track playlist_tab colour
current_tab = self.current_track.playlist_tab
if current_tab and current_tab != self.next_track.playlist_tab:
self.set_tab_colour(current_tab,
QColor(Config.COLOUR_NORMAL_TAB))
# Move next track to current track.
# stop_playing() above has called end_of_track_actions()
# which will have populated self.previous_track
@ -1232,6 +1224,7 @@ class Window(QMainWindow, Ui_MainWindow):
return
# Set current track playlist_tab colour
current_tab = self.current_track.playlist_tab
if current_tab:
self.set_tab_colour(
current_tab, QColor(Config.COLOUR_CURRENT_TAB))
@ -1257,17 +1250,6 @@ class Window(QMainWindow, Ui_MainWindow):
# Disable play next controls
self.disable_play_next_controls()
# If previous track playlist is showing and that's not the
# current track playlist, we need to reset the current track
# highlighting
if (
self.previous_track.playlist_tab == self.visible_playlist_tab()
and
self.current_track.playlist_tab != self.visible_playlist_tab()
and self.previous_track.plr_id
):
self.previous_track.playlist_tab.clear_next()
# Update headers
self.update_headers()

View File

@ -357,6 +357,11 @@ class PlaylistTab(QTableWidget):
if update_next or update_current:
self.musicmuster.update_headers()
if update_current:
self._set_row_colour_current(row)
elif update_next:
self._set_row_colour_next(row)
self.clear_selection()
def closeEditor(self,
@ -596,14 +601,20 @@ class PlaylistTab(QTableWidget):
def play_ended(self) -> None:
"""
Called by musicmuster when play has ended
Called by musicmuster when play has ended.
current_track points to track that's just finished
"""
row_number = self._get_current_track_row_number()
if not row_number:
if row_number is None:
return
self._set_row_colour_default(row_number)
self.clear_selection()
self._set_row_last_played_time(
row_number, self.musicmuster.current_track.start_time)
with Session() as session:
self._set_row_note_colour(session, row_number)
@ -693,6 +704,14 @@ class PlaylistTab(QTableWidget):
# Queue up time calculations to take place after UI has
# updated
self._update_start_end_times(session)
# It's possible that the current/next tracks are in this
# playlist, so check and set.
current_row = self._get_current_track_row_number()
if current_row is not None:
self._set_row_colour_current(current_row)
next_row = self._get_next_track_row_number()
if next_row is not None:
self._set_row_colour_next(next_row)
# Needed to wrap notes column correctly - add to event queue so
# that it's processed after list is populated
QTimer.singleShot(0, self.tab_visible)