From: pin Date: Mon, 6 Sep 2010 13:20:12 +0000 (+0000) Subject: Le test des boutons de la souris n'est pas fiable, tant que le set_pos n'aura pas... X-Git-Url: https://scm.cri.mines-paristech.fr/git/minwii.git/commitdiff_plain/35997bc815c869fcee2b1f158e3d28a6a3553c4e Le test des boutons de la souris n'est pas fiable, tant que le set_pos n'aura pas comme paramètre les boutons appuyés… git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@314 fe552daf-6dbe-4428-90eb-1537e0879342 --- diff --git a/src/minwii/widgets/cursors.py b/src/minwii/widgets/cursors.py index f7940fd..4edc2dc 100755 --- a/src/minwii/widgets/cursors.py +++ b/src/minwii/widgets/cursors.py @@ -48,6 +48,7 @@ class WarpingCursor(pygame.sprite.DirtySprite, EventHandlerMixin): self.duration = duration self.image = self.images[0] + self.pressed = False # workarround cursor alignement problem pygame.event.set_blocked(pygame.MOUSEMOTION) pygame.mouse.set_pos(pygame.mouse.get_pos()) @@ -91,6 +92,7 @@ class WarpingCursor(pygame.sprite.DirtySprite, EventHandlerMixin): self.dirty = 1 self._blinking = False self.image = self.flashImage + self.pressed = True @event_handler(pygame.MOUSEBUTTONUP) def flashOff(self, event) : @@ -99,6 +101,7 @@ class WarpingCursor(pygame.sprite.DirtySprite, EventHandlerMixin): self._blinking = True else : self.image = self.images[0] + self.pressed = False @event_handler(pygame.MOUSEMOTION) def move(self, event) : @@ -129,4 +132,4 @@ class ForeverTimer(Thread) : time.sleep(self.duration) def stop(self) : - self.running = False \ No newline at end of file + self.running = False diff --git a/src/minwii/widgets/playingscreen.py b/src/minwii/widgets/playingscreen.py index 66c4776..ca6a1e3 100755 --- a/src/minwii/widgets/playingscreen.py +++ b/src/minwii/widgets/playingscreen.py @@ -229,7 +229,7 @@ class SongPlayingScreen(PlayingScreenBase) : 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( @@ -242,7 +242,7 @@ class SongPlayingScreen(PlayingScreenBase) : 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