Exemplo n.º 1
0
 def loadBoard(self):
     filename = openFileName(self.parent, '*.gbb')
     if not filename == "":
         fname = open(filename)
         data = fname.read()
         self.parent.setInitialBoard(data)
         fname.close()
Exemplo n.º 2
0
    def openFiles(self):

        if self.mainW.ui.textEditFile.document().isModified() or self.mainW.ui.textEditLibrary.document().isModified():
            val = QMessageBox.question(
                self.mainW,
                i18n("Warning!"),
                i18n("There are unsaved files, to load a new module changes will be lost, continue?"),
                QMessageBox.Yes,
                QMessageBox.Cancel,
            )
            if val == QMessageBox.Cancel:
                return False

        filename = openFileName(self.mainW, "*.gbs")

        if not filename == "":
            if not self.wantOpenLibrary(filename):
                self.moduleFile = filename
                fname = open(filename)
                data = fname.read()
                string = QtCore.QString()
                data = string.fromUtf8(data)
                self.mainW.ui.textEditFile.setPlainText(data)
                self.setTabsNamesAndLabelButtonNameAndSetCurrentPathDirectory(filename)
                self.loadLibrary()
                fname.close()
            else:
                QMessageBox.question(
                    self.mainW,
                    i18n("Error loading the file"),
                    i18n("Must load a file different to library")
                    + "\n"
                    + i18n("If you want edit the library, use the corresponding tab"),
                    QMessageBox.Ok,
                )
                return False
        self.createInitialsFoldersAndFiles()
        self.updateClothingOptions()
        return True
Exemplo n.º 3
0
    def openFiles(self):

        if self.mainW.ui.textEditFile.document().isModified(
        ) or self.mainW.ui.textEditLibrary.document().isModified():
            val = QMessageBox.question(
                self.mainW, i18n('Warning!'),
                i18n(
                    'There are unsaved files, to load a new module changes will be lost, continue?'
                ), QMessageBox.Yes, QMessageBox.Cancel)
            if val == QMessageBox.Cancel:
                return False

        filename = openFileName(self.mainW, '*.gbs')

        if not filename == "":
            if not self.wantOpenLibrary(filename):
                self.moduleFile = filename
                fname = open(filename)
                data = fname.read()
                string = QtCore.QString()
                data = string.fromUtf8(data)
                self.mainW.ui.textEditFile.setPlainText(data)
                self.setTabsNamesAndLabelButtonNameAndSetCurrentPathDirectory(
                    filename)
                self.loadLibrary()
                fname.close()
            else:
                QMessageBox.question(
                    self.mainW, i18n('Error loading the file'),
                    i18n('Must load a file different to library') + '\n' +
                    i18n(
                        'If you want edit the library, use the corresponding tab'
                    ), QMessageBox.Ok)
                return False
        self.createInitialsFoldersAndFiles()
        self.updateClothingOptions()
        return True