structures.py 文件源码

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

项目:Laborejo 作者: hilbrichtsoftware 项目源码 文件源码
def createBarlines(self, barlinesTickList):
        """and measure numbers"""
        for bl in self.barLines:
            self.parentScore.removeWhenIdle(bl)
        self.barLines = []

        if self.staticExportItem["double"]:
            h = 10 * constantsAndConfigs.stafflineGap
        else:
            h = 4 * constantsAndConfigs.stafflineGap

        #if barlinesTickList[0] == 0: #happens when there is a metrical instruction at tick 0.
        #    del barlinesTickList[0]

        last = None
        offset = 0
        for barnumber, barlineTick in enumerate(barlinesTickList):
            if barlineTick == last:
                #print ("warning. Double barline at", barlineTick)
                offset += 1
                continue #don't draw the double barline
            last = barlineTick
            line = QtWidgets.QGraphicsLineItem(QtCore.QLineF(0, 0, 0, h))
            line.setParentItem(self)
            self.barLines.append(line)
            line.setPos(barlineTick / constantsAndConfigs.ticksToPixelRatio, -2*constantsAndConfigs.stafflineGap)

            number = QtWidgets.QGraphicsSimpleTextItem(str(barnumber+1-offset))
            number.setScale(0.75)
            number.setParentItem(line)
            number.setPos(-2, -3*constantsAndConfigs.stafflineGap) #-2 on X for a little fine tuning.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号