@ -599,9 +599,15 @@ def _reinsertDeletedTrack(track, trackIndex):
callbacks . _numberOfTracksChanged ( )
callbacks . _numberOfTracksChanged ( )
def deleteTrack ( trackId ) :
def deleteTrack ( trackId ) :
""" indirectly calls session.data.buildAllTracks() through group change.
This is wasteful , but it acceptable . We let the code stay simple in exchange for redundant
re - building of all tracks .
"""
track = session . data . trackById ( trackId )
track = session . data . trackById ( trackId )
if not track : return
if not track : return
oldIndex = session . data . tracks . index ( track )
oldIndex = session . data . tracks . index ( track )
with session . history . sequence ( " Delete Track " ) :
with session . history . sequence ( " Delete Track " ) :
setTrackGroup ( trackId , " " ) #has it's own undo
setTrackGroup ( trackId , " " ) #has it's own undo
deletedTrack = session . data . deleteTrack ( track )
deletedTrack = session . data . deleteTrack ( track )
@ -613,7 +619,9 @@ def deleteTrack(trackId):
session . history . register ( lambda tr = deletedTrack , pos = oldIndex : _reinsertDeletedTrack ( tr , pos ) , descriptionString = " Delete Track " )
session . history . register ( lambda tr = deletedTrack , pos = oldIndex : _reinsertDeletedTrack ( tr , pos ) , descriptionString = " Delete Track " )
updatePlayback ( )
updatePlayback ( )
callbacks . _numberOfTracksChanged ( )
callbacks . _numberOfTracksChanged ( ) #TODO: throws a console error "port not found". but that is not critical.
def moveTrack ( trackId , newIndex ) :
def moveTrack ( trackId , newIndex ) :
""" index is 0 based.
""" index is 0 based.
@ -667,7 +675,7 @@ def setTrackGroup(trackId, groupName:str):
if not track . group == groupName :
if not track . group == groupName :
if not groupName . lower ( ) in ( track . sequencerInterface . name . lower ( ) for track in session . data . tracks ) :
if not groupName . lower ( ) in ( track . sequencerInterface . name . lower ( ) for track in session . data . tracks ) :
session . history . register ( lambda tr = trackId , v = track . group : setTrackGroup ( trackId , v ) , descriptionString = " Track Group " )
session . history . register ( lambda tr = trackId , v = track . group : setTrackGroup ( trackId , v ) , descriptionString = " Track Group " )
session . data . setGroup ( track , groupName ) #includes session.data.buildAllTracks()
session . data . setGroup ( track , groupName ) #includes session.data.buildAllTracks(). This is wasteful, but it acceptable. We let the code stay simple in exchange for redundant re-building of all tracks.
updatePlayback ( )
updatePlayback ( )
callbacks . _numberOfTracksChanged ( )
callbacks . _numberOfTracksChanged ( )