c'est bof... on va essayer autre chose.
[minwii.git] / src / app / widgets / playingscreen.py
index 8ded80d..9f84ee5 100755 (executable)
@@ -135,22 +135,27 @@ class SongPlayingScreen(_PlayingScreenBase) :
     def __init__(self, synth, song, mode=PLAYING_MODES['NORMAL']) :
         super(SongPlayingScreen, self).__init__(synth, song.distinctNotes)
         self.song = song
     def __init__(self, synth, song, mode=PLAYING_MODES['NORMAL']) :
         super(SongPlayingScreen, self).__init__(synth, song.distinctNotes)
         self.song = song
+        self.currentColumn = None
         self.noteIterator = self.song.iterNotes()
         self.noteIterator = self.song.iterNotes()
-        self.play()
+        self.displayNext()
     
     
-    def play(self) :
+    def displayNext(self) :
+        if self.currentColumn:
+            self.currentColumn.update(False)
         note, verseIndex = self.noteIterator.next()
         note, verseIndex = self.noteIterator.next()
-        syllabus = note.lyrics[verseIndex].syllabus()
+        syllabus = note.lyrics[verseIndex].syllabus(encoding="iso-8859-1")
         column = self.columns[note.midi]
         column.update(True, syllabus)
         column = self.columns[note.midi]
         column.update(True, syllabus)
+        self.currentColumn = column
     
     
+    @event_handler(events.KEYDOWN)
+    def handleKeyDown(self, event) :
+        col = event.column
+        if col == self.currentColumn:
+            self.synth.noteon(0, col.tone.midi, DEFAULT_MIDI_VELOCITY)
     
     
-    @event_handler(events.NOTEON)
-    def noteon(self, evt) :
-        tone = evt.tone
-        self.synth.noteon(0, tone.midi, DEFAULT_MIDI_VELOCITY)
-
-    @event_handler(events.NOTEOFF)
-    def noteoff(self, evt) :
-        tone = evt.tone
-        self.synth.noteoff(0, tone.midi)
+    @event_handler(events.KEYUP)
+    def handleKeyUp(self, event) :
+        self.synth.noteoff(0, self.currentColumn.tone.midi)
+        self.displayNext()
+    
\ No newline at end of file