Amélioration ld.
[minwii.git] / src / minwii / app.py
index ab10bdf..b9219ae 100755 (executable)
@@ -34,16 +34,15 @@ 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
         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()
+        self.synth = Synth(driver=audioDriver)
         self.screenResolution = SCREEN_RESOLUTION
         envLogger.info('résolution écran : %s', self.screenResolution)
         self.nwiimotes = 0
@@ -99,10 +98,11 @@ class MinWii(object):
         if self.fullscreen :
             displayFlags = displayFlags | pygame.FULLSCREEN
         pygame.display.set_mode(self.screenResolution, displayFlags)
-        pygame.display.set_caption('MINWii')
+        pygame.display.set_caption('MINDs')
         WT = self.WT
         
-        songFile, playMode, displayNotes, wiimoteIndex = '', 'NORMAL', True, 0
+        # valeurs par défaut des options
+        songFile, playMode, displayNotes, wiimoteIndex = '', 'NORMAL', False, 0
 
         while True :
             WT.resume()
@@ -110,7 +110,9 @@ class MinWii(object):
             self.screen = SCREEN_HOME
             exit, songFile, playMode, displayNotes, wiimoteIndex = \
                 self.selectSongAndOptions(songFile, playMode, displayNotes, wiimoteIndex)
-            if exit : break
+            if exit :
+                WT.quit()
+                break
             
             
             self.screen = SCREEN_INSTRUMENTS
@@ -218,3 +220,5 @@ class _WTFacade :
         pass
     def get_count(self) :
         return None
+    def quit(self) :
+        pass