Exemple #1
0
 def initialize(self):
     self.qscore.clearDragSelection()
     self.menu = QMenuIgnoreCancelClick(self.qscore)
     kit = self.qscore.score.drumKit
     for noteHead in kit.allowedNoteHeads(self.event.note.drumIndex):
         def noteAction(nh = noteHead):
             self.qscore.sendFsmEvent(Event.MenuSelect(nh))
         self.menu.addAction(noteHead, noteAction)
     QtCore.QTimer.singleShot(0,
                              lambda: self.menu.exec_(self.event.screenPos))
Exemple #2
0
class NotesMenu(DbState):
    def initialize(self):
        self.qscore.clearDragSelection()
        self.menu = QMenuIgnoreCancelClick(self.qscore)
        kit = self.qscore.score.drumKit
        for noteHead in kit.allowedNoteHeads(self.event.note.drumIndex):
            def noteAction(nh = noteHead):
                self.qscore.sendFsmEvent(Event.MenuSelect(nh))
            self.menu.addAction(noteHead, noteAction)
        QtCore.QTimer.singleShot(0,
                                 lambda: self.menu.exec_(self.event.screenPos))

    def select(self, event):
        command = ToggleNote(self.qscore, self.event.note, event.data)
        self.qscore.addCommand(command)

    def close(self, event_):
        self.menu.close()