Browse Source

update groups after deleting last track of a group

master
Nils 4 years ago
parent
commit
b59e224e8f
  1. 13
      engine/api.py

13
engine/api.py

@ -552,14 +552,17 @@ def _reinsertDeletedTrack(track, trackIndex):
def deleteTrack(trackId):
track = session.data.trackById(trackId)
oldIndex = session.data.tracks.index(track)
deletedTrack = session.data.deleteTrack(track)
with session.history.sequence("Delete Track"):
setTrackGroup(trackId, "") #has it's own undo
deletedTrack = session.data.deleteTrack(track)
if not session.data.tracks: #always keep at least one track
with session.history.sequence("Delete Track and autocreated Track"):
if not session.data.tracks: #always keep at least one track
addTrack() #has it's own undo
session.history.register(lambda tr=deletedTrack, pos=oldIndex: _reinsertDeletedTrack(tr, pos), descriptionString="Delete Track")
else:
session.history.register(lambda tr=deletedTrack, pos=oldIndex: _reinsertDeletedTrack(tr, pos), descriptionString="Delete Track")
else:
session.history.register(lambda tr=deletedTrack, pos=oldIndex: _reinsertDeletedTrack(tr, pos), descriptionString="Delete Track")
print (session.data.groups)
updatePlayback()
callbacks._numberOfTracksChanged()

Loading…
Cancel
Save