コード例 #1
0
 def onTuningChanged(self, tuning):
     t = [
         SHARP2FLAT.get(x, x)
         for x in re.findall(r'[A-G][#b]?', str(tuning))
     ]
     self.view.neck.setTuning(t)
     self.view.neck.updateAll()
     self.view.fitNeck()
コード例 #2
0
    def checkNoteName(self, noteName):
        """Ensure noteName is valid.

        A valid note is one found in the global NOTES or in the keys of the
        global dict SHARP2FLAT.

        Return a valid note name or raise Exception if invalid.
        """
        if noteName not in NOTES:
            noteName = SHARP2FLAT.get(noteName)
            if noteName is None:
                raise Exception("Illegal note {}".format(repr(noteName)))
        return noteName
コード例 #3
0
ファイル: necknote.py プロジェクト: stirfoo/gneck
    def onNoteGuessPress(self, noteName):
        """Check if the user guessed the right note.

        noteName -- string label of the button pressed (Unicode)

        If note matches the current note displayed on the neck, call
        nextNote(), else show all the positions of the current note on the
        neck.

        Called when a Note button is pressed.
        """
        if SHARP2FLAT.get(noteName, noteName) == self.curNote:
            self.onNextNote()
        else:
            self.view.neck.markAll(self.curNote)
            self.scene.update()
コード例 #4
0
    def onNoteGuessPress(self, noteName):
        """Check if the user guessed the right note.

        noteName -- string label of the button pressed (Unicode)

        If note matches the current note displayed on the neck, call
        nextNote(), else show all the positions of the current note on the
        neck.

        Called when a Note button is pressed.
        """
        if SHARP2FLAT.get(noteName, noteName) == self.curNote:
            self.onNextNote()
        else:
            self.view.neck.markAll(self.curNote)
            self.scene.update()
コード例 #5
0
ファイル: necknote.py プロジェクト: stirfoo/gneck
 def onTuningChanged(self, tuning):
     t = [SHARP2FLAT.get(x, x)
          for x in re.findall(r'[A-G][#b]?', str(tuning))]
     self.view.neck.setTuning(t)
     self.view.neck.updateAll()
     self.view.fitNeck()