|
|
@ -921,6 +921,49 @@ def unlinkBlock(blockId): |
|
|
|
#assert newData |
|
|
|
#_setBlockData(block, newData) #handles undo and callbacks |
|
|
|
|
|
|
|
def moveBlockToEndOfTrack(blockId): |
|
|
|
"""Get a list of all blocks. Take the given one and place it at the end. |
|
|
|
This is a high level function using rearrangeBlocks(), which does all the callbacks and |
|
|
|
history""" |
|
|
|
|
|
|
|
track, block = session.data.blockById(blockId) |
|
|
|
|
|
|
|
currentBlockOrder = track.asListOfBlockIds() |
|
|
|
|
|
|
|
if len(currentBlockOrder) == 1: |
|
|
|
return |
|
|
|
|
|
|
|
assert currentBlockOrder.count(blockId) == 1 |
|
|
|
currentBlockOrder.remove(blockId) #modifies list in place |
|
|
|
currentBlockOrder.append(blockId) |
|
|
|
|
|
|
|
rearrangeBlocks(id(track), currentBlockOrder) |
|
|
|
|
|
|
|
def moveBlockToStartOfTrack(blockId): |
|
|
|
"""Like moveBlockToEndOfTrack, but to the start""" |
|
|
|
|
|
|
|
track, block = session.data.blockById(blockId) |
|
|
|
|
|
|
|
currentBlockOrder = track.asListOfBlockIds() |
|
|
|
|
|
|
|
if len(currentBlockOrder) == 1: |
|
|
|
return |
|
|
|
|
|
|
|
assert currentBlockOrder.count(blockId) == 1 |
|
|
|
currentBlockOrder.remove(blockId) #modifies list in place |
|
|
|
currentBlockOrder.insert(0, blockId) |
|
|
|
|
|
|
|
rearrangeBlocks(id(track), currentBlockOrder) |
|
|
|
|
|
|
|
def moveCurrentBlockToEndOfTrack(): |
|
|
|
"""moveBlockToEndOfTrack for cursor operation""" |
|
|
|
moveBlockToEndOfTrack(id(session.data.currentTrack().currentBlock())) |
|
|
|
|
|
|
|
def moveCurrentBlockToStartOfTrack(): |
|
|
|
"""moveBlockToEndOfTrack for cursor operation""" |
|
|
|
moveBlockToStartOfTrack(id(session.data.currentTrack().currentBlock())) |
|
|
|
|
|
|
|
|
|
|
|
#deprecated |
|
|
|
def _setBlockData(block, newData): |
|
|
|
"""DEPRECATED. This did not work. The linked blocks were not reduced. |
|
|
@ -930,7 +973,6 @@ def _setBlockData(block, newData): |
|
|
|
block.data = newData |
|
|
|
#no callbacks needed. |
|
|
|
|
|
|
|
|
|
|
|
#Cursor |
|
|
|
|
|
|
|
def getCursorPitch(): |
|
|
|