Example #1
0
    def save(self):
        try:
            filePath = str(self.leFilePath.text())
            if self.fileValues is not None:
                from Core import Records

                Records.setTitle(translate("TextCorrector", "Text File"))
                newFileValues = {}
                newFileValues["path"] = filePath
                newFileValues["content"] = str(
                    self.pteFileContent.toPlainText())
                newPath = fu.writeTextFile(self.fileValues, newFileValues,
                                           str(self.charSet.currentText()))
                if newPath != self.fileValues["path"]:
                    self.changeFile(newPath)
                if hasattr(getMainWindow(), "FileManager") and getMainWindow(
                ).FileManager is not None:
                    getMainWindow().FileManager.makeRefresh()
                Records.saveAllRecords()
            else:
                Dialogs.showError(
                    translate("TextCorrector", "File Does Not Exist"),
                    str(
                        translate(
                            "TextDetails",
                            "\"%s\" does not exist.<br>Please select an exist file and try again."
                        )) % Organizer.getLink(str(filePath)))
        except:
            ReportBug.ReportBug()
Example #2
0
    def save(self):
        try:
            from Core import Records

            Records.setTitle(translate("TextDetails", "Text File"))
            newFileValues = {}
            newFileValues["path"] = str(self.infoValues["path"].text())
            newFileValues["content"] = str(self.infoValues["content"].toPlainText())
            newPath = fu.writeTextFile(self.fileValues, newFileValues, str(self.charSet.currentText()))
            if newPath != self.fileValues["path"]:
                self.changeFile(newPath)
            if hasattr(getMainWindow(),
                       "FileManager") and getMainWindow().FileManager is not None: getMainWindow().FileManager.makeRefresh()
            Records.saveAllRecords()
        except:
            ReportBug.ReportBug()
    def save(self):
        try:
            filePath = str(self.leFilePath.text())
            if self.fileValues is not None:
                from Core import Records

                Records.setTitle(translate("TextCorrector", "Text File"))
                newFileValues = {}
                newFileValues["path"] = filePath
                newFileValues["content"] = str(self.pteFileContent.toPlainText())
                newPath = fu.writeTextFile(self.fileValues, newFileValues, str(self.charSet.currentText()))
                if newPath != self.fileValues["path"]:
                    self.changeFile(newPath)
                if hasattr(getMainWindow(),
                           "FileManager") and getMainWindow().FileManager is not None: getMainWindow().FileManager.makeRefresh()
                Records.saveAllRecords()
            else:
                Dialogs.showError(translate("TextCorrector", "File Does Not Exist"),
                                  str(translate("TextDetails",
                                                "\"%s\" does not exist.<br>Please select an exist file and try again.")
                                  ) % Organizer.getLink(str(filePath)))
        except:
            ReportBug.ReportBug()