X-Git-Url: https://scm.cri.ensmp.fr/git/minwii.git/blobdiff_plain/46f3ffd7fdde386f41020171b5733e55a8e64a85..1355364de08e9b941c6fb93cd95ff0df6703dc21:/src/minwii/widgets/playingscreen.py diff --git a/src/minwii/widgets/playingscreen.py b/src/minwii/widgets/playingscreen.py index 0735825..adb6981 100755 --- a/src/minwii/widgets/playingscreen.py +++ b/src/minwii/widgets/playingscreen.py @@ -7,22 +7,23 @@ $Id$ $URL$ """ import pygame -from cursors import WarpingCursor -from column import Column -import events -from eventutils import event_handler, EventDispatcher, EventHandlerMixin import types -from musicxml import Tone -from config import FRAMERATE -from config import FIRST_HUE -from config import MIDI_VELOCITY_RANGE -from config import MIDI_PAN_RANGE -from config import MIDI_VELOCITY_WRONG_NOTE_ATTN +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 +from minwii.config import FIRST_HUE +from minwii.config import MIDI_VELOCITY_RANGE +from minwii.config import MIDI_PAN_RANGE +from minwii.config import MIDI_VELOCITY_WRONG_NOTE_ATTN +from minwii.globals import BACKGROUND_LAYER +from minwii.globals import CURSOR_LAYER +from minwii.globals import PLAYING_MODES_DICT -from globals import BACKGROUND_LAYER -from globals import CURSOR_LAYER -from globals import PLAYING_MODES_DICT +from cursors import WarpingCursor +from column import Column class PlayingScreenBase(pygame.sprite.LayeredDirty, EventHandlerMixin) : @@ -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