oneRectToReturnThemAll=QtCore.QRectF(0,0,0,0)#prevent the annoying "NotImplementError" from Qt for boundingRect. For items that don't need any collision detection.
_zValuesRelativeToConductor={#Only use for objects added directly to the Conductor, not their children.
"line":0,
"startItem":1,
@ -238,17 +236,6 @@ class ConductorTransparentBlock(QtWidgets.QGraphicsRectItem):
#self.setZValue(_zValuesRelativeToConductor["handle"]) #includes the handle
#Doesn't need it because only pure QGraphicItem subclasses need that. But we are already a rect.
#def boundingRect(self, *args):
# return oneRectToReturnThemAll
#Doesn't need it because only pure QGraphicItem subclasses need that. But we are already a rect.
#def paint(self, *args):
# """Prevent the selection rectangle when clicking the item"""
#!! This also prevents the rectangle to show up. Very bad decision.
oneRectToReturnThemAll=QtCore.QRectF(0,0,0,0)#prevent the annoying "NotImplementError" from Qt for boundingRect. For items that don't need any collision detection.
classPitchCursor(QtWidgets.QGraphicsRectItem):
def__init__(self):
"""Does not need the actual dotOnLine.
@ -44,8 +42,6 @@ class PitchCursor(QtWidgets.QGraphicsRectItem):
oneRectToReturnThemAll=QtCore.QRectF(0,0,0,0)#prevent the annoying "NotImplementError" from Qt for boundingRect. For items that don't need any collision detection.
@ -36,9 +36,6 @@ from .constantsAndConfigs import constantsAndConfigs
importengine.apiasapi
oneRectToReturnThemAll=QtCore.QRectF(0,0,0,0)#prevent the annoying "NotImplementError" from Qt for boundingRect. For items that don't need any collision detection.
oneRectToReturnThemAll=QtCore.QRectF(0,0,0,0)#prevent the annoying "NotImplementError" from Qt for boundingRect. For items that don't need any collision detection.
@ -89,13 +84,13 @@ class GuiTupletNumber(QtWidgets.QGraphicsItem):
pen.setColor(QtGui.QColor("darkGrey"))
pen.setWidth(1)
defpaint(self,*args):
pass
defboundingRect(self,*args):
returnoneRectToReturnThemAll
defboundingRect(self):
returnself.childrenBoundingRect()
def__init__(self,upper,lower):
super().__init__()
self.setFlag(QtWidgets.QGraphicsItem.ItemHasNoContents,True)#only child items. Without this we get notImplementedError: QGraphicsItem.paint() is abstract and must be overridden
@ -117,6 +112,7 @@ class GuiItem(QtWidgets.QGraphicsItem):
"""A blank item. Subclass to implement your own"""
def__init__(self,staticItem):
super().__init__()
self.setFlag(QtWidgets.QGraphicsItem.ItemHasNoContents,True)#only child items. Without this we get notImplementedError: QGraphicsItem.paint() is abstract and must be overridden
self.staticItem=staticItem
dur=self.staticItem["completeDuration"]
exceptions=["BlockEndMarker"]
@ -137,10 +133,9 @@ class GuiItem(QtWidgets.QGraphicsItem):
inGuiChord"""
pass
defpaint(self,*args):
pass
defboundingRect(self,*args):
returnoneRectToReturnThemAll
defboundingRect(self):
returnself.childrenBoundingRect()
defstretchXCoordinates(self,factor):
"""Reposition the items on the X axis.
@ -185,22 +180,6 @@ class GuiRectangleNotehead(QtWidgets.QGraphicsRectItem):
self.accidental.setPos(0,0)#not analogue to the notehead acciental position because here we choose the rectangle as parent
self.accidental.setParentItem(self)
#NOTE: this was from a time when mouse modification was possible. Leave for later use.
#def shape(self):
# """Qt Function
# Return a more accurate shape for this item so that
# mouse hovering is more accurate.
#
# Must be within the bounding rect."""
# return self.path
#def boundingRect(self, *args):
# """Keep in syn with self.shape()"""
# return self.pathRect
#def paint(self, *args):
#Do NOT implement this. This actually works already. The parent item needs this.
"""Displays the velocity of one note when in rectangle view mode.
@ -250,21 +229,6 @@ class GuiRectangleVelocity(QtWidgets.QGraphicsRectItem):
#Misc Qt Flags
self.setAcceptHoverEvents(False)#Make this explicit so it will be remembered that the gui rectangle velocity is a display only.
#NOTE: this was from a time when mouse modification was possible. Leave for later use.
#def shape(self):
# """Qt Function
# Return a more accurate shape for this item so that
# mouse hovering is more accurate.
#
# Must be within the bounding rect."""
# return self.path
#def boundingRect(self, *args):
# """Keep in syn with self.shape()"""
# return self.pathRect
#def paint(self, *args):
#Do NOT implement this. This actually works already. The parent item needs this.
classGuiRectangle(QtWidgets.QGraphicsItem):
"""An alternative notehead, used to change velocity and duration
@ -281,24 +245,22 @@ class GuiRectangle(QtWidgets.QGraphicsItem):
def__init__(self,noteExportObject):
super().__init__()
self.setFlag(QtWidgets.QGraphicsItem.ItemHasNoContents,True)#only child items. Without this we get notImplementedError: QGraphicsItem.paint() is abstract and must be overridden
self.setFlag(QtWidgets.QGraphicsItem.ItemHasNoContents,True)#only child items. Without this we get notImplementedError: QGraphicsItem.paint() is abstract and must be overridden
@ -43,8 +43,6 @@ from .submenus import BlockPropertiesEdit
cosmeticPen=QtGui.QPen()
cosmeticPen.setCosmetic(True)
oneRectToReturnThemAll=QtCore.QRectF(0,0,0,0)#prevent the annoying "NotImplementError" from Qt for boundingRect. For items that don't need any collision detection.
classGuiBlockHandle(QtWidgets.QGraphicsRectItem):
"""A simplified version of a Block. Since we don't use blocks in the GUI, only in the backend
westillneedthemsometimesasmacrostrutures,wherewedon't care about the content.
@ -95,8 +93,6 @@ class GuiBlockHandle(QtWidgets.QGraphicsRectItem):
@ -243,8 +236,6 @@ class GuiTrack(QtWidgets.QGraphicsItem):
ifresult[1]:
api.setTrackName(self.parent.staticExportItem["id"],nameString=result[0],initialInstrumentName=self.parent.staticExportItem["initialInstrumentName"],initialShortInstrumentName=self.parent.staticExportItem["initialShortInstrumentName"])#keep the old lilypond names
"""Handling all items as individuals when deleting a track to redraw it is too much.
BetterletQthandleitallatonce."""
def__init__(self,parent):
super().__init__()
self.parent=parent
self.setFlag(QtWidgets.QGraphicsItem.ItemHasNoContents,True)#only child items. Without this we get notImplementedError: QGraphicsItem.paint() is abstract and must be overridden
"""Create staff objects including simple barlines"""
@ -426,7 +424,8 @@ class GuiTrack(QtWidgets.QGraphicsItem):
metaDataDict=staticRepresentationList.pop()
forstaticIteminstaticRepresentationList:
item=staticItem2Item(staticItem)
item.setParentItem(self.anchor)
#item.setParentItem(self.anchor)
self.anchor.addToGroup(item)
itemsAppend(item)
item.setPos(item.pixelPosition,0)# Y axis is set by the position of the track. This sets the position of the whole ItemGroup. The actual pitch of a chord/note is set locally by the chord itself and of no concern here.
item.setZValue(5)#This is the z value within GuiTrack