From: pin Date: Tue, 4 May 2010 12:16:40 +0000 (+0000) Subject: restitution des mouvements du curseur. X-Git-Url: https://scm.cri.mines-paristech.fr/git/minwii.git/commitdiff_plain/baf4f2fe0e04d6b95c428813dd920b597031ec04?ds=inline;hp=a38e2f50572bdaaff5aa6d99a8cefe91bb856ec5 restitution des mouvements du curseur. git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@163 fe552daf-6dbe-4428-90eb-1537e0879342 --- diff --git a/src/app/logfilereader.py b/src/app/logfilereader.py index a32d834..9955623 100755 --- a/src/app/logfilereader.py +++ b/src/app/logfilereader.py @@ -174,6 +174,10 @@ class LogFilePlayer(PlayingScreenBase) : chan, key = [int(v) for v in message.split(None, 1)] self.synth.noteoff(chan, key) + elif eventName.startswith('COL') : + pos = [int(n) for n in message.split(None, 4)[-1].strip('()').split(',')] + self.cursor.setPosition(pos) + pygame.event.clear() # à virer #EventDispatcher.dispatchEvents() diff --git a/src/app/widgets/cursors.py b/src/app/widgets/cursors.py index fc05b56..1e3fc4e 100755 --- a/src/app/widgets/cursors.py +++ b/src/app/widgets/cursors.py @@ -99,3 +99,9 @@ class WarpingCursor(pygame.sprite.DirtySprite, EventHandlerMixin): def move(self, event) : self.dirty = 1 self.rect.move_ip(event.rel) + + def setPosition(self, pos) : + self.dirty = 1 + x, y = pos + rx, ry = self.rect.centerx, self.rect.centery + self.rect.move_ip(x-rx, y-ry)