- def displayNext(self) :
- if self.currentColumn:
- self.currentColumn.update(False)
- note, verseIndex = self.noteIterator.next()
- syllabus = note.lyrics[verseIndex].syllabus(encoding="iso-8859-1")
- column = self.columns[note.midi]
- column.update(True, syllabus)
- self.currentColumn = column
- self.currentNotePlayed = False
+ def _plugListeners(self, mode) :
+ "initialisation des gestionnaires d'événements en fonction du mode"
+
+ if mode == PLAYING_MODES_DICT['BEGINNER'] :
+ EventDispatcher.addEventListener(events.COLOVER, self.handleBeginnerColumnOver)
+
+ elif mode == PLAYING_MODES_DICT['EASY'] :
+ EventDispatcher.addEventListener(events.COLDOWN, self.handleEasyColumnDown)
+ EventDispatcher.addEventListener(events.COLOVER, self.handleEasyColumnOver)
+
+ elif mode == PLAYING_MODES_DICT['NORMAL'] :
+ EventDispatcher.addEventListener(events.COLOVER, self.handleNormalColumnOver)
+ EventDispatcher.addEventListener(events.COLDOWN, self.handleColumnDown)
+ EventDispatcher.addEventListener(events.COLUP, self.handleColumnUp)
+
+ elif mode == PLAYING_MODES_DICT['ADVANCED'] :
+ EventDispatcher.addEventListener(events.COLDOWN, self.handleColumnDown)
+ EventDispatcher.addEventListener(events.COLUP, self.handleColumnUp)
+
+ elif mode == PLAYING_MODES_DICT['EXPERT'] :
+ EventDispatcher.addEventListener(events.COLDOWN, self.handleExpertColumnDown)
+ EventDispatcher.addEventListener(events.COLUP, self.handleExpertColumnUp)
+
+
+ # --- HID listeners ---
+ def handleBeginnerColumnOver(self, event) :
+ col = event.column
+ if col.state and not self.currentNotePlayed :
+ self.playnote(col, event.pos)
+ SongPlayingScreen.setNoteTimeout(
+ int(self.currentNote.duration * \
+ self.quarterNoteDuration)
+ )
+ self.currentNotePlayed = True
+
+ def handleEasyColumnOver(self, event) :
+ col = event.column
+ if col.state and \
+ any(event.mouseEvent.buttons) and \
+ not self.currentNotePlayed :
+ self.playnote(col, event.pos)
+ SongPlayingScreen.setNoteTimeout(
+ int(self.currentNote.duration * \
+ self.quarterNoteDuration)
+ )
+ self.currentNotePlayed = True
+