예제 #1
0
 def Core_Install_Response(self, FileChooser, Response):
     CoreSettingsTree = {
         ("", 1, ("name", "system"), SettingsCheck.CoreNameSanityCheck):
         None
     }
     if Response == Gtk.ResponseType.ACCEPT:
         filename = FileChooser.get_filename()
         SystemArchive = Archive(filename, 'r')
         try:
             settingsstring = SystemArchive.read("core.xml")
             CoreXML = ET.XML(settingsstring)
             ValidSettings = SettingsCheck.check_settings(
                 CoreSettingsTree, CoreXML)
             if not ValidSettings:
                 raise Exception("Invalid Core Settings")
             systemname = CoreXML.get("system")
             corename = CoreXML.get("name")
             if os.path.isdir(Globals.DataDir + "Systems/System_" +
                              systemname):
                 if not os.path.isdir(Globals.DataDir + "Systems/System_" +
                                      systemname + "/" + corename):
                     os.mkdir(Globals.DataDir + "Systems/System_" +
                              systemname + "/Core_" + corename)
                     SystemArchive.extractall(
                         path=Globals.DataDir + "Systems/System_" +
                         systemname + "/Core_" + corename)
                     Globals.Cores.append(systemname + "/" + corename)
                     popup = ErrorPopupWindow(
                         "Core Installed", "Core installed successfully!")
                     popup.set_transient_for(self)
                     popup.show_all()
                 else:
                     popup = ErrorPopupWindow(
                         "Core already exists",
                         "Core already exists, uninstall the core first.")
                     popup.set_transient_for(self)
                     popup.show_all()
             else:
                 popup = ErrorPopupWindow(
                     "System not found", "System: " + systemname +
                     " not found, please install the system before the core"
                 )
                 popup.set_transient_for(self)
                 popup.show_all()
         except Exception as e:
             print e
             popup = ErrorPopupWindow(
                 "Malformed Core",
                 "Archive containing the core is malformed, try redownloading the archive"
             )
             popup.set_transient_for(self)
             popup.show_all()
     FileChooser.destroy()
     Globals.OpenWindows &= ~Globals.WINDOWTYPE_FILECHOOSER
예제 #2
0
 def System_Install_Response(self, FileChooser, Response):
     SystemSettingsTree = {
         ("", 1, ("name", ), SettingsCheck.SystemNameSanityCheck): None
     }
     if Response == Gtk.ResponseType.ACCEPT:
         filename = FileChooser.get_filename()
         SystemArchive = Archive(filename, 'r')
         try:
             settingsstring = SystemArchive.read("system.xml")
             SystemXML = ET.XML(settingsstring)
             ValidSettings = SettingsCheck.check_settings(
                 SystemSettingsTree, SystemXML)
             if not ValidSettings:
                 raise Exception
             systemname = SystemXML.get("name")
             if not os.path.isdir(Globals.DataDir + "Systems/System_" +
                                  systemname):
                 os.mkdir(Globals.DataDir + "Systems/System_" + systemname)
                 if not os.path.isdir(Globals.DataDir + "Games/" +
                                      systemname):
                     os.mkdir(Globals.DataDir + "Games/" + systemname)
                 SystemArchive.extractall(path=Globals.DataDir +
                                          "Systems/System_" + systemname)
                 Globals.Systems.append(systemname)
                 popup = ErrorPopupWindow("System Installed",
                                          "System installed successfully!")
                 popup.set_transient_for(self)
                 popup.show_all()
             else:
                 popup = ErrorPopupWindow(
                     "System already exists",
                     "System already exists, uninstall the system first.")
                 popup.set_transient_for(self)
                 popup.show_all()
         except:
             popup = ErrorPopupWindow(
                 "Malformed System",
                 "Archive containing the system is malformed, try redownloading the archive"
             )
             popup.set_transient_for(self)
             popup.show_all()
     FileChooser.destroy()
     Globals.OpenWindows &= ~Globals.WINDOWTYPE_FILECHOOSER