Ajout de commentaires.
[minwii.git] / src / gui / PGUConfiguration.py
index 631932c..d903c5a 100644 (file)
@@ -24,6 +24,7 @@ from cursor.WarpingCursor import *
 from controllers.Wiimote import Wiimote\r
 from logging.Log import Log\r
 from songs.Song import Song,loadSong\r
 from controllers.Wiimote import Wiimote\r
 from logging.Log import Log\r
 from songs.Song import Song,loadSong\r
+from songs.musicxmltosong import musicXml2Song\r
 from constants import *\r
 from MINWiiDialog import MINWiiDialog\r
 \r
 from constants import *\r
 from MINWiiDialog import MINWiiDialog\r
 \r
@@ -102,12 +103,17 @@ class PGUConfiguration(pguGui.Desktop):
         if dlg.value:\r
             if os.path.isfile(dlg.value):\r
                 self.file = dlg.value\r
         if dlg.value:\r
             if os.path.isfile(dlg.value):\r
                 self.file = dlg.value\r
-                self.song = loadSong(self.file)\r
-                key = os.path.basename(self.file)[:-5]\r
-                if key in reversedReadabilityDict :                     \r
-                    label = self.createLabel(reversedReadabilityDict[key])\r
-                else :\r
-                    label = self.createLabel(key)\r
+                if self.file.endswith('.smwi') :\r
+                    self.song = loadSong(self.file)\r
+                    key = os.path.basename(self.file)[:-5]\r
+                    if key in reversedReadabilityDict :                     \r
+                        label = self.createLabel(reversedReadabilityDict[key])\r
+                    else :\r
+                        label = self.createLabel(key)\r
+                elif self.file.endswith('.xml') :\r
+                    self.song = musicXml2Song(self.file, printNotes=False)\r
+                    filename = os.path.basename(self.file)\r
+                    label = self.createLabel(filename) \r
                 self.browseButton = pguGui.Button(label)\r
                 self.browseButton.connect(pguGui.CLICK, self.open_file_browser, None)\r
                 if not self.songSwitch.value :\r
                 self.browseButton = pguGui.Button(label)\r
                 self.browseButton.connect(pguGui.CLICK, self.open_file_browser, None)\r
                 if not self.songSwitch.value :\r
@@ -115,6 +121,7 @@ class PGUConfiguration(pguGui.Desktop):
                 self.mainTable.clear()\r
                 self.fillMainTable()\r
                 \r
                 self.mainTable.clear()\r
                 self.fillMainTable()\r
                 \r
+                \r
     def fillMainTable(self):\r
         \r
         self.mainTable.tr()\r
     def fillMainTable(self):\r
         \r
         self.mainTable.tr()\r
@@ -239,7 +246,7 @@ class PGUConfiguration(pguGui.Desktop):
                 self.easyMode = False\r
                 \r
             choice = InstrumentChoice(instruments, wiimotes, self.window, screen, clock, joys, portOffset,self.activeWiimotes, scaleFactor = songScaleFactor)\r
                 self.easyMode = False\r
                 \r
             choice = InstrumentChoice(instruments, wiimotes, self.window, screen, clock, joys, portOffset,self.activeWiimotes, scaleFactor = songScaleFactor)\r
-            play = SongPlayingScreen(choice, self.song,self.cascade, self.extendedScale,self.easyMode,self.alwaysDown)\r
+            play = SongPlayingScreen(choice, self)# self.song,self.cascade, self.extendedScale,self.easyMode,self.alwaysDown)\r
         \r
         else:\r
             \r
         \r
         else:\r
             \r
@@ -257,7 +264,7 @@ class PGUConfiguration(pguGui.Desktop):
                 self.cascade = True\r
                 \r
             choice = InstrumentChoice(instruments, wiimotes, self.window, screen, clock, joys, portOffset,self.activeWiimotes)\r
                 self.cascade = True\r
                 \r
             choice = InstrumentChoice(instruments, wiimotes, self.window, screen, clock, joys, portOffset,self.activeWiimotes)\r
-            play = PlayingScreen(choice, None,self.cascade, self.extendedScale)            \r
+            play = PlayingScreen(choice, self)#None,self.cascade, self.extendedScale)            \r
                 \r
         while play.backToInstrumentChoice == True :\r
             \r
                 \r
         while play.backToInstrumentChoice == True :\r
             \r
@@ -297,7 +304,7 @@ class PGUConfiguration(pguGui.Desktop):
 if __name__ == "__main__" :\r
     pygame.init()\r
     modeResolution = (1024,768)\r
 if __name__ == "__main__" :\r
     pygame.init()\r
     modeResolution = (1024,768)\r
-    window = pygame.display.set_mode(modeResolution,pygame.FULLSCREEN)\r
+    window = pygame.display.set_mode(modeResolution)#,pygame.FULLSCREEN)\r
     pgu = PGUConfiguration(window)\r
     pygame.quit()   \r
         \r
     pgu = PGUConfiguration(window)\r
     pygame.quit()   \r
         \r