Browse Source

more work on measure modifications. GUI labels are still off

master
Nils 2 years ago
parent
commit
16771be7b0
  1. 17
      engine/pattern.py
  2. 4
      engine/track.py
  3. 51
      qtgui/mainwindow.py
  4. 2292
      qtgui/resources.py
  5. BIN
      qtgui/resources/translations/de.qm
  6. 280
      qtgui/resources/translations/de.ts
  7. 199
      qtgui/songeditor.py

17
engine/pattern.py

@ -342,13 +342,25 @@ class Pattern(object):
shuffle = int(self.parentTrack.parentData.swing * whatTypeOfUnit)
for noteDict in self.exportCache:
#If we diminished and want to repeat the sub-pattern, create virtual extra notes.
self.parentTrack.repeatDiminishedPatternInItself = True
virtualNotes = []
inverseAugmentFactor = round(0.5 + 1 / augmentationFactor)
if self.parentTrack.repeatDiminishedPatternInItself and augmentationFactor < 1:
for noteDict in self.exportCache:
for i in range(2, inverseAugmentFactor+1): #not from 1 because we already have the original notes in there with factor 1.
#indices too big will be filtered out below by absolute ticks
cp = noteDict.copy()
cp["index"] = cp["index"] + howManyUnits * (i-1)
virtualNotes.append(cp)
for noteDict in self.exportCache + virtualNotes:
if self.parentTrack.stepDelayWrapAround:
index = (noteDict["index"] + stepDelay) % howManyUnits
assert index >= 0, index
else:
index = noteDict["index"] + stepDelay
if index < 0 or index >= howManyUnits:
if index < 0 or index >= howManyUnits * inverseAugmentFactor:
continue #skip lost step
startTick = index * whatTypeOfUnit
@ -368,7 +380,6 @@ class Pattern(object):
#Prevent augmented notes to start and hang when exceeding the pattern-length
if startTick >= oneMeasureInTicks-1: #-1 is important!!! Without it we will get hanging notes with factor 1.333
assert augmentationFactor > 1.0, augmentationFactor #can only happen for augmented patterns
continue #do not create a note, at all
if endTick > oneMeasureInTicks:

4
engine/track.py

@ -66,8 +66,8 @@ class Track(object): #injection at the bottom of this file!
#2.1
self.group = "" # "" is a standalone track, the normal one which existed since version 1.0. Using a name here will group these tracks together. A GUI can use this information. Also all tracks in a group share a single jack out port.
self.visible = True #only used together with groups. the api and our Datas setGroup function take care that standalone tracks are never hidden.
self.stepDelayWrapAround = False #every note that falls down on the "right side" of the pattern will wrap around to the beginning.
self.repeatDiminishedPatternInItself = False # if augmentationFactor < 1: repeat the pattern multiple times, as many as fit into the measure.
self.stepDelayWrapAround = stepDelayWrapAround #every note that falls down on the "right side" of the pattern will wrap around to the beginning.
self.repeatDiminishedPatternInItself = repeatDiminishedPatternInItself # if augmentationFactor < 1: repeat the pattern multiple times, as many as fit into the measure.
self.pattern = Pattern(parentTrack=self, scale=scale, simpleNoteNames=simpleNoteNames)
self.structure = structure if structure else set() #see buildTrack(). This is the main track data structure besides the pattern. Just integers (starts at 0) as switches which are positions where to play the patterns. In between are automatic rests.

51
qtgui/mainwindow.py

@ -92,6 +92,8 @@ class MainWindow(TemplateMainWindow):
QtCore.QT_TRANSLATE_NOOP("NOOPengineHistory", "Global Rhythm Offset")
QtCore.QT_TRANSLATE_NOOP("NOOPengineHistory", "Track Group")
QtCore.QT_TRANSLATE_NOOP("NOOPengineHistory", "Move Group")
QtCore.QT_TRANSLATE_NOOP("NOOPengineHistory", "Set Step Delay")
QtCore.QT_TRANSLATE_NOOP("NOOPengineHistory", "Set Augmentation Factor")
def __init__(self):
"""The order of calls is very important.
@ -576,6 +578,39 @@ class MainWindow(TemplateMainWindow):
#now = self.ui.actionPatternFollowPlayhead.isChecked()
#self.ui.actionPatternFollowPlayhead.setChecked(not now)
def halftoneTranspose(self, value):
if self.songEditor.currentHoverStep and self.songEditor.currentHoverStep.isVisible():
if value == 1: #only +1 and -1 for the menu action.
self.songEditor.currentHoverStep.increaseHalftoneTranspose()
else:
self.songEditor.currentHoverStep.decreaseHalftoneTranspose()
def scaleTranspose(self, value):
"""Value is 1 and -1, simply to indicate a direction. In reality this is halving and doubling"""
if self.songEditor.currentHoverStep and self.songEditor.currentHoverStep.isVisible():
if value == 1:
self.songEditor.currentHoverStep.increaseScaleTranspose()
else:
self.songEditor.currentHoverStep.decreaseScaleTranspose()
def stepDelay(self, value):
if self.songEditor.currentHoverStep and self.songEditor.currentHoverStep.isVisible():
if value == 1: #only +1 and -1 for the menu action.
self.songEditor.currentHoverStep.increaseStepDelay()
else:
self.songEditor.currentHoverStep.decreaseStepDelay()
def augmentationFactor(self, value):
"""Value is 1 and -1, simply to indicate a direction. In reality this is halving and doubling"""
if self.songEditor.currentHoverStep and self.songEditor.currentHoverStep.isVisible():
if value == 1:
self.songEditor.currentHoverStep.increaseAugmentationFactor()
else:
self.songEditor.currentHoverStep.decreaseAugmentationFactor()
def createMenu(self):
#We have undo/redo since v2.1. Template menu entries were hidden before.
#self.ui.actionUndo.setVisible(False)
@ -584,6 +619,22 @@ class MainWindow(TemplateMainWindow):
self.menu.addMenuEntry("menuEdit", "actionConvertSubdivisions", QtCore.QCoreApplication.translate("Menu", "Convert Grouping"), lambda: convertSubdivisionsSubMenu(self), tooltip=QtCore.QCoreApplication.translate("Menu", "Change step-grouping but keep your music the same"))
self.menu.addMenuEntry("menuEdit", "actionGlobalOffsetSubmenu", QtCore.QCoreApplication.translate("Menu", "Global Rhythm Offset"), lambda: globalOffsetSubmenu(self), tooltip=QtCore.QCoreApplication.translate("Menu", "Shift the whole piece further down the timeline"))
self.menu.addSeparator("menuEdit")
#Measure Modifications
self.menu.addMenuEntry("menuEdit", "actionHalftoneTransposeIncrease", QtCore.QCoreApplication.translate("Menu", "Increase halftone transpose for currently hovered measure (use shortcut!)"), lambda: self.halftoneTranspose(1), shortcut="h")
self.menu.addMenuEntry("menuEdit", "actionHalftoneTransposeDecrease", QtCore.QCoreApplication.translate("Menu", "Decrease halftone transpose for currently hovered measure (use shortcut!)"), lambda: self.halftoneTranspose(-1), shortcut="Shift+h")
self.menu.addMenuEntry("menuEdit", "actionScaleTransposeIncrease", QtCore.QCoreApplication.translate("Menu", "Increase in-scale transpose for currently hovered measure (use shortcut!)"), lambda: self.scaleTranspose(1), shortcut="s")
self.menu.addMenuEntry("menuEdit", "actionScaleTransposeDecrease", QtCore.QCoreApplication.translate("Menu", "Decrease in-scale transpose for currently hovered measure (use shortcut!)"), lambda: self.scaleTranspose(-1), shortcut="Shift+s")
self.menu.addMenuEntry("menuEdit", "actionStepDelayIncrease", QtCore.QCoreApplication.translate("Menu", "Increase step delay for currently hovered measure (use shortcut!)"), lambda: self.stepDelay(1), shortcut="d")
self.menu.addMenuEntry("menuEdit", "actionStepDelayDecrease", QtCore.QCoreApplication.translate("Menu", "Decrease step delay for currently hovered measure (use shortcut!)"), lambda: self.stepDelay(-1), shortcut="Shift+d")
self.menu.addMenuEntry("menuEdit", "actionAugmentationFactorIncrease", QtCore.QCoreApplication.translate("Menu", "Increase augmentation factor for currently hovered measure (use shortcut!)"), lambda: self.augmentationFactor(1), shortcut="a")
self.menu.addMenuEntry("menuEdit", "actionAugmentationFactorDecrease", QtCore.QCoreApplication.translate("Menu", "Decrease augmentation factor for currently hovered measure (use shortcut!)"), lambda: self.augmentationFactor(-1), shortcut="Shift+a")
self.menu.addSubmenu("menuView", QtCore.QCoreApplication.translate("menu","View"))
self.menu.addMenuEntry("menuView", "actionMaximizeSongArea", QtCore.QCoreApplication.translate("menu", "Maximize Song Area"), self.maximizeSongArea)
self.menu.addMenuEntry("menuView", "actionMaximizePatternArea", QtCore.QCoreApplication.translate("menu", "Maximize Pattern Area"), self.maximizePatternArea)

2292
qtgui/resources.py

File diff suppressed because it is too large

BIN
qtgui/resources/translations/de.qm

Binary file not shown.

280
qtgui/resources/translations/de.ts

@ -4,32 +4,32 @@
<context>
<name>About</name>
<message>
<location filename="../../mainwindow.py" line="112"/>
<location filename="../../mainwindow.py" line="114"/>
<source>Prefer clone track over adding a new empty track when creating a new pattern for an existing &apos;real world&apos; instrument.</source>
<translation>Spuren zu klonen ist meist besser als eine neue, leere Spur zu erstellen. Benutze Klonen immer wenn du ein neues Pattern für ein existierendes Instrument komponieren möchtest.</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="113"/>
<location filename="../../mainwindow.py" line="115"/>
<source>You can run multiple Patroneo instances in parallel to create complex polyrhythms.</source>
<translation>Um komplexe Rhythmen zu erstellen versuche Patroneo mehrmals zu starten und verschiedene Taktarten einzustellen.</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="114"/>
<location filename="../../mainwindow.py" line="116"/>
<source>To revert all steps that are longer or shorter than default invert the pattern twice in a row.</source>
<translation>Alle gedehnten oder verkürzte Noten im Takt bekommst du am einfachsten zurück auf die normale Länge wenn du zweimal hintereinander die &amp;quot;Umkehren&amp;quot; Funktion benutzt.</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="115"/>
<location filename="../../mainwindow.py" line="117"/>
<source>Control a synth with MIDI Control Changes (CC) by routing a Patroneo track into a midi plugin that converts notes to CC.</source>
<translation>MIDI Control Changes (CC) werden nicht direkt von Patroneo erzeugt. Route eine Extraspur in ein Konverterplugin, dass aus Pitch und Velocity CC und Value macht.</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="116"/>
<location filename="../../mainwindow.py" line="118"/>
<source>The mouse wheel is very powerful: Use it to transpose measures (with or without Shift pressed), it resizes the measure number line, zooms when Ctrl is held down, changes row volumes in the pattern with the Alt key or sounds a preview if pressed on a step.</source>
<translation>Das Mausrad ist sehr wichtig: Es transponiert Takte (mit oder ohne Umschalttaste), verändert die Größe der Taktgruppen, zoomed wenn Strg gedrückt ist, ändert die Lautstärke einer ganzen Reihe zusammen mit der Alt-Taste oder lässt eine Note erklingen wenn man es auf einem Schritt drückt.</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="117"/>
<location filename="../../mainwindow.py" line="119"/>
<source>Many elements have context menus with unique functions: Try right clicking on a Step, the Track name or a measure in the song editor.</source>
<translation>Die meisten Bedienelemente haben ein Kontextmenü. Versuche auf alles mit der rechten Maustaste zu klicken: Schritte, Takte, der Spurname etc.</translation>
</message>
@ -75,7 +75,7 @@
<context>
<name>GroupLabel</name>
<message>
<location filename="../../songeditor.py" line="1083"/>
<location filename="../../songeditor.py" line="1189"/>
<source>grab and move to reorder groups</source>
<translation>mit der maus halten und ziehen um Gruppen anzuordnen</translation>
</message>
@ -84,39 +84,49 @@
<name>MainWindow</name>
<message>
<location filename="../../designer/mainwindow.py" line="197"/>
<source>Add Track</source>
<source>Add Pattern</source>
<translation>Neue Spur</translation>
</message>
<message>
<location filename="../../designer/mainwindow.py" line="199"/>
<location filename="../../designer/mainwindow.py" line="200"/>
<source>Clone selected Track</source>
<translation>Klone aktuelle Spur</translation>
</message>
<message>
<location filename="../../designer/mainwindow.py" line="198"/>
<location filename="../../designer/mainwindow.py" line="199"/>
<source>Home</source>
<translation>Zum Anfang</translation>
</message>
<message>
<location filename="../../designer/mainwindow.py" line="198"/>
<source>Add a new Pattern Track</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../designer/mainwindow.py" line="202"/>
<source>Add PianoRoll</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Menu</name>
<message>
<location filename="../../mainwindow.py" line="576"/>
<location filename="../../mainwindow.py" line="586"/>
<source>Convert Grouping</source>
<translation>Gruppierung umwandeln</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="576"/>
<location filename="../../mainwindow.py" line="586"/>
<source>Change step-grouping but keep your music the same</source>
<translation>Taktartaufspaltung durch Gruppierung umwandeln, versucht die Musik gleich klingen zu lassen</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="577"/>
<location filename="../../mainwindow.py" line="587"/>
<source>Global Rhythm Offset</source>
<translation>Allgemeiner Rhythmusversatz</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="577"/>
<location filename="../../mainwindow.py" line="587"/>
<source>Shift the whole piece further down the timeline</source>
<translation>Schiebt das gesamte Stück &quot;später&quot; auf die Timeline</translation>
</message>
@ -363,26 +373,36 @@
<source>Move Group</source>
<translation>Verschiebe Gruppe</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="95"/>
<source>Set Step Delay</source>
<translation>Verzögerung in Schritten</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="96"/>
<source>Set Augmentation Factor</source>
<translation>Augmentierungs-Faktor</translation>
</message>
</context>
<context>
<name>PlaybackControls</name>
<message>
<location filename="../../mainwindow.py" line="133"/>
<location filename="../../mainwindow.py" line="135"/>
<source>[Space] Play / Pause</source>
<translation>[Leertaste] Play / Pause</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="140"/>
<location filename="../../mainwindow.py" line="142"/>
<source>[L] Loop current Measure</source>
<translation>[L] Aktueller Takt in Schleife spielen</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="161"/>
<location filename="../../mainwindow.py" line="163"/>
<source>[Home] Jump to Start</source>
<translation>[Pos1] Springe zum Anfang</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="154"/>
<location filename="../../mainwindow.py" line="156"/>
<source>Number of measures in the loop</source>
<translation>Anzahl der Takte pro Schleife</translation>
</message>
@ -390,72 +410,72 @@
<context>
<name>Scale</name>
<message>
<location filename="../../pattern_grid.py" line="763"/>
<location filename="../../pattern_grid.py" line="780"/>
<source>Major</source>
<translation>Dur</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="764"/>
<location filename="../../pattern_grid.py" line="781"/>
<source>Minor</source>
<translation>Moll</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="765"/>
<location filename="../../pattern_grid.py" line="782"/>
<source>Dorian</source>
<translation>Dorisch</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="766"/>
<location filename="../../pattern_grid.py" line="783"/>
<source>Phrygian</source>
<translation>Phrygisch</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="767"/>
<location filename="../../pattern_grid.py" line="784"/>
<source>Lydian</source>
<translation>Lydisch</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="768"/>
<location filename="../../pattern_grid.py" line="785"/>
<source>Mixolydian</source>
<translation>Mixolydisch</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="769"/>
<location filename="../../pattern_grid.py" line="786"/>
<source>Locrian</source>
<translation>Lokrisch</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="770"/>
<location filename="../../pattern_grid.py" line="787"/>
<source>Blues</source>
<translation>Blues</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="771"/>
<location filename="../../pattern_grid.py" line="788"/>
<source>Hollywood</source>
<translation>Hollywood</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="774"/>
<location filename="../../pattern_grid.py" line="791"/>
<source>English</source>
<translation>Englisch</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="775"/>
<location filename="../../pattern_grid.py" line="792"/>
<source>Lilypond</source>
<translation>Lilypond</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="776"/>
<location filename="../../pattern_grid.py" line="793"/>
<source>German</source>
<translation>Deutsch</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="777"/>
<location filename="../../pattern_grid.py" line="794"/>
<source>Drums GM</source>
<translation>Drums GM</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="772"/>
<location filename="../../pattern_grid.py" line="789"/>
<source>Chromatic</source>
<translation>Chromatisch</translation>
</message>
@ -473,55 +493,123 @@
<translation type="obsolete">Lösche {} Takte von Takt {} beginnend</translation>
</message>
<message>
<location filename="../../songeditor.py" line="412"/>
<location filename="../../songeditor.py" line="433"/>
<source>Insert empty group before this one</source>
<translation>Leere Taktgruppe vor dieser einfügen</translation>
</message>
<message>
<location filename="../../songeditor.py" line="414"/>
<location filename="../../songeditor.py" line="435"/>
<source>Delete whole group</source>
<translation>Lösche diese Taktgruppe</translation>
</message>
<message>
<location filename="../../songeditor.py" line="415"/>
<location filename="../../songeditor.py" line="436"/>
<source>Duplicate whole group including measures</source>
<translation>Verdopple diese Taktgruppe inkl. Struktur</translation>
</message>
<message>
<location filename="../../songeditor.py" line="416"/>
<location filename="../../songeditor.py" line="437"/>
<source>Clear all group transpositions</source>
<translation>Setze alle Transpositionen dieser Taktgruppe zurück</translation>
</message>
<message>
<location filename="../../songeditor.py" line="413"/>
<location filename="../../songeditor.py" line="434"/>
<source>Exchange group with right neigbour</source>
<translation>Tausche Gruppe mit rechter Nachbargruppe</translation>
</message>
</context>
<context>
<name>Statusbar</name>
<message>
<location filename="../../pattern_grid.py" line="648"/>
<source>Note: Left click do deactivate. Middle click to listen. MouseWheel to change volume. Right click for pattern options.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="651"/>
<source>Left click do activate note. Middle click to listen. Right click for pattern options.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="701"/>
<source>Pitch in MIDI half-tones. 60 = middle C. Enter number or spin the mouse wheel to change.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="1056"/>
<source>Click to change volume for all notes in single steps, spin mouse wheel to change in steps of 10.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../songeditor.py" line="515"/>
<source>Empty Measure: Left click to activate. Middle click to show as shadows in current pattern. Right click for measure group options.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../songeditor.py" line="650"/>
<source>Measure: Left click to deactivate. Middle click to show as shadows in current pattern. Shift+MouseWheel for half tone transposition. Alt+MouseWheel for in-scale transposition. Right click for measure group options.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../songeditor.py" line="954"/>
<source>Measure length multiplicator. Enter number or spin the mouse wheel to change.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../songeditor.py" line="972"/>
<source>Left click to change track color</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../songeditor.py" line="1014"/>
<source>Hold left mouse button and move to reorder tracks</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../songeditor.py" line="1060"/>
<source>Click to select track. Double click to change track name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../songeditor.py" line="1171"/>
<source>Track Group: Double Click to show or hide. You can also double click the empty group spacers above the tracks.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../songeditor.py" line="1210"/>
<source>Hold left mouse button and move to reorder track groups</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../timeline.py" line="78"/>
<source>Timeline: Click to set playback position. Scroll with mousewheel to adjust measure grouping. Right click on measures below for options to use these groups.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TimeSignature</name>
<message>
<location filename="../../mainwindow.py" line="400"/>
<location filename="../../mainwindow.py" line="409"/>
<source>Whole</source>
<translation>Ganze</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="401"/>
<location filename="../../mainwindow.py" line="410"/>
<source>Half</source>
<translation>Halbe</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="402"/>
<location filename="../../mainwindow.py" line="411"/>
<source>Quarter</source>
<translation>Viertel</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="403"/>
<location filename="../../mainwindow.py" line="412"/>
<source>Eigth</source>
<translation>Achtel</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="404"/>
<location filename="../../mainwindow.py" line="413"/>
<source>Sixteenth</source>
<translation>Sechzehntel</translation>
</message>
@ -529,7 +617,7 @@
<context>
<name>Timeline</name>
<message>
<location filename="../../timeline.py" line="72"/>
<location filename="../../timeline.py" line="74"/>
<source>Click to set playback position. Scroll with mousewheel to adjust measure grouping.</source>
<translation>Klicken um die Wiedergabeposition zu ändern. Mausrad um die Taktgruppen zu ändern.</translation>
</message>
@ -537,32 +625,32 @@
<context>
<name>Toolbar</name>
<message>
<location filename="../../mainwindow.py" line="313"/>
<location filename="../../mainwindow.py" line="323"/>
<source>BPM/Tempo: </source>
<translation>BPM/Tempo: </translation>
</message>
<message>
<location filename="../../mainwindow.py" line="314"/>
<location filename="../../mainwindow.py" line="324"/>
<source>Deactivate to beccome JACK Transport Slave. Activate for Master.</source>
<translation>Aus: JACK Transport Slave. An: JACK Master (eigenes Tempo).</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="367"/>
<location filename="../../mainwindow.py" line="376"/>
<source>Overall length of the song</source>
<translation>Länge des Stückes in Takten</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="384"/>
<location filename="../../mainwindow.py" line="393"/>
<source>Please read the manual!</source>
<translation>Bitte im Handbuch nachlesen!</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="411"/>
<location filename="../../mainwindow.py" line="420"/>
<source>Length of the pattern (bottom part of the program)</source>
<translation>Länge des Musters in Schritten (untere Hälfte des Programms)</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="415"/>
<location filename="../../mainwindow.py" line="424"/>
<source>How long is each main step</source>
<translation>Welchen Notenwert repräsentiert ein Schritt</translation>
</message>
@ -577,47 +665,47 @@
<translation type="obsolete">Taktartaufspaltung durch Gruppierung umwandeln, versucht die Musik gleich klingen zu lassen</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="489"/>
<location filename="../../mainwindow.py" line="498"/>
<source>Clone Selected Track</source>
<translation>Klone ausgewählte Spur</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="490"/>
<location filename="../../mainwindow.py" line="499"/>
<source>Use this! Create a new track that inherits everything but the content from the original. Already jack connected!</source>
<translation>Das hier benutzen! Neue Spur, die alle Eigenschaften außer der Musik selbst vom Original erbt. Ist bereits in JACK verbunden!</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="491"/>
<location filename="../../mainwindow.py" line="500"/>
<source>Add Track</source>
<translation>Neue Spur</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="492"/>
<location filename="../../mainwindow.py" line="501"/>
<source>Add a complete empty track that needs to be connected to an instrument manually.</source>
<translation>Eine neue, leere Spur, bei der man noch per Hand ein Instrument mit JACK verbinden muss.</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="497"/>
<location filename="../../mainwindow.py" line="507"/>
<source>Measures per Track: </source>
<translation>Takte pro Spur: </translation>
</message>
<message>
<location filename="../../mainwindow.py" line="503"/>
<location filename="../../mainwindow.py" line="513"/>
<source>Steps per Pattern:</source>
<translation>Schritte pro Takt:</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="508"/>
<location filename="../../mainwindow.py" line="518"/>
<source> in groups of: </source>
<translation> gruppiert in je: </translation>
</message>
<message>
<location filename="../../mainwindow.py" line="513"/>
<location filename="../../mainwindow.py" line="523"/>
<source> so that each group produces a:</source>
<translation> und jede Gruppe ergibt eine:</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="519"/>
<location filename="../../mainwindow.py" line="529"/>
<source>Set the swing factor. 0 is off. Different effect for different rhythm-grouping!</source>
<translation>Swing-Anteil. 0 ist aus. Andere rhythmische Gruppierungen haben einen anderen Effekt!</translation>
</message>
@ -625,12 +713,12 @@
<context>
<name>TrackLabel</name>
<message>
<location filename="../../songeditor.py" line="883"/>
<location filename="../../songeditor.py" line="994"/>
<source>grab and move to reorder tracks</source>
<translation>mit der maus halten und ziehen um Spuren anzuordnen</translation>
</message>
<message>
<location filename="../../songeditor.py" line="892"/>
<location filename="../../songeditor.py" line="969"/>
<source>change track color</source>
<translation>setze Farbe der Spur</translation>
</message>
@ -638,27 +726,27 @@
<context>
<name>TrackLabelContext</name>
<message>
<location filename="../../songeditor.py" line="787"/>
<location filename="../../songeditor.py" line="825"/>
<source>Invert Measures</source>
<translation>Taktauswahl umdrehen</translation>
</message>
<message>
<location filename="../../songeditor.py" line="788"/>
<location filename="../../songeditor.py" line="826"/>
<source>All Measures On</source>
<translation>Alle Takte anschalten</translation>
</message>
<message>
<location filename="../../songeditor.py" line="789"/>
<location filename="../../songeditor.py" line="827"/>
<source>All Measures Off</source>
<translation>Alle Takte ausschalten</translation>
</message>
<message>
<location filename="../../songeditor.py" line="790"/>
<location filename="../../songeditor.py" line="828"/>
<source>Clone this Track</source>
<translation>Spur klonen</translation>
</message>
<message>
<location filename="../../songeditor.py" line="791"/>
<location filename="../../songeditor.py" line="829"/>
<source>Delete Track</source>
<translation>Spur löschen</translation>
</message>
@ -668,42 +756,42 @@
<translation type="obsolete">Übernimm Struktur von</translation>
</message>
<message>
<location filename="../../songeditor.py" line="808"/>
<location filename="../../songeditor.py" line="846"/>
<source>Merge/Copy Measure-Structure from</source>
<translation>Übernimm und ergänze Struktur von</translation>
</message>
<message>
<location filename="../../songeditor.py" line="822"/>
<location filename="../../songeditor.py" line="860"/>
<source>Replace Pattern with</source>
<translation>Ersetze Noten des Taktes durch</translation>
</message>
<message>
<location filename="../../songeditor.py" line="836"/>
<location filename="../../songeditor.py" line="874"/>
<source>Send on MIDI Channel</source>
<translation>Sende auf MIDI Kanal</translation>
</message>
<message>
<location filename="../../songeditor.py" line="758"/>
<location filename="../../songeditor.py" line="796"/>
<source>Group Name</source>
<translation>Gruppenname</translation>
</message>
<message>
<location filename="../../songeditor.py" line="759"/>
<location filename="../../songeditor.py" line="797"/>
<source>Create a new group by name</source>
<translation>Neue Gruppe erstellen</translation>
</message>
<message>
<location filename="../../songeditor.py" line="846"/>
<location filename="../../songeditor.py" line="884"/>
<source>Group</source>
<translation>Gruppe</translation>
</message>
<message>
<location filename="../../songeditor.py" line="847"/>
<location filename="../../songeditor.py" line="885"/>
<source>New Group</source>
<translation>Neue Gruppe</translation>
</message>
<message>
<location filename="../../songeditor.py" line="852"/>
<location filename="../../songeditor.py" line="890"/>
<source>Remove from </source>
<translation>Aus Gruppe entfernen: </translation>
</message>
@ -711,72 +799,72 @@
<context>
<name>TransposeControls</name>
<message>
<location filename="../../pattern_grid.py" line="791"/>
<location filename="../../pattern_grid.py" line="808"/>
<source>+Half Tone</source>
<translation>+Halbton</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="793"/>
<location filename="../../pattern_grid.py" line="810"/>
<source>Transpose the whole scale up a half tone (+1 midi note)</source>
<translation>Transponiere die Tonleiter einen Halbton aufwärts (+1 MIDI Tonhöhe)</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="796"/>
<location filename="../../pattern_grid.py" line="813"/>
<source>-Half Tone</source>
<translation>-Halbton</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="798"/>
<location filename="../../pattern_grid.py" line="815"/>
<source>Transpose the whole scale down a half tone (-1 midi note)</source>
<translation>Transponiere die Tonleiter einen Halbton abwärts (-1 MIDI Tonhöhe)</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="801"/>
<location filename="../../pattern_grid.py" line="818"/>
<source>+Octave</source>
<translation>+Oktave</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="803"/>
<location filename="../../pattern_grid.py" line="820"/>
<source>Transpose the whole scale up an octave (+12 midi notes)</source>
<translation>Transponiere die Tonleiter eine Oktave aufwärts (+12 MIDI Tonhöhe)</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="806"/>
<location filename="../../pattern_grid.py" line="823"/>
<source>-Octave</source>
<translation>-Oktave</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="808"/>
<location filename="../../pattern_grid.py" line="825"/>
<source>Transpose the whole scale down an octave (-12 midi notes)</source>
<translation>Transponiere die Tonleiter eine Oktave abwärts (-12 MIDI Tonhöhe)</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="815"/>
<location filename="../../pattern_grid.py" line="832"/>
<source>Set Scale to:</source>
<translation>Benutze Tonleiter:</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="817"/>
<location filename="../../pattern_grid.py" line="834"/>
<source>Take the bottom note and build a predefined scale from it upwards.</source>
<translation>Ändere die Tonleiter des Musters auf die Ausgewählte. Referenzton ist die unterste Reihe des Musters.</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="823"/>
<location filename="../../pattern_grid.py" line="840"/>
<source>Set Notenames to:</source>
<translation>Benutze Notennamen:</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="825"/>
<location filename="../../pattern_grid.py" line="842"/>
<source>Use this scheme as note names.</source>
<translation>Use this scheme as note names.</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="829"/>
<location filename="../../pattern_grid.py" line="846"/>
<source>Choose how many different notes does this pattern should have.</source>
<translation>Anzahl der verschiedenen Tonhöhen-Stufen aus.</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="832"/>
<location filename="../../pattern_grid.py" line="849"/>
<source> Notes</source>
<translation> Noten</translation>
</message>
@ -784,22 +872,22 @@
<context>
<name>VelocityControls</name>
<message>
<location filename="../../pattern_grid.py" line="1013"/>
<location filename="../../pattern_grid.py" line="1034"/>
<source>+Velocity</source>
<translation>+Velocity</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="1016"/>
<location filename="../../pattern_grid.py" line="1037"/>
<source>Make everything louder. Hover and mousewheel up/down to go in steps of 10.</source>
<translation>Alle Töne lauter machen. Mit dem Mauszeiger über dem Knopf bleiben und das Mausrad auf oder ab bewegen für 10er Schritte.</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="1019"/>
<location filename="../../pattern_grid.py" line="1040"/>
<source>-Velocity</source>
<translation>-Velocity</translation>
</message>
<message>
<location filename="../../pattern_grid.py" line="1022"/>
<location filename="../../pattern_grid.py" line="1043"/>
<source>Make everything softer. Hover and mousewheel up/down to go in steps of 10.</source>
<translation>Alle Töne leiser machen. Mit dem Mauszeiger über dem Knopf bleiben und das Mausrad auf oder ab bewegen für 10er Schritte.</translation>
</message>
@ -835,27 +923,27 @@
<context>
<name>menu</name>
<message>
<location filename="../../mainwindow.py" line="579"/>
<location filename="../../mainwindow.py" line="589"/>
<source>View</source>
<translation>Ansicht</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="580"/>
<location filename="../../mainwindow.py" line="590"/>
<source>Maximize Song Area</source>
<translation>Formeditor maximieren</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="581"/>
<location filename="../../mainwindow.py" line="591"/>
<source>Maximize Pattern Area</source>
<translation>Takteditor maximieren</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="582"/>
<location filename="../../mainwindow.py" line="592"/>
<source>Equal space for Pattern/Song Area</source>
<translation>Gleiche Größe für Form- und Takteditor</translation>
</message>
<message>
<location filename="../../mainwindow.py" line="583"/>
<location filename="../../mainwindow.py" line="593"/>
<source>Follow playhead in pattern-view by scrolling.</source>
<translation>Playhead in Musteransicht durch Scrollen verfolgen.</translation>
</message>

199
qtgui/songeditor.py

@ -21,12 +21,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging; logger = logging.getLogger(__name__); logger.info("import")
#Standard Library
from fractions import Fraction
from time import time
import engine.api as api #Session is already loaded and created, no duplication.
import template.qtgui.helper as helper
#Third Party
from PyQt5 import QtCore, QtGui, QtWidgets
#Template
import template.qtgui.helper as helper
#Our modules
import engine.api as api #Session is already loaded and created, no duplication.
SIZE_UNIT = 25 #this is in manual sync with timeline.py SIZE_UNIT
SIZE_TOP_OFFSET = 0
@ -67,6 +76,8 @@ class SongEditor(QtWidgets.QGraphicsScene):
self.brightPen = QtGui.QPen(self.parentView.parentMainWindow.fPalBlue.color(role))
self.normalPen = QtGui.QPen()
self.currentHoverStep = None #either a Step() object or None. Only set when hovering active steps.
api.callbacks.numberOfTracksChanged.append(self.callback_numberOfTracksChanged)
api.callbacks.timeSignatureChanged.append(self.callback_timeSignatureChanged)
api.callbacks.numberOfMeasuresChanged.append(self.callback_setnumberOfMeasures)
@ -328,6 +339,8 @@ class TrackStructure(QtWidgets.QGraphicsRectItem):
switch.setBrush(self.currentColor)
switch.setScaleTransposeColor(self.labelColor)
switch.setHalftoneTransposeColor(self.labelColor)
switch.setStepDelayColor(self.labelColor)
switch.setAugmentationFactorColor(self.labelColor)
def updatePatternLengthMultiplicator(self, exportDict):
"""Comes via its own callback, also named callback_patternLengthMultiplicatorChanged.
@ -375,6 +388,8 @@ class TrackStructure(QtWidgets.QGraphicsRectItem):
structure = self.exportDict["structure"]
whichPatternsAreScaleTransposed = self.exportDict["whichPatternsAreScaleTransposed"]
whichPatternsAreHalftoneTransposed = self.exportDict["whichPatternsAreHalftoneTransposed"]
whichPatternsAreStepDelayed = self.exportDict["whichPatternsAreStepDelayed"]
whichPatternsHaveAugmentationFactor = self.exportDict["whichPatternsHaveAugmentationFactor"]
factor = self.exportDict["patternLengthMultiplicator"]
#requestAmountOfMeasures = requestAmountOfMeasures // factor #already is.
@ -412,6 +427,16 @@ class TrackStructure(QtWidgets.QGraphicsRectItem):
else:
switch.halftoneTransposeOff()
if position in whichPatternsAreStepDelayed:
switch.setStepDelay(whichPatternsAreStepDelayed[position])
else:
switch.stepDelayOff()
if position in whichPatternsHaveAugmentationFactor:
switch.setAugmentationFactor(whichPatternsHaveAugmentationFactor[position])
else:
switch.augmentationFactorOff()
if not vis:
switch.hide()
@ -577,7 +602,7 @@ class Switch(QtWidgets.QGraphicsRectItem):
self.scaleTransposeGlyph.setPos(2,1)
self.scaleTransposeGlyph.setBrush(self.parentTrackStructure.labelColor)
self.scaleTransposeGlyph.hide()
self.scaleTranspose = 0
self.scaleTranspose = 0 #default engine value, safe to assume that it will never change as default.
self.halftoneTransposeGlyph = QtWidgets.QGraphicsSimpleTextItem("")
self.halftoneTransposeGlyph.setParentItem(self)
@ -585,7 +610,24 @@ class Switch(QtWidgets.QGraphicsRectItem):
self.halftoneTransposeGlyph.setPos(1,13)
self.halftoneTransposeGlyph.setBrush(self.parentTrackStructure.labelColor)
self.halftoneTransposeGlyph.hide()
self.halftoneTranspose = 0
self.halftoneTranspose = 0 #default engine value, safe to assume that it will never change as default.
self.stepDelayGlyph = QtWidgets.QGraphicsSimpleTextItem("")
self.stepDelayGlyph.setParentItem(self)
self.stepDelayGlyph.setScale(0.80)
self.stepDelayGlyph.setPos(1,13)
self.stepDelayGlyph.setBrush(self.parentTrackStructure.labelColor)
self.stepDelayGlyph.hide()
self.stepDelay = 0 #default engine value, safe to assume that it will never change as default.
self.augmentationFactorGlyph = QtWidgets.QGraphicsSimpleTextItem("")
self.augmentationFactorGlyph.setParentItem(self)
self.augmentationFactorGlyph.setScale(0.80)
self.augmentationFactorGlyph.setPos(1,13)
self.augmentationFactorGlyph.setBrush(self.parentTrackStructure.labelColor)
self.augmentationFactorGlyph.hide()
self.augmentationFactor = 0 #default engine value, safe to assume that it will never change as default.
def stretch(self, factor):
"""factor assumes relative to SIZE_UNIT"""
@ -594,6 +636,8 @@ class Switch(QtWidgets.QGraphicsRectItem):
self.setRect(r)
#Scale Transpose
def setScaleTranspose(self, value):
"""
Called by track callbacks and also for the temporary buffer display
@ -609,7 +653,7 @@ class Switch(QtWidgets.QGraphicsRectItem):
self._setScaleTransposeLabel(value)
def _setScaleTransposeLabel(self, value):
text = ("+" if value > 0 else "") + str(value) + "s"
text = ("+" if value > 0 else "") + str(value) + "s" #because - is added automatically
self.scaleTransposeGlyph.setText(text)
self.scaleTransposeGlyph.show()
@ -622,12 +666,25 @@ class Switch(QtWidgets.QGraphicsRectItem):
self.scaleTranspose = 0
self._bufferScaleTranspose = 0
def increaseScaleTranspose(self):
"""By 1. Convenience function to make code in mainWindow cleaner"""
self._bufferScaleTranspose += 1
self._setScaleTransposeLabel(self._bufferScaleTranspose)
def decreaseScaleTranspose(self):
"""By 1. Convenience function to make code in mainWindow cleaner"""
self._bufferScaleTranspose -= 1
self._setScaleTransposeLabel(self._bufferScaleTranspose)
#Halftone Transpose
def setHalftoneTranspose(self, value):
self.halftoneTranspose = value
self._setHalftoneTransposeLabel(value)
def _setHalftoneTransposeLabel(self, value):
text = ("+" if value > 0 else "") + str(value) + "h"
text = ("+" if value > 0 else "") + str(value) + "h" #because - is added automatically
self.halftoneTransposeGlyph.setText(text)
self.halftoneTransposeGlyph.show()
@ -638,8 +695,80 @@ class Switch(QtWidgets.QGraphicsRectItem):
self.halftoneTransposeGlyph.setText("")
#self.halftoneTransposeGlyph.hide()
self.halftoneTranspose = 0
self._bufferhalftoneTranspose = 0
self._bufferHalftoneTranspose = 0
def increaseHalftoneTranspose(self):
"""By 1. Convenience function to make code in mainWindow cleaner"""
self._bufferHalftoneTranspose += 1
self._setHalftoneTransposeLabel(self._bufferHalftoneTranspose)
def decreaseHalftoneTranspose(self):
"""By 1. Convenience function to make code in mainWindow cleaner"""
self._bufferHalftoneTranspose -= 1
self._setHalftoneTransposeLabel(self._bufferHalftoneTranspose )
#Step Delay
def setStepDelay(self, value):
self.stepDelay = value
self._setStepDelayLabel(value)
def _setStepDelayLabel(self, value):
text = ("+" if value > 0 else "") + "d" + str(value) #because - is added automatically
self.stepDelayGlyph.setText(text)
self.stepDelayGlyph.show()
def setStepDelayColor(self, c):
self.stepDelayGlyph.setBrush(c)
def stepDelayOff(self):
self.stepDelayGlyph.setText("")
#self.stepDelayGlyph.hide()
self.stepDelay = 0
self._bufferStepDelay = 0
def increaseStepDelay(self):
"""By 1. Convenience function to make code in mainWindow cleaner"""
self._bufferStepDelay += 1
self._setStepDelayLabel(self._bufferStepDelay)
def decreaseStepDelay(self):
"""By 1. Convenience function to make code in mainWindow cleaner"""
self._bufferStepDelay -= 1
self._setStepDelayLabel(self._bufferStepDelay)
#Augmentation Factor
def setAugmentationFactor(self, value):
self.augmentationFactor = value
self._setAugmentationFactorLabel(Fraction(value))
def _setAugmentationFactorLabel(self, value):
text = "a" + str(value)
self.augmentationFactorGlyph.setText(text)
self.augmentationFactorGlyph.show()
def setAugmentationFactorColor(self, c):
self.augmentationFactorGlyph.setBrush(c)
def augmentationFactorOff(self):
self.augmentationFactorGlyph.setText("")
#self.augmentationFactorGlyph.hide()
self.augmentationFactor = 1.0
self._bufferAugmentationFactor = 1.0
def increaseAugmentationFactor(self):
"""By 1. Convenience function to make code in mainWindow cleaner"""
self._bufferAugmentationFactor *= 2
self._setAugmentationFactorLabel(Fraction(self._bufferAugmentationFactor))
def decreaseAugmentationFactor(self):
"""By 1. Convenience function to make code in mainWindow cleaner"""
self._bufferAugmentationFactor /= 2
self._setAugmentationFactorLabel(Fraction(self._bufferAugmentationFactor))
#Events
def mousePressEvent(self, event):
"""A mouse events on the track activate a switch. Then we receive the event to turn it
off again."""
@ -647,30 +776,62 @@ class Switch(QtWidgets.QGraphicsRectItem):
def hoverEnterEvent(self, event):
"""Only active switches"""
self.statusMessage(QtCore.QCoreApplication.translate("Statusbar", "Measure: Left click to deactivate. Middle click to show as shadows in current pattern. Shift+MouseWheel for half tone transposition. Alt+MouseWheel for in-scale transposition. Right click for measure group options."))
#self.statusMessage(QtCore.QCoreApplication.translate("Statusbar", "Measure: Left click to deactivate. Middle click to show as shadows in current pattern. Shift+MouseWheel for half tone transposition. Alt+MouseWheel for in-scale transposition. Right click for measure group options."))
self.statusMessage(QtCore.QCoreApplication.translate("Statusbar", "Measure: Left click to deactivate. Middle click to show as shadows in current pattern. Right click for measure group options. Read Edit menu for advanced modifications while hovering."))
self._bufferScaleTranspose = self.scaleTranspose
self._bufferHalftoneTranspose = self.halftoneTranspose
self._bufferStepDelay = self.stepDelay
self._bufferAugmentationFactor = self.augmentationFactor
self.parentTrackStructure.parentScene.currentHoverStep = self
def hoverLeaveEvent(self, event):
"""only triggered when active/shown"""
"""only triggered when active/shown.
When leaving a modified step it will send all changes to the api.
"""
self.parentTrackStructure.parentScene.currentHoverStep = None
self.statusMessage("")
event.accept()
#The api callback resets our buffer and values.
#That is fine except if we want to register multiple changes at once. Therefore we first copy our buffers and send the copies.
bscale = -1*self._bufferScaleTranspose
bhalftone = self._bufferHalftoneTranspose
bdelay = self._bufferStepDelay
baugment = self._bufferAugmentationFactor
#Scale Transpose. Independent of Halftone Transpose
if not self._bufferScaleTranspose == self.scaleTranspose:
api.setSwitchScaleTranspose(self.parentTrackStructure.exportDict["id"], self.position, -1*self._bufferScaleTranspose) #we flip the polarity here. The receiving flip is done in the callback.
if not bscale == self.scaleTranspose:
api.setSwitchScaleTranspose(self.parentTrackStructure.exportDict["id"], self.position, bscale) #we flip the polarity here. The receiving flip is done in the callback.
#new transpose/buffer gets set via callback
if self._bufferScaleTranspose == 0:
if bscale == 0:
self.scaleTransposeOff()
#Halftone Transpose. Independent of Scale Transpose
if not self._bufferHalftoneTranspose == self.halftoneTranspose:
api.setSwitchHalftoneTranspose(self.parentTrackStructure.exportDict["id"], self.position, self._bufferHalftoneTranspose) #half tone transposition is not flipped
if not bhalftone == self.halftoneTranspose:
api.setSwitchHalftoneTranspose(self.parentTrackStructure.exportDict["id"], self.position, bhalftone) #half tone transposition is not flipped
#new transpose/buffer gets set via callback
if self._bufferHalftoneTranspose == 0:
if bhalftone == 0:
self.halftoneTransposeOff()
def wheelEvent(self, event):
#Step Delay. Also independent.
if not bdelay == self.stepDelay:
api.setSwitchStepDelay(self.parentTrackStructure.exportDict["id"], self.position, bdelay)
#new value/buffer gets set via callback
if bdelay == 0:
self.stepDelayOff()
#Augmentation Factor. Interconnected... nah, just joking. Independent of the other stuff.
if not baugment == self.augmentationFactor:
api.setSwitchAugmentationsFactor(self.parentTrackStructure.exportDict["id"], self.position, baugment)
#new value/buffer gets set via callback
if baugment == 1.0:
self.augmentationFactorOff()
def deprecated_wheelEvent(self, event):
#We now use dedicated keyboard shortcuts and not the mousewheel anymore.
#See main window menu actions
"""Does not get triggered when switch is off.
This buffers until hoverLeaveEvent and then the new value is sent in self.hoverLeaveEvent
@ -695,6 +856,10 @@ class Switch(QtWidgets.QGraphicsRectItem):
self._bufferScaleTranspose = max(-7, self._bufferScaleTranspose-1)
self._setScaleTransposeLabel(self._bufferScaleTranspose)
#Step Delay and Augmentation Factor are not done via mousewheel. There are not enough modifier keys left over :)
#They are instead handled by menu actions directly, in cooperations with our hover callbacks.
else: #normal scroll or zoom.
event.ignore()
#super.wheelEvent(event)
@ -1119,8 +1284,6 @@ class TrackLabel(QtWidgets.QGraphicsRectItem):
self.setBrush(c)
class GroupLabel(QtWidgets.QGraphicsRectItem):
"""Compatible with TrackLabel but stripped down:
No name change, no color, no multiplicator. But

Loading…
Cancel
Save