X-Git-Url: https://scm.cri.mines-paristech.fr/git/minwii.git/blobdiff_plain/145a1e9a14954feaf5e3f6806e33c5cd49439bc9..3c10e656308bd0f29d8ac4d15f7f95f29aec1697:/src/minwii/widgets/playingscreen.py diff --git a/src/minwii/widgets/playingscreen.py b/src/minwii/widgets/playingscreen.py index 0e179dd..66c4776 100755 --- a/src/minwii/widgets/playingscreen.py +++ b/src/minwii/widgets/playingscreen.py @@ -10,6 +10,7 @@ import pygame import types import minwii.events as events +from minwii.log import eventLogger from minwii.eventutils import event_handler, EventDispatcher, EventHandlerMixin from minwii.musicxml import Tone from minwii.config import FRAMERATE @@ -99,7 +100,9 @@ class PlayingScreenBase(pygame.sprite.LayeredDirty, EventHandlerMixin) : @event_handler(pygame.KEYDOWN) def handleKeyDown(self, event) : - if event.key == pygame.K_q or event.unicode == u'q': + if event.key == pygame.K_q or \ + event.unicode == u'q' or \ + pygame.K_ESCAPE: self.stop() @event_handler(pygame.MOUSEBUTTONDOWN) @@ -292,11 +295,17 @@ class SongPlayingScreen(PlayingScreenBase) : def displayNext(self, event=None) : if self.currentColumn: self.currentColumn.update(False) - note, verseIndex = self.noteIterator.next() + try : + note, verseIndex = self.noteIterator.next() + except StopIteration : + self.noteIterator = self.song.iterNotes() + note, verseIndex = self.noteIterator.next() + eventLogger.info(pygame.event.Event(events.SONGEND)) try : syllabus = note.lyrics[verseIndex].syllabus() except IndexError : syllabus = u'…' + column = self.columns[note.midi] column.update(True, syllabus) self.currentColumn = column