From baf4f2fe0e04d6b95c428813dd920b597031ec04 Mon Sep 17 00:00:00 2001 From: pin Date: Tue, 4 May 2010 12:16:40 +0000 Subject: [PATCH] restitution des mouvements du curseur. git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@163 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/app/logfilereader.py | 4 ++++ src/app/widgets/cursors.py | 6 ++++++ 2 files changed, 10 insertions(+) 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) -- 2.20.1