Browse Source

Fix temporary tempo item creation crash, also don't export them to lilypond anymore

master
Nils 3 years ago
parent
commit
40951f46b6
  1. 1
      CHANGELOG
  2. 10
      engine/api.py
  3. 11
      engine/tempotrack.py

1
CHANGELOG

@ -34,6 +34,7 @@ Add preview image to Lilypond properties and metadata
More information about the cursor and position in the status bar
Fix all drawn items to properly work with high zoom-out levels. Side effect: slightly better performance.
Better alignment for all drawn items.
Fix temporary tempo item creation crash, also don't export them to lilypond anymore.
Fix drawing of ties and staccato dots.
Fix ledger lines of added chord notes
Fix cursor jumping around on track change if you start near a metrical signature

10
engine/api.py

@ -2420,7 +2420,7 @@ def deleteTempoBlock(tempoBlockId):
def insertTempoItemAtAbsolutePosition(tickPositionAbsolute, unitsPerMinute, referenceTicks, graphType, description:str):
blockId, blockPosition = session.data.tempoTrack.tempoBlocKByAbsolutePosition(tickPositionAbsolute)
positionInTicksRelativeToBlock = tickPositionAbsolute - blockPosition
addTempoItem(blockId, positionInTicksRelativeToBlock, unitsPerMinute, referenceTicks, graphType, description)
return addTempoItem(blockId, positionInTicksRelativeToBlock, unitsPerMinute, referenceTicks, graphType, description)
def tempoAtTickPosition(tick):
tempoItem = session.data.tempoTrack.tempoAtTickPosition(tick)
@ -2447,8 +2447,12 @@ def insertTempoChangeDuringDuration(percentageUnitsPerMinuteAsFloat):
tempoItem = session.data.tempoTrack.tempoAtTickPosition(startTick)
#originalUnitsPerMinute, originalReferenceTicks = session.data.tempoTrack.tempoAtTickPosition(startTick)
newUnitsPerMinute = tempoItem.unitsPerMinute * percentageUnitsPerMinuteAsFloat
insertTempoItemAtAbsolutePosition(startTick, newUnitsPerMinute, tempoItem.referenceTicks, graphType = "standalone")
insertTempoItemAtAbsolutePosition(endTick, tempoItem.unitsPerMinute, tempoItem.referenceTicks, graphType = "standalone")
t = insertTempoItemAtAbsolutePosition(startTick, newUnitsPerMinute, tempoItem.referenceTicks, graphType = "standalone", description="tmp")
t.lilypondParameters["hide"] = True #Replace with Fermata or so
t = insertTempoItemAtAbsolutePosition(endTick, tempoItem.unitsPerMinute, tempoItem.referenceTicks, graphType = "standalone", description="tmp") # a tempo
t.lilypondParameters["hide"] = True
def currentTempoScalingFactor():
return session.data.tempoTrack.factor

11
engine/tempotrack.py

@ -48,7 +48,10 @@ class TempoItem(object):
self.unitsPerMinute = round(unitsPerMinute)
self.referenceTicks = round(referenceTicks)
self.graphType = "standalone" #options: linear, standalone
self.lilypondParameters = {"tempo": description} #for example 'Allegro' or 'Ein bischen schneller'. Only strings are allowed.
self.lilypondParameters = {
"tempo": description, #for example 'Allegro' or 'Ein bischen schneller'. Only strings are allowed.
"hide" : False, #True will skip ly-export, for fermatas and other temporary changes.
}
self._secondInit(parentBlock = None)
def _secondInit(self, parentBlock):
@ -65,6 +68,8 @@ class TempoItem(object):
self.referenceTicks = int(serializedObject["referenceTicks"])
self.graphType = serializedObject["graphType"]
self.lilypondParameters = serializedObject["lilypondParameters"]
if not "hide" in self.lilypondParameters: #Version 2.1.0
self.lilypondParameters["hide"] = False
self._secondInit(parentBlock = parentObject)
return self
@ -688,6 +693,10 @@ class TempoTrack(GraphTrackCC):
def lilypond(self):
"""Based on the static export"""
def _ly(tempoItem, nextTempoItem):
if tempoItem["lilypondParameters"]["hide"]:
return ""
if tempoItem["graphType"] in ("standalone", "linear"):
ramp = ""
if not tempoItem["graphType"] == "standalone":

Loading…
Cancel
Save