Clear fade graph when clearing next track
This commit is contained in:
parent
59b6b87186
commit
bd7fb79610
@ -797,4 +797,22 @@ class TrackSequence:
|
||||
current: Optional[RowAndTrack] = None
|
||||
previous: Optional[RowAndTrack] = None
|
||||
|
||||
def set_next(self, rat: Optional[RowAndTrack]) -> None:
|
||||
"""
|
||||
Set the 'next' track to be passed rat. Clear
|
||||
any previous next track. If passed rat is None
|
||||
just clear existing next track.
|
||||
"""
|
||||
|
||||
# Clear any existing fade graph
|
||||
if self.next and self.next.fade_graph:
|
||||
self.next.fade_graph.clear()
|
||||
|
||||
if rat is None:
|
||||
self.next = None
|
||||
else:
|
||||
self.next = rat
|
||||
self.next.create_fade_graph()
|
||||
|
||||
|
||||
track_sequence = TrackSequence()
|
||||
|
||||
@ -343,7 +343,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
Clear next track
|
||||
"""
|
||||
|
||||
track_sequence.next = None
|
||||
track_sequence.set_next(None)
|
||||
self.update_headers()
|
||||
|
||||
def clear_selection(self) -> None:
|
||||
@ -1418,8 +1418,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
|
||||
# We want to use play_next() to resume, so copy the previous
|
||||
# track to the next track:
|
||||
track_sequence.next = track_sequence.previous
|
||||
track_sequence.next.create_fade_graph()
|
||||
track_sequence.set_next(track_sequence.previous)
|
||||
|
||||
# Now resume playing the now-next track
|
||||
self.play_next(track_sequence.next.resume_marker)
|
||||
|
||||
@ -1186,7 +1186,7 @@ class PlaylistModel(QAbstractTableModel):
|
||||
if row_number is None:
|
||||
# Clear next track
|
||||
if track_sequence.next is not None:
|
||||
track_sequence.next = None
|
||||
track_sequence.set_next(None)
|
||||
else:
|
||||
# Get playlistrow_id of row
|
||||
try:
|
||||
@ -1205,8 +1205,7 @@ class PlaylistModel(QAbstractTableModel):
|
||||
if track_sequence.next:
|
||||
old_next_row = track_sequence.next.row_number
|
||||
|
||||
track_sequence.next = rat
|
||||
track_sequence.next.create_fade_graph()
|
||||
track_sequence.set_next(rat)
|
||||
self.invalidate_row(row_number)
|
||||
|
||||
if Config.WIKIPEDIA_ON_NEXT:
|
||||
|
||||
@ -949,5 +949,6 @@ class PlaylistTab(QTableView):
|
||||
def _unmark_as_next(self) -> None:
|
||||
"""Rescan track"""
|
||||
|
||||
self.source_model.set_next_row(None)
|
||||
track_sequence.set_next(None)
|
||||
self.clear_selection()
|
||||
self.signals.next_track_changed_signal.emit()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user