Пример #1
0
 def saveBoardFromDisk(self):
     self.board = boardToString(self.ui.boardEditor.getEditedBoard())
     filename = saveFileName(self, '*.gbb')
     if not filename == QtCore.QString(''):
         (filep, filen) = os.path.split(str(filename))
         if not filename[-4:] == '.gbb':
             filename = filename + '.gbb'
         myFile = open(filename, 'w')
         myFile.write(self.board)
         myFile.close()
     self.reset_combo_persist()
Пример #2
0
 def saveBoardFromDisk(self):
     self.board = boardToString(self.ui.boardEditor.getEditedBoard())
     filename = saveFileName(self, "*.gbb")
     if not filename == QtCore.QString(""):
         (filep, filen) = os.path.split(str(filename))
         if not filename[-4:] == ".gbb":
             filename = filename + ".gbb"
         myFile = open(filename, "w")
         myFile.write(self.board)
         myFile.close()
     self.reset_combo_persist()
Пример #3
0
    def saveAsFileDialog(self):
        indexFile = self.mainW.ui.tabWidgetEditors.currentIndex()
        filename = saveFileName(self.mainW, "*.gbs")
        if filename == "":
            return False
        if indexFile == 0:
            filename = assure_extension(filename, "gbs")
            (filep, filen) = os.path.split(str(filename))
            if filen == "Biblioteca.gbs" or filen == "Biblioteca":
                QMessageBox.question(
                    self.mainW,
                    i18n("Error saving the file"),
                    i18n("The file name dont be equals to library") + "\n" + i18n(""),
                    QMessageBox.Ok,
                )
                return False
            else:
                self.moduleFile = filename
                myFile = open(filename, "w")
                myFile.write(self.mainW.ui.textEditFile.toPlainText().toUtf8())
                self.setCurrentPathDirectory(os.path.dirname(filename))
                myFile.close()
                self.mainW.ui.textEditFile.document().setModified(False)
                self.setTabsNamesAndLabelButtonNameAndSetCurrentPathDirectory(filename)
                self.loadLibrary()

        if indexFile == 1:
            filename = assure_extension(filename, "gbs")
            (filep, filen) = os.path.split(str(filename))
            if not filen.startswith("Biblioteca"):
                QMessageBox.question(
                    self.mainW,
                    i18n("Error saving the file"),
                    i18n('The file must be named "Library"') + "\n" + i18n(""),
                    QMessageBox.Ok,
                )
                return False
            elif not os.path.exists("Biblioteca.gbs"):
                self.libraryFile = filename
                fileLibrary = open(filename, "w")
                fileLibrary.write(self.mainW.ui.textEditLibrary.toPlainText().toUtf8())
                self.setCurrentPathDirectory(os.path.dirname(filename))
                fileLibrary.close()
                self.mainW.ui.textEditLibrary.document().setModified(False)
                self.mainW.ui.tabWidgetEditors.setTabText(1, filen)
            else:
                self.saveLibrary()

        self.createInitialsFoldersAndFiles()
        self.updateClothingOptions()

        return True
Пример #4
0
    def saveAsFileDialog(self):
        indexFile = self.mainW.ui.tabWidgetEditors.currentIndex()
        filename = saveFileName(self.mainW, '*.gbs')
        if filename == "":
            return False
        if indexFile == 0:
            filename = assure_extension(filename, 'gbs')
            (filep, filen) = os.path.split(str(filename))
            if filen == "Biblioteca.gbs" or filen == "Biblioteca":
                QMessageBox.question(
                    self.mainW, i18n('Error saving the file'),
                    i18n('The file name dont be equals to library') + '\n' +
                    i18n(''), QMessageBox.Ok)
                return False
            else:
                self.moduleFile = filename
                myFile = open(filename, 'w')
                myFile.write(self.mainW.ui.textEditFile.toPlainText().toUtf8())
                self.setCurrentPathDirectory(os.path.dirname(filename))
                myFile.close()
                self.mainW.ui.textEditFile.document().setModified(False)
                self.setTabsNamesAndLabelButtonNameAndSetCurrentPathDirectory(
                    filename)
                self.loadLibrary()

        if indexFile == 1:
            filename = assure_extension(filename, 'gbs')
            (filep, filen) = os.path.split(str(filename))
            if not filen.startswith('Biblioteca'):
                QMessageBox.question(
                    self.mainW, i18n('Error saving the file'),
                    i18n('The file must be named "Library"') + '\n' + i18n(''),
                    QMessageBox.Ok)
                return False
            elif not os.path.exists('Biblioteca.gbs'):
                self.libraryFile = filename
                fileLibrary = open(filename, 'w')
                fileLibrary.write(
                    self.mainW.ui.textEditLibrary.toPlainText().toUtf8())
                self.setCurrentPathDirectory(os.path.dirname(filename))
                fileLibrary.close()
                self.mainW.ui.textEditLibrary.document().setModified(False)
                self.mainW.ui.tabWidgetEditors.setTabText(1, filen)
            else:
                self.saveLibrary()

        self.createInitialsFoldersAndFiles()
        self.updateClothingOptions()

        return True
Пример #5
0
    def saveBoardToImage(self):
        filename = saveFileName(self, '*.png')

        if not filename == QtCore.QString(''):
            self.ui.boardEditor.save_to_image(filename)
        self.reset_combo_persist()
Пример #6
0
    def saveBoardToImage(self):
        filename = saveFileName(self, "*.png")

        if not filename == QtCore.QString(""):
            self.ui.boardEditor.save_to_image(filename)
        self.reset_combo_persist()