structures.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:Laborejo 作者: hilbrichtsoftware 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号