structures.py 文件源码

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

项目:Laborejo 作者: hilbrichtsoftware 项目源码 文件源码
def createStaffLines(self, lengthInPixel = 0):
        """By default creates 5 stafflines. But it can be 10;
        5 extra below the origin-staff.
        This is NOT a double-system like a piano but just a staff
        with more lines that happens to have the range of e.g.
        treble + bass clef."""

        def createLine(yOffset):
            line = QtWidgets.QGraphicsLineItem(QtCore.QLineF(0, 0, lengthInPixel, 0))
            line.setParentItem(self)
            line.setPen(cosmeticPen)
            self.staffLines.append(line)
            line.setPos(0, yOffset*constantsAndConfigs.stafflineGap)
            line.setZValue(-5) #This is the z value within GuiTrack

        for l in self.staffLines:
            self.parentScore.removeWhenIdle(l)
        self.staffLines = []
        lengthInPixel += 25 #a bonus that gives the hint that you can write after the last object.

        for i in range(-2, 3): #the normal 5 line system. We have a lower and upper range/position. The middle line is at position 0
            createLine(i)

        if self.staticExportItem["double"]: #add more stuffs below (user-perspective. positive Qt values)
            for i in range(4, 9): #i is now 3. Make a gap:
                createLine(i)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号