X-Git-Url: https://scm.cri.ensmp.fr/git/minwii.git/blobdiff_plain/928c4fcf26174df9b8cf62d67e0061ad703481e9..0fd6f300332426a83063d3c253764bde52d70974:/src/gui/PGUConfiguration.py

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