Browse Source

undo for initial metrical instruction

master
Nils 2 years ago
parent
commit
0cee1c6c54
  1. 12
      engine/api.py

12
engine/api.py

@ -1955,7 +1955,17 @@ def insertMetricalInstruction(treeOfInstructions, lilypondOverride = None):
def setInitialMetricalInstruction(treeOfInstructions, lilypondOverride:str=None): def setInitialMetricalInstruction(treeOfInstructions, lilypondOverride:str=None):
"""Variation of insertMetricalInstruction to set the initial one for ALL tracks""" """Variation of insertMetricalInstruction to set the initial one for ALL tracks.
Undo depends on it that all tracks have the same initial."""
#Undo
oldInitial = session.data.tracks[0].initialMetricalInstruction #the first one is the same as all.
def registeredUndoFunction():
setInitialMetricalInstruction(oldInitial.treeOfInstructions, oldInitial.lilypondParameters["override"])
session.history.register(registeredUndoFunction, descriptionString=f"Initial Metrical Instruction")
callbacks._historyChanged()
#New one
item = items.MetricalInstruction(treeOfInstructions) item = items.MetricalInstruction(treeOfInstructions)
if lilypondOverride: if lilypondOverride:

Loading…
Cancel
Save