Compare commits

...

3 Commits

  1. 3
      CHANGELOG
  2. 12
      engine/api.py
  3. 21
      qtgui/musicstructures.py
  4. 2
      qtgui/scorescene.py

3
CHANGELOG

@ -6,8 +6,9 @@ External contributors notice at the end of the line: (LastName, FirstName / nick
## 2022-10-15 2.2.0
Add more time signatures to the quick-insert dialog: 8/4, three variants of 7/8 and two variants of 5/4 and more. Also reorder and better labels.
Add more time signatures to the quick-insert dialog: 8/4, three variants of 7/8, two variants of 5/4 and more. Also reorder and better labels.
Fix splitting of notes that were created by a previous split.
Block Mode: Fix invisible block labels and graphics when dragging blocks (adopting to unannounced Qt regressions once again)
Various small fixes, like typos in variable names and wrong string quotes. Small things can crash as well.
Lilypond:
Add transposition of the whole score to properties and metadata dialog

12
engine/api.py

@ -1955,7 +1955,17 @@ def insertMetricalInstruction(treeOfInstructions, lilypondOverride = None):
def setInitialMetricalInstruction(treeOfInstructions, lilypondOverride:str=None):
"""Variation of insertMetricalInstruction to set the initial one for ALL tracks"""
"""Variation of insertMetricalInstruction to set the initial one for ALL tracks.
Undo depends on it that all tracks have the same initial."""
#Undo
oldInitial = session.data.tracks[0].initialMetricalInstruction #the first one is the same as all.
def registeredUndoFunction():
setInitialMetricalInstruction(oldInitial.treeOfInstructions, oldInitial.lilypondParameters["override"])
session.history.register(registeredUndoFunction, descriptionString=f"Initial Metrical Instruction")
callbacks._historyChanged()
#New one
item = items.MetricalInstruction(treeOfInstructions)
if lilypondOverride:

21
qtgui/musicstructures.py

@ -62,17 +62,19 @@ class GuiBlockHandle(QtWidgets.QGraphicsRectItem):
self.parent = parent #GuiTrack instance
self.parentGuiTrack = parent #redundant, but specifically for block movement. see ScoreScene
self.trans = QtGui.QColor("transparent")
self.setPen(self.trans)
self.setPen(self.trans) #activate to show outline.
self.setBrush(self.trans)
#self.setOpacity(0.4) #slightly fuller than background
#self.setFlag(QtWidgets.QGraphicsItem.ItemIgnoresParentOpacity, True)
#self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, True)
self.setParentItem(parent)
self.setZValue(10) #This is the z value within GuiTrack
#self.setZValue(10) #This is the z value within GuiTrack
self.staticExportItem = staticExportItem
self._color = None # @property
self.posBeforeMove = None
self.cursorPosOnMoveStart = None
self.setFlags(QtWidgets.QGraphicsItem.ItemIgnoresParentOpacity)
#Display Block ID
"""
@ -96,11 +98,13 @@ class GuiBlockHandle(QtWidgets.QGraphicsRectItem):
self.startLabel.setParentItem(self)
self.startLabel.setPos(0, constantsAndConfigs.stafflineGap)
self.startLabel.setFlags(QtWidgets.QGraphicsItem.ItemIgnoresParentOpacity)
#self.startLabel.setZValue(self.zValue()+1) this doesn't matter because our value is relative to self, the rectangle. And selfs value is relative to the GuiTracks other children.
self.endLabel.setParentItem(self)
self.endLabel.setPos(self.rect().width() - self.endLabel.boundingRect().width(), constantsAndConfigs.stafflineGap)
self.endLabel.setFlags(QtWidgets.QGraphicsItem.ItemIgnoresParentOpacity)
@property
def color(self):
assert self._color
@ -136,9 +140,10 @@ class GuiBlockHandle(QtWidgets.QGraphicsRectItem):
self.endLabel.hide()
def mousePressEventCustom(self, event):
"""Not a qt-override. This is called directly by GuiScore
if you click on a block with the right modifier keys (none)"""
if you click on a block"""
self.posBeforeMove = self.pos()
self.cursorPosOnMoveStart = QtGui.QCursor.pos()
self.setBrush(self.color)
@ -378,6 +383,13 @@ class GuiTrack(QtWidgets.QGraphicsItem):
#if barlinesTickList[0] == 0: #happens when there is a metrical instruction at tick 0.
# del barlinesTickList[0]
#Pen for the borders
pen = QtGui.QPen()
pen.setWidth(2)
pen.setColor(QtGui.QColor("black"))
last = None
offset = 0
for barnumber, barlineTick in enumerate(barlinesTickList):
@ -386,6 +398,7 @@ class GuiTrack(QtWidgets.QGraphicsItem):
continue #don't draw the double barline
last = barlineTick
line = QtWidgets.QGraphicsLineItem(QtCore.QLineF(0, 0, 0, h))
line.setPen(pen)
line.setParentItem(self)
self.barLines.append(line)
line.setPos(barlineTick / constantsAndConfigs.ticksToPixelRatio, -2*constantsAndConfigs.stafflineGap)
@ -595,7 +608,7 @@ class GuiTrack(QtWidgets.QGraphicsItem):
elif nameAsString == "block":
self.blockModeNameGraphic.show()
self.nameGraphic.hide()
self.setOpacity(0)
self.setOpacity(0) #this hides the notation stuff. The block mode graphics and labels are also children of ours, but they ignore parent opacity.
for backgroundColor in self.backgroundBlockColors: #simple QRectItems, they don't have their own updateMode function
backgroundColor.setOpacity(1)
for tbh in self.transparentBlockHandles:

2
qtgui/scorescene.py

@ -470,8 +470,6 @@ class GuiScore(QtWidgets.QGraphicsScene):
#GuiBlockHandles are children of a Track. Their Y position will be offset by the track when we move them around with the mouse.
#Which is the same the distance to the first track is on top. We need to substract that for a good look and feel.
#The actual later dropping of the block is handled with the mouse cursor coordinates, the moving colored block is just eyecandy.
#TODO: I want to scroll but this does not work because the item is wider than the viewport. It actually crashes qt
#self._mmE_ensureCursorVisible(event)
x = event.scenePos().x()
y = event.scenePos().y() - self.duringBlockDragAndDrop.parentGuiTrack.y()
self.duringBlockDragAndDrop.setPos(x, y)

Loading…
Cancel
Save