From 02edbeba380166d7a95250df5e8f587745cc0df3 Mon Sep 17 00:00:00 2001 From: daverio Date: Fri, 6 Apr 2012 13:38:33 +0000 Subject: [PATCH 01/16] Nouvelle URL SVN pour Fluidsynth. git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@397 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/install.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/install.txt b/src/install.txt index ea51bd6..b82618b 100644 --- a/src/install.txt +++ b/src/install.txt @@ -3,7 +3,7 @@ install midishare http://midishare.sourceforge.net/ (grame !) -svn co https://resonance.org/svn/fluidsynth/trunk/fluidsynth +svn co https://fluidsynth.svn.sourceforge.net/svnroot/fluidsynth/trunk/fluidsynth@ cd fluidsynth patch : -- 2.20.1 From e20495c66925a06496b90ccbe566cebecc74efa6 Mon Sep 17 00:00:00 2001 From: pin Date: Thu, 28 Feb 2013 09:47:56 +0000 Subject: [PATCH 02/16] Switch distutils -> setuptools. git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@405 fe552daf-6dbe-4428-90eb-1537e0879342 --- setup.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 41e584f..6c3042e 100755 --- a/setup.py +++ b/setup.py @@ -3,23 +3,22 @@ $Id$ $URL$ """ -from distutils.core import setup +from setuptools import setup setup(name='MINDs', version='2.0.2', description='Musique Interactive Numérique pour les Démences', author='Samuel Benveniste', author_email='samuel.benveniste@gmail.com', - # url='', + url='http://minwii.org', packages=['minwii', 'minwii.widgets', 'pywiiuse'], - package_dir={'minwii' : 'src/minwii', - 'minwii.widgets' : 'src/minwii/widgets', - 'pywiiuse' : 'src/pywiiuse'}, + package_dir={'' : 'src'}, package_data={'minwii' : ['fonts/*.ttf', 'soundfonts/Minwii-light-soundfont.sf2'], 'minwii.widgets' : ['data/*.png', 'data/cursor/black/*', 'data/cursor/black-perforated/*', 'data/instruments/*.jpg', - 'data/minwii_theme/*']} + 'data/minwii_theme/*']}, + install_requires=['pyFluidSynth', 'pgu'] ) \ No newline at end of file -- 2.20.1 From 8e408f7be7e00d2d95cdb3fde4dd01a19d7189e7 Mon Sep 17 00:00:00 2001 From: pin Date: Thu, 28 Feb 2013 09:50:31 +0000 Subject: [PATCH 04/16] fix MRO. git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@407 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/minwii/widgets/home.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/minwii/widgets/home.py b/src/minwii/widgets/home.py index 10aa9d6..fc5d562 100755 --- a/src/minwii/widgets/home.py +++ b/src/minwii/widgets/home.py @@ -34,7 +34,7 @@ STYLE_RIGHT_COL = {#'border_right' : 2, 'padding_left' : 20} -class Home(object, Table) : +class Home(Table) : """ Écran de démarrage de minwii """ -- 2.20.1 From c89f2419dd73824a317cb00b43226ccf06a8b041 Mon Sep 17 00:00:00 2001 From: pin Date: Thu, 28 Feb 2013 09:51:32 +0000 Subject: [PATCH 05/16] =?utf8?q?Refactoring.=20Suppression=20de=20la=20cus?= =?utf8?q?tomisation=20du=20path,=20inutile=20=C3=A0=20pr=C3=A9sent.?= 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@408 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/minwii/start.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/minwii/start.py b/src/minwii/start.py index a9d9582..7de9b7a 100755 --- a/src/minwii/start.py +++ b/src/minwii/start.py @@ -8,20 +8,17 @@ $URL$ """ +from optparse import OptionParser +import pygame +from app import MinWii def main(wiimoteSupport, fullscreen) : - import pygame - from app import MinWii pygame.init() minwii = MinWii(wiimoteSupport=wiimoteSupport, fullscreen=fullscreen) minwii.run() pygame.quit() if __name__ == "__main__" : - from os.path import realpath, sep - import sys - from optparse import OptionParser - usage = "%prog [options]" op = OptionParser(usage) @@ -38,8 +35,4 @@ if __name__ == "__main__" : u" [%default]") options, args = op.parse_args() - minwiipath = realpath(__file__).split(sep) - minwiipath = minwiipath[:-2] - minwiipath = sep.join(minwiipath) - sys.path.insert(1, minwiipath) main(options.wiimoteSupport, options.fullscreen) -- 2.20.1 From 1c6473aa5c111d888ac8b7f656c4bf21045a8125 Mon Sep 17 00:00:00 2001 From: pin Date: Thu, 28 Feb 2013 10:17:31 +0000 Subject: [PATCH 06/16] Reprise modifs ld git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@409 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/minwii/synth.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/minwii/synth.py b/src/minwii/synth.py index 6d0034f..f89dcc9 100755 --- a/src/minwii/synth.py +++ b/src/minwii/synth.py @@ -21,7 +21,7 @@ class Synth(FSynth) : - octaviation """ - def __init__(self, gain=0.2, samplerate=44100, sfPath='') : + def __init__(self, gain=0.2, samplerate=44100, sfPath='', driver=None) : FSynth.__init__(self, gain=gain, samplerate=samplerate) if not sfPath : @@ -30,7 +30,7 @@ class Synth(FSynth) : self._gain = gain - self.start() + self.start(driver=driver) self.fsid = self.sfload(sfPath) self._octaveAjusts = {} console.debug('démarrage du synthétiseur') -- 2.20.1 From 50de70078a398fcefd89b1171cd8d0026d716e61 Mon Sep 17 00:00:00 2001 From: pin Date: Thu, 28 Feb 2013 10:45:44 +0000 Subject: [PATCH 07/16] Ajout de l'option --audio-driver. git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@410 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/minwii/app.py | 4 ++-- src/minwii/start.py | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/minwii/app.py b/src/minwii/app.py index 444aafc..a0fa9da 100755 --- a/src/minwii/app.py +++ b/src/minwii/app.py @@ -34,7 +34,7 @@ SCREEN_PLAY = 2 class MinWii(object): - def __init__(self, wiimoteSupport=True, fullscreen=False) : + def __init__(self, wiimoteSupport=True, fullscreen=False, audioDriver=None) : envLogger.info('winwii log format version : %s', LOG_FORMAT_VERSION) self.wiimoteSupport = wiimoteSupport self.fullscreen = fullscreen @@ -43,7 +43,7 @@ class MinWii(object): themedir = os.path.sep.join(themedir) theme = Theme(themedir) self.app = Desktop(theme=theme) - self.synth = Synth() + self.synth = Synth(driver=audioDriver) self.screenResolution = SCREEN_RESOLUTION envLogger.info('résolution écran : %s', self.screenResolution) self.nwiimotes = 0 diff --git a/src/minwii/start.py b/src/minwii/start.py index 7de9b7a..74ab5bf 100755 --- a/src/minwii/start.py +++ b/src/minwii/start.py @@ -12,9 +12,10 @@ from optparse import OptionParser import pygame from app import MinWii -def main(wiimoteSupport, fullscreen) : +def main(wiimoteSupport, fullscreen, audioDriver) : pygame.init() - minwii = MinWii(wiimoteSupport=wiimoteSupport, fullscreen=fullscreen) + audioDriver = None if not audioDriver else audioDriver # cast de '' en None. fluidsynth le teste spécifiquement… + minwii = MinWii(wiimoteSupport=wiimoteSupport, fullscreen=fullscreen, audioDriver=audioDriver) minwii.run() pygame.quit() @@ -33,6 +34,11 @@ if __name__ == "__main__" : , default=False , help = u"activation du mode plein écran" u" [%default]") + op.add_option("--audio-driver", dest="audio_driver" + , action="store" + , default="coreaudio" + , help=u"driver audio pour le synthétiseur (fluidsynth) [%default]" + ) options, args = op.parse_args() - main(options.wiimoteSupport, options.fullscreen) + main(options.wiimoteSupport, options.fullscreen, options.audio_driver) -- 2.20.1 From 19cf0aa5e307f5fbbc411a2014c5fa869197a51f Mon Sep 17 00:00:00 2001 From: pin Date: Thu, 28 Feb 2013 10:52:51 +0000 Subject: [PATCH 08/16] =?utf8?q?Am=C3=A9lioration=20ld.?= 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@411 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/minwii/app.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/minwii/app.py b/src/minwii/app.py index a0fa9da..b9219ae 100755 --- a/src/minwii/app.py +++ b/src/minwii/app.py @@ -39,8 +39,7 @@ class MinWii(object): self.wiimoteSupport = wiimoteSupport self.fullscreen = fullscreen LaunchScreen() - themedir = __file__.split(os.path.sep)[:-1] + ['widgets', 'data', 'minwii_theme'] - themedir = os.path.sep.join(themedir) + themedir = os.path.join(os.path.dirname(__file__), 'widgets', 'data', 'minwii_theme') theme = Theme(themedir) self.app = Desktop(theme=theme) self.synth = Synth(driver=audioDriver) -- 2.20.1 From 7f861db051bcbbaed3f47e3a90e60a3b9781f5e4 Mon Sep 17 00:00:00 2001 From: pin Date: Thu, 28 Feb 2013 12:12:44 +0000 Subject: [PATCH 09/16] =?utf8?q?D=C3=A9but=20d'int=C3=A9gration=20de=20la?= =?utf8?q?=20Kinect.=20Ajout=20d'un=20script=20qui=20affiche=20la=20vid?= =?utf8?q?=C3=A9o=20dans=20une=20fen=C3=AAtre=20pygame.?= 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@412 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/kinect/__init__.py | 0 src/kinect/pygamedisplay.py | 60 +++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100755 src/kinect/__init__.py create mode 100755 src/kinect/pygamedisplay.py diff --git a/src/kinect/__init__.py b/src/kinect/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/src/kinect/pygamedisplay.py b/src/kinect/pygamedisplay.py new file mode 100755 index 0000000..6a4f834 --- /dev/null +++ b/src/kinect/pygamedisplay.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +""" +Affichage vidéo (et autres) de la kinect pour expérimentations / debug. + +$Id$ +$URL$ +""" + +from openni import * +import numpy +import cv +import pygame + +SCREEN_SIZE = 640, 480 +SCREEN_TITLE = "Kinect debug" +FPS = 30 + +def capture_rgb(imgGene): + rgb_frame = numpy.fromstring(imgGene.get_raw_image_map_bgr(), dtype=numpy.uint8).reshape(480, 640, 3) + image = cv.fromarray(rgb_frame) + cv.CvtColor(cv.fromarray(rgb_frame), image, cv.CV_BGR2RGB) + pyimage = pygame.image.frombuffer(image.tostring(), cv.GetSize(image), 'RGB') + + return pyimage + +def main() : + # init openni + context = Context() + context.init() + + #init pygame + pygame.init() + screen = pygame.display.set_mode(SCREEN_SIZE) + pygame.display.set_caption(SCREEN_TITLE) + + imgGene = ImageGenerator() + imgGene.create(context) + imgGene.set_resolution_preset(RES_VGA) + imgGene.fps = FPS + + context.start_generating_all() + + + sur = pygame.Surface((640, 480)) + sur.fill((255, 255, 255)) + + while True : + for event in pygame.event.get(): + pass + + context.wait_one_update_all(imgGene) + cv.WaitKey(10) + + rgbImg = capture_rgb(imgGene) + sur.blit(rgbImg, (0, 0)) + screen.blit(sur, (0, 0)) + pygame.display.flip() + +if __name__ == "__main__" : + main() -- 2.20.1 From 128d1283372aa86d58d346569a08a97d64f5acf6 Mon Sep 17 00:00:00 2001 From: pin Date: Thu, 28 Feb 2013 12:16:18 +0000 Subject: [PATCH 10/16] Retrait ligne inutile. git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@413 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/kinect/pygamedisplay.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/kinect/pygamedisplay.py b/src/kinect/pygamedisplay.py index 6a4f834..e5b1e59 100755 --- a/src/kinect/pygamedisplay.py +++ b/src/kinect/pygamedisplay.py @@ -49,7 +49,6 @@ def main() : pass context.wait_one_update_all(imgGene) - cv.WaitKey(10) rgbImg = capture_rgb(imgGene) sur.blit(rgbImg, (0, 0)) -- 2.20.1 From 80176b7f79cc55776247822158306c42bded77b5 Mon Sep 17 00:00:00 2001 From: pin Date: Thu, 28 Feb 2013 12:20:25 +0000 Subject: [PATCH 11/16] Affichage comme dans un miroir. git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@414 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/kinect/pygamedisplay.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kinect/pygamedisplay.py b/src/kinect/pygamedisplay.py index e5b1e59..79eda18 100755 --- a/src/kinect/pygamedisplay.py +++ b/src/kinect/pygamedisplay.py @@ -52,7 +52,7 @@ def main() : rgbImg = capture_rgb(imgGene) sur.blit(rgbImg, (0, 0)) - screen.blit(sur, (0, 0)) + screen.blit(pygame.transform.flip(sur, True, False), (0, 0)) pygame.display.flip() if __name__ == "__main__" : -- 2.20.1 From 29dfa14e4419fb6ceb9350223f410e967e8cc4f6 Mon Sep 17 00:00:00 2001 From: pin Date: Fri, 1 Mar 2013 10:30:50 +0000 Subject: [PATCH 12/16] =?utf8?q?Refactoring=20orient=C3=A9=20objet.?= 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@415 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/kinect/pygamedisplay.py | 48 +++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/src/kinect/pygamedisplay.py b/src/kinect/pygamedisplay.py index 79eda18..82621ea 100755 --- a/src/kinect/pygamedisplay.py +++ b/src/kinect/pygamedisplay.py @@ -15,31 +15,36 @@ SCREEN_SIZE = 640, 480 SCREEN_TITLE = "Kinect debug" FPS = 30 -def capture_rgb(imgGene): - rgb_frame = numpy.fromstring(imgGene.get_raw_image_map_bgr(), dtype=numpy.uint8).reshape(480, 640, 3) - image = cv.fromarray(rgb_frame) - cv.CvtColor(cv.fromarray(rgb_frame), image, cv.CV_BGR2RGB) - pyimage = pygame.image.frombuffer(image.tostring(), cv.GetSize(image), 'RGB') - return pyimage +class RGB : + def __init__(self) : + self.context = Context() + self.context.init() + self.imgGene = ImageGenerator() + self.imgGene.create(self.context) + self.imgGene.set_resolution_preset(RES_VGA) + self.imgGene.fps = FPS + self.context.start_generating_all() + + def capture(self) : + rgb_frame = numpy.fromstring(self.imgGene.get_raw_image_map_bgr(), dtype=numpy.uint8).reshape(480, 640, 3) + image = cv.fromarray(rgb_frame) + cv.CvtColor(cv.fromarray(rgb_frame), image, cv.CV_BGR2RGB) + pyimage = pygame.image.frombuffer(image.tostring(), cv.GetSize(image), 'RGB') -def main() : - # init openni - context = Context() - context.init() + return pyimage + + def update(self) : + return self.context.wait_one_update_all(self.imgGene) - #init pygame + + +def main() : pygame.init() screen = pygame.display.set_mode(SCREEN_SIZE) pygame.display.set_caption(SCREEN_TITLE) - imgGene = ImageGenerator() - imgGene.create(context) - imgGene.set_resolution_preset(RES_VGA) - imgGene.fps = FPS - - context.start_generating_all() - + rgb = RGB() sur = pygame.Surface((640, 480)) sur.fill((255, 255, 255)) @@ -48,12 +53,13 @@ def main() : for event in pygame.event.get(): pass - context.wait_one_update_all(imgGene) - - rgbImg = capture_rgb(imgGene) + rgb.update() + + rgbImg = rgb.capture() sur.blit(rgbImg, (0, 0)) screen.blit(pygame.transform.flip(sur, True, False), (0, 0)) pygame.display.flip() + if __name__ == "__main__" : main() -- 2.20.1 From 8efd1374d9e4265c1bd891018e6fd3465eb9e0aa Mon Sep 17 00:00:00 2001 From: pin Date: Fri, 1 Mar 2013 10:59:48 +0000 Subject: [PATCH 13/16] =?utf8?q?Petit=20hack=20pour=20afficher=20la=20vid?= =?utf8?q?=C3=A9o=20de=20la=20kinect=20dans=20l'=C3=A9cran=20de=20jeu.?= 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@416 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/minwii/widgets/playingscreen.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/minwii/widgets/playingscreen.py b/src/minwii/widgets/playingscreen.py index 70d9aa6..5829a4e 100755 --- a/src/minwii/widgets/playingscreen.py +++ b/src/minwii/widgets/playingscreen.py @@ -9,6 +9,8 @@ $URL$ import pygame import types +import kinect.pygamedisplay as kinect + import minwii.events as events from minwii.log import eventLogger from minwii.eventutils import event_handler, EventDispatcher, EventHandlerMixin @@ -44,7 +46,10 @@ class PlayingScreenBase(pygame.sprite.LayeredDirty, EventHandlerMixin) : self._initColumns() self._running = False self.draw(pygame.display.get_surface()) - self._initCursor() + self._initCursor() + + self.kinectRgb = kinect.RGB() + self.kinectRgbSur = pygame.Surface((640, 480)) def _initRects(self) : """ création des espaces réservés pour @@ -96,6 +101,14 @@ class PlayingScreenBase(pygame.sprite.LayeredDirty, EventHandlerMixin) : EventDispatcher.dispatchEvents() dirty = self.draw(pygame.display.get_surface()) pygame.display.update(dirty) + + self.kinectRgb.update() + rgbImg = self.kinectRgb.capture() + self.kinectRgbSur.blit(rgbImg, (0, 0)) + screen = pygame.display.get_surface() + screen.blit(pygame.transform.flip(self.kinectRgbSur, True, False), (0, 0)) + pygame.display.flip() + clock.tick(FRAMERATE) def stop(self) : -- 2.20.1 From fa5bf40bfe796d33480a09d9e6400502552d66f7 Mon Sep 17 00:00:00 2001 From: pin Date: Fri, 1 Mar 2013 12:29:37 +0000 Subject: [PATCH 14/16] =?utf8?q?Impl=C3=A9mentation=20plus=20propre=20avec?= =?utf8?q?=20une=20sous-classe=20de=20Sprite.?= 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@417 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/kinect/pygamedisplay.py | 18 ++++++++++++++++++ src/minwii/widgets/playingscreen.py | 15 ++++----------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/kinect/pygamedisplay.py b/src/kinect/pygamedisplay.py index 82621ea..fbf0b77 100755 --- a/src/kinect/pygamedisplay.py +++ b/src/kinect/pygamedisplay.py @@ -38,6 +38,24 @@ class RGB : return self.context.wait_one_update_all(self.imgGene) +class RGBSprite(pygame.sprite.DirtySprite, RGB) : + + def __init__(self, alpha=255) : + pygame.sprite.DirtySprite.__init__(self) + self.dirty = 2 # toujours dirty ! + RGB.__init__(self) + + self.image = pygame.Surface((640, 480)) + self._regular = pygame.Surface((640, 480)) + self.image.set_alpha(alpha) + self.rect = pygame.Rect((0, 0), (0, 0)) + + def update(self) : + RGB.update(self) + img = self.capture() + self._regular.blit(img, (0, 0)) + self.image.blit(pygame.transform.flip(self._regular, True, False), (0, 0)) + def main() : pygame.init() diff --git a/src/minwii/widgets/playingscreen.py b/src/minwii/widgets/playingscreen.py index 5829a4e..f6038fd 100755 --- a/src/minwii/widgets/playingscreen.py +++ b/src/minwii/widgets/playingscreen.py @@ -45,11 +45,11 @@ class PlayingScreenBase(pygame.sprite.LayeredDirty, EventHandlerMixin) : self.columns = {} self._initColumns() self._running = False - self.draw(pygame.display.get_surface()) + self.kinectRgb = kinect.RGBSprite(alpha=128) + self.add(self.kinectRgb, layer=CURSOR_LAYER) self._initCursor() + self.draw(pygame.display.get_surface()) - self.kinectRgb = kinect.RGB() - self.kinectRgbSur = pygame.Surface((640, 480)) def _initRects(self) : """ création des espaces réservés pour @@ -99,16 +99,9 @@ class PlayingScreenBase(pygame.sprite.LayeredDirty, EventHandlerMixin) : pygame.mouse.set_visible(False) while self._running : EventDispatcher.dispatchEvents() + self.kinectRgb.update() dirty = self.draw(pygame.display.get_surface()) pygame.display.update(dirty) - - self.kinectRgb.update() - rgbImg = self.kinectRgb.capture() - self.kinectRgbSur.blit(rgbImg, (0, 0)) - screen = pygame.display.get_surface() - screen.blit(pygame.transform.flip(self.kinectRgbSur, True, False), (0, 0)) - pygame.display.flip() - clock.tick(FRAMERATE) def stop(self) : -- 2.20.1 From 73cb300f687b50db29e9054fc3a5ed5784cf0069 Mon Sep 17 00:00:00 2001 From: pin Date: Mon, 4 Mar 2013 09:20:13 +0000 Subject: [PATCH 15/16] Pas la peine de faire un draw dans le constructeur. git-svn-id: https://svn.cri.ensmp.fr/svn/minwii/trunk@418 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/minwii/widgets/playingscreen.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/minwii/widgets/playingscreen.py b/src/minwii/widgets/playingscreen.py index f6038fd..cd0ba54 100755 --- a/src/minwii/widgets/playingscreen.py +++ b/src/minwii/widgets/playingscreen.py @@ -48,7 +48,6 @@ class PlayingScreenBase(pygame.sprite.LayeredDirty, EventHandlerMixin) : self.kinectRgb = kinect.RGBSprite(alpha=128) self.add(self.kinectRgb, layer=CURSOR_LAYER) self._initCursor() - self.draw(pygame.display.get_surface()) def _initRects(self) : -- 2.20.1 From 5fd262589f4c98f0f37c7b9806c12446fd1f8e92 Mon Sep 17 00:00:00 2001 From: pin Date: Mon, 4 Mar 2013 10:14:40 +0000 Subject: [PATCH 16/16] =?utf8?q?=C3=89tirement=20de=20la=20vid=C3=A9o=20de?= =?utf8?q?=20la=20kinect.?= 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@419 fe552daf-6dbe-4428-90eb-1537e0879342 --- src/kinect/pygamedisplay.py | 18 +++++++++++------- src/minwii/widgets/playingscreen.py | 3 ++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/kinect/pygamedisplay.py b/src/kinect/pygamedisplay.py index fbf0b77..7b646ad 100755 --- a/src/kinect/pygamedisplay.py +++ b/src/kinect/pygamedisplay.py @@ -40,21 +40,25 @@ class RGB : class RGBSprite(pygame.sprite.DirtySprite, RGB) : - def __init__(self, alpha=255) : + def __init__(self, alpha=255, size=SCREEN_SIZE) : pygame.sprite.DirtySprite.__init__(self) - self.dirty = 2 # toujours dirty ! RGB.__init__(self) - - self.image = pygame.Surface((640, 480)) - self._regular = pygame.Surface((640, 480)) + self.dirty = 2 # toujours dirty ! + self.size = size + self.image = pygame.Surface(size) + self.workSur = pygame.Surface(SCREEN_SIZE) self.image.set_alpha(alpha) self.rect = pygame.Rect((0, 0), (0, 0)) def update(self) : RGB.update(self) img = self.capture() - self._regular.blit(img, (0, 0)) - self.image.blit(pygame.transform.flip(self._regular, True, False), (0, 0)) + self.workSur.blit(img, (0, 0)) + self.workSur = pygame.transform.flip(self.workSur, True, False) # miroir + if self.size != SCREEN_SIZE : + pygame.transform.scale(self.workSur, self.size, self.image) # étirement, blit implicite + else : + self.image.blit(self.workSur, (0, 0)) def main() : diff --git a/src/minwii/widgets/playingscreen.py b/src/minwii/widgets/playingscreen.py index cd0ba54..66d05a3 100755 --- a/src/minwii/widgets/playingscreen.py +++ b/src/minwii/widgets/playingscreen.py @@ -20,6 +20,7 @@ from minwii.config import FIRST_HUE from minwii.config import MIDI_VELOCITY_RANGE from minwii.config import MIDI_PAN_RANGE from minwii.config import MIDI_VELOCITY_WRONG_NOTE_ATTN +from minwii.config import SCREEN_RESOLUTION from minwii.globals import BACKGROUND_LAYER from minwii.globals import CURSOR_LAYER from minwii.globals import PLAYING_MODES_DICT @@ -45,7 +46,7 @@ class PlayingScreenBase(pygame.sprite.LayeredDirty, EventHandlerMixin) : self.columns = {} self._initColumns() self._running = False - self.kinectRgb = kinect.RGBSprite(alpha=128) + self.kinectRgb = kinect.RGBSprite(alpha=128, size=SCREEN_RESOLUTION) self.add(self.kinectRgb, layer=CURSOR_LAYER) self._initCursor() -- 2.20.1