Beispiel #1
0
 def newProjectOf(self, ndsFile):
     d, tail = os.path.split(os.path.abspath(ndsFile))
     name = os.path.splitext(tail)[0]
     d += "/" + name + "/"
     if os.path.exists(d):
         prompt = QMessageBox.question(
             None, "Overwrite directory?",
             "%s already exists. Would you like this " % d.rstrip("/") +
             "to be overwritten with the project directory?\n" +
             "All contents will be deleted. This cannot be undone.",
             QMessageBox.Yes, QMessageBox.No)
         if prompt == QMessageBox.Yes:
             if os.path.isdir(d):
                 shutil.rmtree(d)
             else:
                 os.unlink(d)
         else:
             return
     os.makedirs(d)
     ndstool.dump(ndsFile, d)
     self.dirty = True
     prompt = QMessageBox.question(
         None, "Create backup?",
         "Would you like to create a backup of this ROM in your " +
         "project directory?", QMessageBox.Yes, QMessageBox.No)
     if prompt == QMessageBox.Yes:
         shutil.copyfile(ndsFile, d + "base.nds")
     self.projectinfo["location_base_value"].setText(d + "base.nds")
     self.projectinfo["location_directory_value"].setText(d)
     self.projectinfo["project_name_value"].setText(name.title())
     self.projectinfo["project_output_value"].setText(d + "edit.nds")
     config.project = {
         "directory": self.projectinfo["location_directory_value"].text()
     }
     config.project["versioninfo"] = pokeversion.get()
Beispiel #2
0
 def newProjectOf(self, ndsFile):
     d, tail = os.path.split(os.path.abspath(ndsFile))
     name = os.path.splitext(tail)[0]
     d += "/"+name+"/"
     if os.path.exists(d):
         prompt = QMessageBox.question(None, "Overwrite directory?", 
             "%s already exists. Would you like this "%d.rstrip("/")+
                 "to be overwritten with the project directory?\n"+
                 "All contents will be deleted. This cannot be undone.",
             QMessageBox.Yes, QMessageBox.No)
         if prompt == QMessageBox.Yes:
             if os.path.isdir(d):
                 shutil.rmtree(d)
             else:
                 os.unlink(d)
         else:
             return
     os.makedirs(d)
     ndstool.dump(ndsFile, d)
     self.dirty = True
     prompt = QMessageBox.question(None, "Create backup?", 
         "Would you like to create a backup of this ROM in your "+
             "project directory?",
         QMessageBox.Yes, QMessageBox.No)
     if prompt == QMessageBox.Yes:
         shutil.copyfile(ndsFile, d+"base.nds")
     self.projectinfo["location_base_value"].setText(d+"base.nds")
     self.projectinfo["location_directory_value"].setText(d)
     self.projectinfo["project_name_value"].setText(name.title())
     self.projectinfo["project_output_value"].setText(d+"edit.nds")
     config.project = {"directory": 
         self.projectinfo["location_directory_value"].text()}
     config.project["versioninfo"] = pokeversion.get()
Beispiel #3
0
 def openProjectOf(self, projFile):
     self.projFile = projFile
     config.load(open(projFile, "r"), config.qtSetter, self.projectinfo)
     config.project = {"directory": 
         str(self.projectinfo["location_directory_value"].text())}
     config.project["versioninfo"] = pokeversion.get()
     return
Beispiel #4
0
 def openProjectOf(self, projFile):
     self.projFile = projFile
     config.load(open(projFile, "r"), config.qtSetter, self.projectinfo)
     config.project = {"directory": 
         self.projectinfo["location_directory_value"].text()}
     config.project["versioninfo"] = pokeversion.get()
     return