Beispiel #1
0
    def save(self, filename=None):
        if not filename:
            # Ask for a filename.
            filename = get_save_file(self,
                                     os.path.dirname(
                                         common.editor_config.last_font),
                                     filter="SDSE font files (*.sdse-font)")

            # And if that failed...
            if not filename:
                return False

        # Save shit.
        font_settings = FontSettings()

        font_settings.font_data = self.get_font_data()
        font_settings.gen_for_game = self.ui.chkGenForGame.isChecked()
        font_settings.gen_for_editor = self.ui.chkGenForEditor.isChecked()
        font_settings.left_to_right = self.ui.rdoLeftToRight.isChecked()
        if self.ui.rdoGenFont1.isChecked():
            font_settings.font_type = FONT1
        else:
            font_settings.font_type = FONT2

        with open(filename, "wb") as f:
            pickle.dump(font_settings, f, pickle.HIGHEST_PROTOCOL)

        self.filename = filename
        self.set_title()
        self.setWindowModified(False)

        self.update_config()
 def save(self, filename = None):
   if not filename:
     # Ask for a filename.
     filename = get_save_file(self, os.path.dirname(common.editor_config.last_font), filter = "SDSE font files (*.sdse-font)")
   
     # And if that failed...
     if not filename:
       return False
   
   # Save shit.
   font_settings = FontSettings()
   
   font_settings.font_data       = self.get_font_data()
   font_settings.gen_for_game    = self.ui.chkGenForGame.isChecked()
   font_settings.gen_for_editor  = self.ui.chkGenForEditor.isChecked()
   font_settings.left_to_right   = self.ui.rdoLeftToRight.isChecked()
   if self.ui.rdoGenFont1.isChecked():
     font_settings.font_type = FONT1
   else:
     font_settings.font_type = FONT2
   
   with open(filename, "wb") as f:
     pickle.dump(font_settings, f, pickle.HIGHEST_PROTOCOL)
   
   self.filename = filename
   self.set_title()
   self.setWindowModified(False)
   
   self.update_config()
 def dump_script(self):
   to_dump = self.get_checked([self.ui.treeFileList.topLevelItem(i) for i in range(self.ui.treeFileList.topLevelItemCount())])
   
   if not to_dump:
     QtGui.QMessageBox.warning(self, "No Selection", "No folders have beens selected to dump.")
     return
   
   out_file = get_save_file(self, self.last_file, "Text files (*.txt)")
   if out_file == "":
     return
   
   translated    = not self.ui.chkUntranslated.isChecked()
   strip_clt     = self.ui.chkStripClt.isChecked()
   only_voiced   = self.ui.chkOnlyVoiced.isChecked()
   line_numbers  = self.ui.chkLineNumbers.isChecked()
   
   progress = QProgressDialog("Dumping...", QtCore.QString(), 0, len(to_dump), self)
   progress.setWindowTitle("Dumping...")
   progress.setWindowModality(Qt.Qt.WindowModal)
   progress.setValue(0)
   progress.setAutoClose(False)
   progress.setMinimumDuration(0)
   
   # print out_file
   with open(out_file, "wb") as f:
     for dir in to_dump:
       progress.setLabelText("Dumping %s..." % dir)
       f.write(script_to_text(dir, translated, strip_clt, only_voiced, line_numbers).encode("UTF-8"))
       progress.setValue(progress.value() + 1)
   
   progress.close()
   
   self.last_file = out_file
Beispiel #4
0
    def dump_script(self):
        to_dump = self.get_checked([
            self.ui.treeFileList.topLevelItem(i)
            for i in range(self.ui.treeFileList.topLevelItemCount())
        ])

        if not to_dump:
            QtGui.QMessageBox.warning(
                self, "No Selection",
                "No folders have beens selected to dump.")
            return

        out_file = get_save_file(self, self.last_file, "Text files (*.txt)")
        if out_file == "":
            return

        translated = not self.ui.chkUntranslated.isChecked()
        strip_clt = self.ui.chkStripClt.isChecked()
        only_voiced = self.ui.chkOnlyVoiced.isChecked()
        line_numbers = self.ui.chkLineNumbers.isChecked()

        progress = QProgressDialog("Dumping...", QtCore.QString(), 0,
                                   len(to_dump), self)
        progress.setWindowTitle("Dumping...")
        progress.setWindowModality(Qt.Qt.WindowModal)
        progress.setValue(0)
        progress.setAutoClose(False)
        progress.setMinimumDuration(0)

        # print out_file
        with open(out_file, "wb") as f:
            for dir in to_dump:
                progress.setLabelText("Dumping %s..." % dir)
                f.write(
                    script_to_text(dir, translated, strip_clt, only_voiced,
                                   line_numbers).encode("UTF-8"))
                progress.setValue(progress.value() + 1)

        progress.close()

        self.last_file = out_file
 def create_terminology(self):
   dir = get_save_file(self, self.ui.txtTerminology.text(), filter = "Terminology.csv (*.csv)")
   if not dir == "":
     self.ui.txtTerminology.setText(dir)
 def create_terminology(self):
     dir = get_save_file(self, self.ui.txtTerminology.text(), filter="Terminology.csv (*.csv)")
     if not dir == "":
         self.ui.txtTerminology.setText(dir)