Clear start/end time for unplayed tracks above current

Fixes #53
This commit is contained in:
Keith Edmunds 2021-08-23 19:25:47 +01:00
parent 54cfb1191a
commit e4fe4b576e

View File

@ -994,6 +994,18 @@ class PlaylistTab(QTableWidget):
# Set colours and start times
next_start_time = None
# Don't change start times for tracks that have been played.
# For unplayed tracks, if there's a 'current' or 'next'
# track marked, populate start times from then onwards. If
# neither, populate start times from first note with a start
# time.
if current and next:
start_times_row = min(current, next)
else:
start_times_row = current or next
if not start_times_row:
start_times_row = 0
# Cycle through all rows
for row in range(self.rowCount()):
# We can't calculate start times until next_start_time is
@ -1074,12 +1086,16 @@ class PlaylistTab(QTableWidget):
self._set_row_not_bold(row)
else:
# Set start/end times only if we haven't played it yet
if next_start_time:
if next_start_time and row >= start_times_row:
self._set_row_start_time(row, next_start_time)
next_start_time = self._calculate_next_start_time(
session, row, next_start_time)
# Set end time
self._set_row_end_time(row, next_start_time)
else:
# Clear start and end time
self._set_row_start_time(row, None)
self._set_row_end_time(row, None)
# Don't dim unplayed tracks
self._set_row_bold(row)