Przeglądaj źródła

fix missing lilypond variable. also protect export from crashing everything§

master
Nils 3 lat temu
rodzic
commit
c793182687
  1. 16
      engine/api.py
  2. 10
      engine/track.py

16
engine/api.py

@ -2493,13 +2493,23 @@ def midiRelativeChannelReset():
#Lilypond
def lilypondText(text):
insertItem(items.LilypondText(text))
try:
insertItem(items.LilypondText(text))
except Exception as err:
logger.error(err)
def exportLilypond(absoluteFilePath):
lilypond.saveAsLilypond(session.data, absoluteFilePath)
try:
lilypond.saveAsLilypond(session.data, absoluteFilePath)
except Exception as err:
logger.error(err)
def showPDF():
lilypond.saveAsLilypondPDF(session.data, openPDF = True)
try:
lilypond.saveAsLilypondPDF(session.data, openPDF = True)
except Exception as err:
logger.error(err)
def getLilypondBarlineList()->Iterable[Tuple[str, Callable]]:
"""Return a list of very similar functions for a convenience menu in a GUI.

10
engine/track.py

@ -818,9 +818,8 @@ class Track(object):
"""Called by score.lilypond(), returns a string.
We carry a dict around to hold lilypond on/off markers like tuplets
that need to set as ranges.
that need to set as ranges. This dict begins here. Each track
gets its own.
"""
for item in self.blocks[0].data[:4]:
if type(item) is MetricalInstruction:
@ -829,10 +828,11 @@ class Track(object):
else:
timeSig = "\\once \\override Staff.TimeSignature #'stencil = ##f \\cadenzaOn "
upbeatLy = "\\partial {} ".format(Duration.createByGuessing(self.upbeatInTicks).lilypond()) if self.upbeatInTicks else ""
carryLilypondRanges = {} #handed from item to item for ranges such as tuplets. Can act like a stack or simply remember stuff.
upbeatLy = "\\partial {} ".format(Duration.createByGuessing(self.upbeatInTicks).lilypond(carryLilypondRanges)) if self.upbeatInTicks else ""
data = " ".join(block.lilypond(carryLilypondRanges) for block in self.blocks)
if data:
return timeSig + upbeatLy + data

Ładowanie…
Anuluj
Zapisz