From 9b041dec8c2fc721a8a1fdac714dd404faa1eaa2 Mon Sep 17 00:00:00 2001 From: Nils Date: Thu, 5 May 2022 21:51:35 +0200 Subject: [PATCH] slightly better lilypond export indent --- engine/api.py | 2 +- engine/block.py | 3 +-- engine/items.py | 2 +- engine/track.py | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/engine/api.py b/engine/api.py index ef9c53a..3541d74 100644 --- a/engine/api.py +++ b/engine/api.py @@ -1750,7 +1750,7 @@ def insertCommonMetricalInstrucions(scheme): "3/2" : (D2, D2, D2), } lilypond = { - "off" : "\\mark \"X\" \\cadenzaOn ", + "off" : "\\mark \"X\" \\cadenzaOn", "2/4" : "\\cadenzaOff \\time 2/4", "3/4" : "\\cadenzaOff \\time 3/4", "4/4" : "\\cadenzaOff \\time 4/4", diff --git a/engine/block.py b/engine/block.py index cb3767e..4dd7681 100644 --- a/engine/block.py +++ b/engine/block.py @@ -349,5 +349,4 @@ class Block(object): such as tuplets. Can act like a stack or simply remember stuff. """ - return " ".join(item.lilypond(carryLilypondRanges) for item in self.data) - + return "\n % Block: " + self.name + "\n " + " ".join(item.lilypond(carryLilypondRanges) for item in self.data) diff --git a/engine/items.py b/engine/items.py index aa7e2f0..57e36f1 100644 --- a/engine/items.py +++ b/engine/items.py @@ -2411,7 +2411,7 @@ class MetricalInstruction(Item): if not type(value) is int: raise ValueError("Only integers are allowed in a metrical instruction. You used {}. Cast to int if you are sure your float is x.0, e.g. in a dotted quarter note created by D4*1.5".format(value)) - self.treeOfInstructions = treeOfInstructions #if you skipped the docstring. this is a 4/4: ((D4, D4), (D4, D4)) . If empty no barlines will get drawn + self.treeOfInstructions = treeOfInstructions #this is a 4/4: ((D4, D4), (D4, D4)) . If empty no barlines will get drawn self.isMetrical = isMetrical #If False all dynamic playback modifications based on the metre will be deactivated but barlines will still be created. This is forced to become false when the treeOfInstructions is 0 ticks. self._secondInit(parentBlock = None) #see Item._secondInit. diff --git a/engine/track.py b/engine/track.py index 88c94c1..322ec65 100644 --- a/engine/track.py +++ b/engine/track.py @@ -826,7 +826,7 @@ class Track(object): timeSig = "" break else: - timeSig = "\\once \\override Staff.TimeSignature #'stencil = ##f \\cadenzaOn " + timeSig = "\\once \\override Staff.TimeSignature #'stencil = ##f \\cadenzaOn\n" carryLilypondRanges = {} #handed from item to item for ranges such as tuplets. Can act like a stack or simply remember stuff. @@ -835,7 +835,7 @@ class Track(object): data = " ".join(block.lilypond(carryLilypondRanges) for block in self.blocks) if data: - return timeSig + upbeatLy + data + return timeSig + upbeatLy + data + "\n" else: return ""