From 975ed3f44e237886978f0063f2907baa8eaf46c1 Mon Sep 17 00:00:00 2001 From: pin Date: Mon, 4 Mar 2013 10:23:54 +0000 Subject: [PATCH] =?utf8?q?Gestion=20explicite=20de=20KeyboardInterrupt=20p?= =?utf8?q?our=20=C3=AAtre=20s=C3=BBr=20de=20quitter=20le=20jeu=20sur=20un?= =?utf8?q?=20^C.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@420 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/minwii/widgets/instrumentselector.py | 12 ++++++++---- src/minwii/widgets/playingscreen.py | 14 +++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/minwii/widgets/instrumentselector.py b/src/minwii/widgets/instrumentselector.py index 52799d0..f8a5e32 100755 --- a/src/minwii/widgets/instrumentselector.py +++ b/src/minwii/widgets/instrumentselector.py @@ -60,10 +60,14 @@ class InstrumentSelector(pygame.sprite.LayeredDirty, EventHandlerMixin) : pygame.display.flip() pygame.mouse.set_visible(False) while self._running : - EventDispatcher.dispatchEvents() - dirty = self.draw(pygame.display.get_surface()) - pygame.display.update(dirty) - clock.tick(FRAMERATE) + try : + EventDispatcher.dispatchEvents() + dirty = self.draw(pygame.display.get_surface()) + pygame.display.update(dirty) + clock.tick(FRAMERATE) + except KeyboardInterrupt : + self.stop() + raise def stop(self) : self._running = False diff --git a/src/minwii/widgets/playingscreen.py b/src/minwii/widgets/playingscreen.py index 66d05a3..90a6d2a 100755 --- a/src/minwii/widgets/playingscreen.py +++ b/src/minwii/widgets/playingscreen.py @@ -98,11 +98,15 @@ class PlayingScreenBase(pygame.sprite.LayeredDirty, EventHandlerMixin) : pygame.display.flip() pygame.mouse.set_visible(False) while self._running : - EventDispatcher.dispatchEvents() - self.kinectRgb.update() - dirty = self.draw(pygame.display.get_surface()) - pygame.display.update(dirty) - clock.tick(FRAMERATE) + try : + EventDispatcher.dispatchEvents() + self.kinectRgb.update() + dirty = self.draw(pygame.display.get_surface()) + pygame.display.update(dirty) + clock.tick(FRAMERATE) + except KeyboardInterrupt : + self.stop() + raise def stop(self) : self._running = False -- 2.20.1