From 5de92890936cb405493c1de0ace0853311fe6d55 Mon Sep 17 00:00:00 2001 From: Nils Date: Sun, 15 May 2022 00:31:06 +0200 Subject: [PATCH] Show tempo names in gui --- CHANGELOG | 4 +++- qtgui/conductor.py | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 480be93..7f96220 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,13 +6,15 @@ External contributors notice at the end of the line: (LastName, FirstName / nick ## 2022-07-15 2.1.0 +Rewrite grid, which was a performance drag in the past. Add functions to move block to start or end of track. Scroll view when dragging blocks and tracks with the mouse. Add 3/2 to metrical instruction. Autosave when exporting Lilypond .ly or PDF. Command to quickly add text below or above a staff. Allow menu commands in CC and Block view: PDF, .ly export, metadata edit, zoom. -Fix lilypond tempo export. +Fix lilypond tempo export. Also add option to Lilypond Properties to not print metronome markings. +Optional text description for tempo items like "allegro" Cleaner .ly export with more line breaks, comments and using more default ly instructions when available, instead of our custom generic-purpose scripts. ## 2022-04-15 2.0.3 diff --git a/qtgui/conductor.py b/qtgui/conductor.py index f41bcdf..8c533b7 100644 --- a/qtgui/conductor.py +++ b/qtgui/conductor.py @@ -413,7 +413,15 @@ class TempoPoint(QtWidgets.QGraphicsItem): self.number = QtWidgets.QGraphicsTextItem("") self.number.setParentItem(self) #self.number.setHtml("{}".format(str(int(staticExportItem["unitsPerMinute"])))) - self.number.setHtml("{}".format(str(int(staticExportItem["unitsPerMinute"])))) + + + if staticExportItem["lilypondParameters"]["tempo"]: + numberString = f"""{staticExportItem["lilypondParameters"]["tempo"]}({int(staticExportItem["unitsPerMinute"])})""" + else: + numberString = str(int(staticExportItem["unitsPerMinute"])) + + #self.number.setHtml("{}".format(str(int(staticExportItem["unitsPerMinute"])))) + self.number.setHtml(f"{numberString}") self.number.setPos(-6,0) #adjust items font x offsset. if not self.staticExportItem["graphType"] == "standalone": @@ -505,7 +513,14 @@ class TempoPoint(QtWidgets.QGraphicsItem): self.wheelEventChangedValue += 1 else: self.wheelEventChangedValue -= 1 - self.number.setHtml("{}".format(str(int(self.staticExportItem["unitsPerMinute"] + self.wheelEventChangedValue)))) + + if self.staticExportItem["lilypondParameters"]["tempo"]: + numberString = f"""{self.staticExportItem["lilypondParameters"]["tempo"]}({int(self.staticExportItem["unitsPerMinute"]) + self.wheelEventChangedValue})""" + else: + numberString = str(int(self.staticExportItem["unitsPerMinute"]) + self.wheelEventChangedValue ) + + #self.number.setHtml("{}".format(str(int(self.staticExportItem["unitsPerMinute"] + self.wheelEventChangedValue)))) + self.number.setHtml(f"{numberString}") event.accept() else: event.accept() @@ -529,6 +544,7 @@ class TempoPoint(QtWidgets.QGraphicsItem): event.accept() def contextMenuEvent(self, event): + if not self.parentTempoTrack: return #there was a rare bug here. don't let it crash if self.parentTempoTrack.parentView.mode() in ("notation", "cc"): listOfLabelsAndFunctions = [ ("edit properties", lambda: SecondaryTempoChangeMenu(self.scene().parentView.mainWindow, staticExportTempoItem = self.staticExportItem)),