Browse Source

Adjust measures sizes and positions so that 3 measure mods fit

master
Nils 3 years ago
parent
commit
3aada49048
  1. 1
      CHANGELOG
  2. 2
      engine/pattern.py
  3. 9
      qtgui/mainwindow.py
  4. 40
      qtgui/songeditor.py
  5. 2
      qtgui/timeline.py

1
CHANGELOG

@ -5,6 +5,7 @@ Add non-destructive step delay for individual measures. Shift an individual meas
Add track-switch to choose step-delay wrap-around behaviour, if delayed notes end up outside the pattern
Add non-destructiv pattern augmentation/scaling. Make an individual measure shorter or longer overall, with the same GUI as transpositions.
Add track-switch to choose repeat-to-fill behaviour if scaling a pattern shorter, which creates empty space.
Change user input to choose above measure modifications. Everything is now accesible by shortcuts, removing the functionality from the mousewheel.
Fix wrong playback cursor speed.
Fix small GUI drawing issues

2
engine/pattern.py

@ -379,7 +379,7 @@ class Pattern(object):
endTick = int(endTick * augmentationFactor)
#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
if startTick >= oneMeasureInTicks-1: #-1 is important!!! Without it we will get hanging notes with e.g. factor 1.333
continue #do not create a note, at all
if endTick > oneMeasureInTicks:

9
qtgui/mainwindow.py

@ -537,7 +537,7 @@ class MainWindow(TemplateMainWindow):
def stretchXCoordinates(self, factor):
pass
def zoomUpperHalf(self, delta):
def zoomUpperHalf(self, event):
"""This is called from within the parts of the combined song editor.
The Song Editor consists of three graphic scenes and their views.
But only the part where you can switch measures on and off calls this."""
@ -545,6 +545,8 @@ class MainWindow(TemplateMainWindow):
try: self.zoomFactor
except: self.zoomFactor = 1 # no save. We don't keep a qt config.
delta = event.delta()
if delta > 0: #zoom in
self.zoomFactor = min(5, round(self.zoomFactor + 0.25, 2))
else: #zoom out
@ -556,7 +558,10 @@ class MainWindow(TemplateMainWindow):
self.ui.songEditorView.scale(self.zoomFactor, self.zoomFactor)
self.ui.trackEditorView.scale(1, self.zoomFactor)
self.ui.timelineView.scale(self.zoomFactor, 1)
#view.centerOn(event.scenePos())
self.ui.songEditorView.centerOn(event.scenePos())
#self.ui.trackEditorView.verticalScrollBar().setValue(event.scenePos().y())
#self.ui.timelineView.horizontalScrollBar().setValue(event.scenePos().x())
def _stretchXCoordinates(*args): pass #Override template function

40
qtgui/songeditor.py

@ -36,7 +36,7 @@ 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_UNIT = 30 #this is in manual sync with timeline.py SIZE_UNIT
SIZE_TOP_OFFSET = 0
_zValuesRelativeToScene = { #Only use for objects added directly to the scene, not children.
@ -93,7 +93,7 @@ class SongEditor(QtWidgets.QGraphicsScene):
def wheelEvent(self, event):
"""zoom, otherwise ignore event"""
if QtWidgets.QApplication.keyboardModifiers() == QtCore.Qt.ControlModifier:
self.parentView.parentMainWindow.zoomUpperHalf(event.delta())
self.parentView.parentMainWindow.zoomUpperHalf(event)
event.accept()
else:
event.ignore()
@ -598,32 +598,32 @@ class Switch(QtWidgets.QGraphicsRectItem):
self.scaleTransposeGlyph = QtWidgets.QGraphicsSimpleTextItem("")
self.scaleTransposeGlyph.setParentItem(self)
self.scaleTransposeGlyph.setScale(0.80)
self.scaleTransposeGlyph.setPos(2,1)
self.scaleTransposeGlyph.setScale(0.75)
self.scaleTransposeGlyph.setPos(2,0)
self.scaleTransposeGlyph.setBrush(self.parentTrackStructure.labelColor)
self.scaleTransposeGlyph.hide()
self.scaleTranspose = 0 #default engine value, safe to assume that it will never change as default.
self.halftoneTransposeGlyph = QtWidgets.QGraphicsSimpleTextItem("")
self.halftoneTransposeGlyph.setParentItem(self)
self.halftoneTransposeGlyph.setScale(0.80)
self.halftoneTransposeGlyph.setPos(1,13)
self.halftoneTransposeGlyph.setScale(0.75)
self.halftoneTransposeGlyph.setPos(2,0) #We expect that only one of the transpose variants will be used. Therefore we place them on the same coordinates, because there is not enough space for 4 mods.
self.halftoneTransposeGlyph.setBrush(self.parentTrackStructure.labelColor)
self.halftoneTransposeGlyph.hide()
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.setScale(0.75)
self.stepDelayGlyph.setPos(1,10)
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.setScale(0.75)
self.augmentationFactorGlyph.setPos(1,20)
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.
@ -745,7 +745,7 @@ class Switch(QtWidgets.QGraphicsRectItem):
self._setAugmentationFactorLabel(Fraction(value))
def _setAugmentationFactorLabel(self, value):
text = "a" + str(value)
text = "×" + str(value)
self.augmentationFactorGlyph.setText(text)
self.augmentationFactorGlyph.show()
@ -777,7 +777,7 @@ 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. Right click for measure group options. Read Edit menu for advanced modifications while hovering."))
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 the Edit menu for advanced modifications while hovering."))
self._bufferScaleTranspose = self.scaleTranspose
self._bufferHalftoneTranspose = self.halftoneTranspose
self._bufferStepDelay = self.stepDelay
@ -1089,18 +1089,18 @@ class TrackLabel(QtWidgets.QGraphicsRectItem):
self.lengthMultiplicatorSpinBox = TrackLabel.lengthMultiplicatorSpinBox(parentTrackLabel=self)
self.lengthMultiplicatorSpinBox.setParentItem(self)
self.lengthMultiplicatorSpinBox.setPos(SIZE_UNIT,0)
self.lengthMultiplicatorSpinBox.setPos(SIZE_UNIT,2)
self.colorButton = TrackLabel.ColorPicker(parentTrackLabel=self)
self.colorButton.setParentItem(self)
self.colorButton.setPos(4*SIZE_UNIT, 3)
self.colorButton.setPos(3*SIZE_UNIT, 3)
self.lineEdit = TrackLabel.NameLineEdit(parentTrackLabel=self)
self.label = QtWidgets.QGraphicsProxyWidget()
self.label.setWidget(self.lineEdit)
self.label.setParentItem(self)
self.label.setPos(5*SIZE_UNIT+3,0)
self.label.setPos(4*SIZE_UNIT+3,0)
class lengthMultiplicatorSpinBox(QtWidgets.QGraphicsProxyWidget):
def __init__(self, parentTrackLabel):
@ -1167,8 +1167,8 @@ class TrackLabel(QtWidgets.QGraphicsRectItem):
self.arrowLabel = QtWidgets.QGraphicsSimpleTextItem("")
self.arrowLabel.setFlag(QtWidgets.QGraphicsItem.ItemIgnoresParentOpacity)
self.arrowLabel.setParentItem(self)
self.arrowLabel.setScale(1.6)
self.arrowLabel.setPos(2,1)
self.arrowLabel.setScale(1.5)
self.arrowLabel.setPos(5,2) #try to get the center
role = QtGui.QPalette.Text
self.arrowLabel.setBrush(self.parentTrackLabel.parentScene.parentView.parentMainWindow.fPalBlue.color(role))
@ -1323,7 +1323,7 @@ class GroupLabel(QtWidgets.QGraphicsRectItem):
self.label = QtWidgets.QGraphicsProxyWidget()
self.label.setWidget(self.qLabel)
self.label.setParentItem(self)
self.label.setPos(4*SIZE_UNIT+3,0)
self.label.setPos(3*SIZE_UNIT+3,0)
self.qLabel.setMinimumSize(QtCore.QSize(0, SIZE_UNIT))
self.qLabel.setStyleSheet("background-color: rgba(0,0,0,0)") #transparent so we see the RectItem color
@ -1360,8 +1360,8 @@ class GroupLabel(QtWidgets.QGraphicsRectItem):
self.arrowLabel = QtWidgets.QGraphicsSimpleTextItem("")
self.arrowLabel.setFlag(QtWidgets.QGraphicsItem.ItemIgnoresParentOpacity)
self.arrowLabel.setParentItem(self)
self.arrowLabel.setScale(1.6)
self.arrowLabel.setPos(2,1)
self.arrowLabel.setScale(1.5)
self.arrowLabel.setPos(5,2) #try to get the center
role = QtGui.QPalette.Text
self.arrowLabel.setBrush(self.parentGroupLabel.parentScene.parentView.parentMainWindow.fPalBlue.color(role))

2
qtgui/timeline.py

@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging; logger = logging.getLogger(__name__); logger.info("import")
SIZE_UNIT = 25 #this is in manual sync with songeditor.py SIZE_UNIT
SIZE_UNIT = 30 #this is in manual sync with songeditor.py SIZE_UNIT
import engine.api as api #Session is already loaded and created, no duplication.
from PyQt5 import QtCore, QtGui, QtWidgets

Loading…
Cancel
Save