if(parentTrackanddeletedBlock):#not the last block
result=track.deleteBlock(block)
ifresult:#not the last block
parentTrack,deletedBlock=result
#Blocks are never truly deleted but a stored in the Block.allBlocks dict. This keeps the reference to this deleted block alive and it can be added through rearrange, which gets its blocks from this dict.
#We don't need to check if deleting succeeded because we already checked if there are more than 1 blocks in the track above.
oldTrack.deleteBlock(block)#It is important that we delete the block at exactly this point in time, not ealier. Otherwise the reference for undo will go away.
oldTrack.deleteBlock(block)#Check for last block is above. It is important that we delete the block at exactly this point in time, not ealier. Otherwise the reference for undo will go away.
oldccTrack.deleteBlock(graphBlock)#It is important that we delete the block at exactly this point in time, not ealier. Otherwise the reference for undo will go away.
oldccTrack.deleteBlock(graphBlock)#Check for last block is above. It is important that we delete the block at exactly this point in time, not earlier. Otherwise the reference for undo will go away.
self.toPosition(originalPosition,strict=False)#has head() in it. strict=False just leaves the cursor at head if we can't return to the position because it got deleted.
whileself.left():#stops automatically at the beginning of the track
ifself.currentItem().logicalDuration()>0ornotself.state.ticksSinceLastMeasureStartLive==0:#we found the boundary between this measure and the one before it
curItem=self.currentItem()
ifcurItemandcurItem.logicalDuration()>0ornotself.state.ticksSinceLastMeasureStartLive==0:#we found the boundary between this measure and the one before it
assertlastDotOnLine>=noteExportObject["dotOnLine"],(lastDotOnLine,noteExportObject["dotOnLine"])#If this fails means the engine function did not call Chord.notelist.sort() after modification