X-Git-Url: https://scm.cri.ensmp.fr/git/minwii.git/blobdiff_plain/79aca379ed6dffa4d71d66f513a973d2e3470c5a..3a63a57ad7692cd3da1818b6b22002c113dd62f0:/src/minwii/widgets/playingscreen.py diff --git a/src/minwii/widgets/playingscreen.py b/src/minwii/widgets/playingscreen.py index 0591929..adb6981 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 @@ -292,8 +293,17 @@ class SongPlayingScreen(PlayingScreenBase) : def displayNext(self, event=None) : if self.currentColumn: self.currentColumn.update(False) - note, verseIndex = self.noteIterator.next() - syllabus = note.lyrics[verseIndex].syllabus() + 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