Example #1
0
class ContextMenu(FsmState):
    def __init__(self, qscore, qmeasure, note, screenPos):
        super(ContextMenu, self).__init__(qscore)
        if qscore.hasDragSelection():
            if not qscore.inDragSelection(note):
                qscore.clearDragSelection()
        self.menu = QMeasureContextMenu(qscore, qmeasure, note,
                                        qmeasure.alternateText())
        self.measure = qmeasure
        self.note = note
        QtCore.QTimer.singleShot(0, lambda: self.menu.exec_(screenPos))

    def send(self, event):
        msgType = type(event)
        newState = self
        if msgType == Event.MenuSelect:
            newState = Waiting(self.qscore)
        elif msgType == Event.MenuCancel:
            newState = Waiting(self.qscore)
        elif msgType == Event.Escape:
            self.menu.close()
            newState = Waiting(self.qscore)
        elif msgType == Event.RepeatNotes:
            newState = Repeating(self.qscore, self.note)
        elif msgType == Event.StartPlaying:
            self.menu.close()
            newState = Playing(self.qscore)
        elif msgType == Event.SetAlternateEvent:
            newState = SetAlternateState(self.qscore, event.alternateText,
                                         event.measurePosition)
        elif msgType == Event.EditMeasureProperties:
            newState = EditMeasurePropertiesState(self.qscore, event.counter,
                                                  event.counterRegistry,
                                                  event.measurePosition)
        return newState
Example #2
0
 def __init__(self, qscore, qmeasure, note, screenPos):
     super(ContextMenu, self).__init__(qscore)
     if qscore.hasDragSelection():
         if not qscore.inDragSelection(note):
             qscore.clearDragSelection()
     self.menu = QMeasureContextMenu(qscore, qmeasure, note,
                                     qmeasure.alternateText())
     self.measure = qmeasure
     self.note = note
     QtCore.QTimer.singleShot(0, lambda: self.menu.exec_(screenPos))
Example #3
0
 def __init__(self, qscore, qmeasure, note, screenPos):
     super(ContextMenu, self).__init__(qscore)
     if qscore.hasDragSelection():
         if not qscore.inDragSelection(note):
             qscore.clearDragSelection()
     self.menu = QMeasureContextMenu(qscore, qmeasure, note,
                                     qmeasure.alternateText())
     self.measure = qmeasure
     self.note = note
     QtCore.QTimer.singleShot(0, lambda: self.menu.exec_(screenPos))
Example #4
0
class ContextMenu(FsmState):
    def __init__(self, qscore, qmeasure, note, screenPos):
        super(ContextMenu, self).__init__(qscore)
        if qscore.hasDragSelection():
            if not qscore.inDragSelection(note):
                qscore.clearDragSelection()
        self.menu = QMeasureContextMenu(qscore, qmeasure, note,
                                        qmeasure.alternateText())
        self.measure = qmeasure
        self.note = note
        QtCore.QTimer.singleShot(0, lambda: self.menu.exec_(screenPos))


    def send(self, event):
        msgType = type(event)
        newState = self
        if msgType == Event.MenuSelect:
            newState = Waiting(self.qscore)
        elif msgType == Event.MenuCancel:
            newState = Waiting(self.qscore)
        elif msgType == Event.Escape:
            self.menu.close()
            newState = Waiting(self.qscore)
        elif msgType == Event.RepeatNotes:
            newState = Repeating(self.qscore, self.note)
        elif msgType == Event.StartPlaying:
            self.menu.close()
            newState = Playing(self.qscore)
        elif msgType == Event.SetAlternateEvent:
            newState = SetAlternateState(self.qscore, event.alternateText,
                                     event.measurePosition)
        elif msgType == Event.EditMeasureProperties:
            newState = EditMeasurePropertiesState(self.qscore,
                                                  event.counter,
                                                  event.counterRegistry,
                                                  event.measurePosition)
        return newState