def paintBlockBackgroundColors(self, staticBlocksRepresentation):
"""This gets not called by self.createGraphicItemsFromData but only by
a score callback for blocksChanged"""
for bg in self.backgroundBlockColors:
self.parentScore.removeWhenIdle(bg)
for th in self.transparentBlockHandles:
self.parentScore.removeWhenIdle(th)
self.backgroundBlockColors = []
self.transparentBlockHandles = []
for block in staticBlocksRepresentation:
if self.staticExportItem["double"]: #double track, twice as high
h = 10 * constantsAndConfigs.stafflineGap
else:
h = 4 * constantsAndConfigs.stafflineGap
bgItem = QtWidgets.QGraphicsRectItem(0, 0, block["completeDuration"] / constantsAndConfigs.ticksToPixelRatio, h) #x, y, w, h
bgItem.setFlag(QtWidgets.QGraphicsItem.ItemIgnoresParentOpacity)
bgItem.setPen(QtGui.QColor("transparent"))
color = self.stringToColor(block["name"])
bgItem.setBrush(color)
bgItem.setParentItem(self)
self.backgroundBlockColors.append(bgItem)
bgItem.setPos(block["tickindex"] / constantsAndConfigs.ticksToPixelRatio, -2*constantsAndConfigs.stafflineGap)
bgItem.setZValue(-10) #This is the z value within GuiTrack
bgItem.setEnabled(False)
transparentBlockHandle = GuiBlockHandle(self, block, 0, -2 * constantsAndConfigs.stafflineGap, block["completeDuration"] / constantsAndConfigs.ticksToPixelRatio, h + 4 * constantsAndConfigs.stafflineGap) #x, y, w, h
transparentBlockHandle.color = color
self.transparentBlockHandles.append(transparentBlockHandle)
transparentBlockHandle.setPos(block["tickindex"] / constantsAndConfigs.ticksToPixelRatio, -2*constantsAndConfigs.stafflineGap)
评论列表
文章目录