Browse Source

fix some float conversions that broke with python 3.10 and pyqt

master
Nils 3 years ago
parent
commit
7ab5130fbb
  1. 3
      engine/main.py
  2. 9
      qtgui/mainwindow.py
  3. 2
      qtgui/songeditor.py

3
engine/main.py

@ -157,7 +157,8 @@ class Data(template.engine.sequencer.Score):
#Possible case, but needs checking.
elif int(inverseScaleFactor) == inverseScaleFactor:
assert int(scaleFactor * self.howManyUnits) == scaleFactor * self.howManyUnits, (scaleFactor, self.howManyUnits)
#The following assertion is simply not correct. scaleFactor 0.5 and howManyUnits 11 means with 11 steps per measure you go from group 4 to 2, or 2 to 1. With "delete if fail". normal operation
#assert int(scaleFactor * self.howManyUnits) == scaleFactor * self.howManyUnits, (scaleFactor, self.howManyUnits)
#Test, if in "fail" mode
if errorHandling == "fail":

9
qtgui/mainwindow.py

@ -371,15 +371,16 @@ class MainWindow(TemplateMainWindow):
bpmCheckbox.stateChanged.connect(bpmCheckboxChanged)
def callback_quarterNotesPerMinuteChanged(newValue):
#We just receive an int, not a dict.
def callback_quarterNotesPerMinuteChanged(newValue:float):
"""We just receive a float, not a dict. Jack supports floats as tempo.
However, we only use ints here and our spinbox is int."""
beatsPerMinute.blockSignals(True)
bpmCheckbox.blockSignals(True)
if newValue:
bpmCheckbox.setChecked(True)
beatsPerMinute.setEnabled(True)
beatsPerMinute.setValue(newValue)
beatsPerMinute.setValue(int(newValue))
else:
beatsPerMinute.setEnabled(False)
bpmCheckbox.setChecked(False)
@ -389,8 +390,6 @@ class MainWindow(TemplateMainWindow):
bpmCheckbox.blockSignals(False)
api.callbacks.quarterNotesPerMinuteChanged.append(callback_quarterNotesPerMinuteChanged)
#Number of Measures
numberOfMeasures = QtWidgets.QSpinBox()
numberOfMeasures.setMinimum(1)

2
qtgui/songeditor.py

@ -1455,7 +1455,7 @@ class Playhead(QtWidgets.QGraphicsLineItem):
PlayHead height is set in SongEditor.callback_numberOfTracksChanged.
"""
x = tickindex / self.parentScene.ticksToPixelRatio
x = int(tickindex / self.parentScene.ticksToPixelRatio)
self.setX(x)
if playbackStatus: # api.duringPlayback:
scenePos = self.parentScene.parentView.mapFromScene(self.pos())

Loading…
Cancel
Save