Browse Source

remove regression that triggered api.setScale far too often

master
Nils 4 years ago
parent
commit
3604c4dfd9
  1. 2
      engine/api.py
  2. 2
      engine/main.py
  3. 11
      qtgui/pattern_grid.py

2
engine/api.py

@ -269,7 +269,6 @@ def _loopNow():
def _setLoop(loopMeasureAroundPpqn:int):
"""This function is used with context.
The loopFactor, how many measures are looped, is saved value """
if loopMeasureAroundPpqn < 0:
_loopOff()
return
@ -586,6 +585,7 @@ def moveTrack(trackId, newIndex):
session.data.sortTracks() #in place sorting for groups
callbacks._numberOfTracksChanged()
def setTrackPatternLengthMultiplicator(trackId, newMultiplicator:int):
if newMultiplicator < 1 or not isinstance(newMultiplicator, int):
return #Invalid input

2
engine/main.py

@ -88,8 +88,10 @@ class Data(template.engine.sequencer.Score):
self.tracks[2].pattern.scale = (48, 47, 45, 43, 41, 40, 38, 36) #Low base notes, C-Major
self.tracks[3].pattern.simpleNoteNames = simpleNoteNames["Drums GM"]
self.tracks[3].pattern.scale = (49, 53, 50, 45, 42, 39, 38, 36) #A pretty good starter drum set
self.tracks[4].pattern.simpleNoteNames = simpleNoteNames["Drums GM"]
self.tracks[4].pattern.scale = (49, 53, 50, 45, 42, 39, 38, 36) #A pretty good starter drum set
self._processAfterInit()
def _processAfterInit(self):

11
qtgui/pattern_grid.py

@ -176,7 +176,6 @@ class PatternGrid(QtWidgets.QGraphicsScene):
self._fullRedraw(newCurrentTrackId)
def callback_patternChanged(self, exportDict, force=False):
"""We receive the whole track as exportDict.
exportDict["pattern"] is the data structure example in the class docstring.
@ -729,8 +728,12 @@ class Scale(QtWidgets.QGraphicsRectItem):
pitches! Pitches can be any order the user wants.
"""
for widget, scaleMidiPitch in zip(self.pitchWidgets, scaleList):
widget.blockSignals(True) #choose active track triggers valueChanged, which triggers sendToENgine
widget.spinBox.blockSignals(True) #choose active track triggers valueChanged, which triggers sendToENgine
widget.spinBox.setValue(scaleMidiPitch)
widget.rememberLastValue = scaleMidiPitch
widget.blockSignals(False)
widget.spinBox.blockSignals(False)
def setNoteNames(self, pNoteNames):
"""A list of 128 strings. Gets only called by the callback.
@ -932,10 +935,10 @@ class PitchWidget(QtWidgets.QGraphicsProxyWidget):
exit()
def spinBoxValueChanged(self):
"""This triggers at multiple occasions, include track change.
Everything that triggers focus lost"""
self.label.setText(self.midiToNotename(self.spinBox.value()))
self.blockSignals(True)
self.spinBoxEditingFinished(callback=False)
self.blockSignals(False)
#self.spinBoxEditingFinished(callback=False) . No. This was to send updates when the user uses the arrow keys to change pitch. But that horrible side effects like api.setScale for every note for every track change, incl. undo registration.
def spinBoxEditingFinished(self, callback=True):
if not self.rememberLastValue == self.spinBox.value():

Loading…
Cancel
Save