projects
/
minwii.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Le test des boutons de la souris n'est pas fiable, tant que le set_pos n'aura pas...
[minwii.git]
/
src
/
minwii
/
widgets
/
playingscreen.py
diff --git
a/src/minwii/widgets/playingscreen.py
b/src/minwii/widgets/playingscreen.py
index
0e179dd
..
ca6a1e3
100755
(executable)
--- 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
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
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) :
@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)
self.stop()
@event_handler(pygame.MOUSEBUTTONDOWN)
@@
-226,7
+229,7
@@
class SongPlayingScreen(PlayingScreenBase) :
def handleEasyColumnOver(self, event) :
col = event.column
if col.state and \
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(
not self.currentNotePlayed :
self.playnote(col, event.pos)
SongPlayingScreen.setNoteTimeout(
@@
-239,7
+242,7
@@
class SongPlayingScreen(PlayingScreenBase) :
def handleNormalColumnOver(self, event) :
col = event.column
if col.state and \
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
not self.currentNotePlayed :
self.playnote(col, event.pos)
self.currentNotePlayed = True
@@
-292,11
+295,17
@@
class SongPlayingScreen(PlayingScreenBase) :
def displayNext(self, event=None) :
if self.currentColumn:
self.currentColumn.update(False)
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'…'
try :
syllabus = note.lyrics[verseIndex].syllabus()
except IndexError :
syllabus = u'…'
+
column = self.columns[note.midi]
column.update(True, syllabus)
self.currentColumn = column
column = self.columns[note.midi]
column.update(True, syllabus)
self.currentColumn = column