conductor.py 文件源码

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

项目:Laborejo 作者: hilbrichtsoftware 项目源码 文件源码
def __init__(self, parentTempoTrack, staticExportItem):
        self.__class__.instances.append(self)
        super().__init__()
        self.staticExportItem = staticExportItem
        self.parentTempoTrack = parentTempoTrack

        if not self.staticExportItem["positionInBlock"] == 0:
            self.setAcceptHoverEvents(True)
            self.setFlags(QtWidgets.QGraphicsItem.ItemIsMovable|QtWidgets.QGraphicsItem.ItemIsFocusable)
            self.setCursor(QtCore.Qt.SizeHorCursor) #this sets the cursor while the mouse is over the item. It is independent of AcceptHoverEvents
        else:
            self.ungrabMouse = api.nothing #to surpress a warning from the context menu

        self.note = QtWidgets.QGraphicsTextItem("")
        self.note.setParentItem(self)
        self.note.setFont(constantsAndConfigs.musicFont)
        self.note.setHtml("<font size='6'>{}</font>".format(constantsAndConfigs.realNoteDisplay[staticExportItem["referenceTicks"]]))
        self.note.setPos(-6,0) #adjust items font x offsset.

        self.number = QtWidgets.QGraphicsTextItem("")
        self.number.setParentItem(self)
        #self.number.setHtml("<font color='black' size='2'>{}</font>".format(str(int(staticExportItem["unitsPerMinute"]))))
        self.number.setHtml("<font size='2'>{}</font>".format(str(int(staticExportItem["unitsPerMinute"]))))
        self.number.setPos(-6,0) #adjust items font x offsset.

        if not self.staticExportItem["graphType"] == "standalone":
            self.arrow = QtWidgets.QGraphicsTextItem("?") #unicode long arrow right #http://xahlee.info/comp/unicode_arrows.html
            self.arrow.setParentItem(self)
            self.arrow.setPos(7,30)
        else:
            self.arrow = None

        for n in (self.note, self.number, self.arrow):
            if n: n.setDefaultTextColor(QtGui.QColor("black"))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号