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
@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)
def handleEasyColumnOver(self, event) :
col = event.column
if col.state and \
- any(event.mouseEvent.buttons) and \
+ self.cursor.pressed and \
not self.currentNotePlayed :
self.playnote(col, event.pos)
SongPlayingScreen.setNoteTimeout(
def handleNormalColumnOver(self, event) :
col = event.column
if col.state and \
- any(event.mouseEvent.buttons) and \
+ self.cursor.pressed and \
not self.currentNotePlayed :
self.playnote(col, event.pos)
self.currentNotePlayed = True
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