diff --git a/python/console/console.py b/python/console/console.py index 42fed503346e..1db5a182da44 100644 --- a/python/console/console.py +++ b/python/console/console.py @@ -641,7 +641,7 @@ def saveScriptFile(self): except (IOError, OSError), error: errTr = QCoreApplication.translate("PythonConsole", "Save Error") msgText = QCoreApplication.translate('PythonConsole', - 'The file {} could not be saved. Error: {}'.format(unicode(tabWidget.path), + 'The file {0} could not be saved. Error: {1}'.format(unicode(tabWidget.path), error.strerror)) self.callWidgetMessageBarEditor(msgText, 2, False) @@ -668,7 +668,7 @@ def saveAsScriptFile(self, index=-1): except (IOError, OSError), error: errTr = QCoreApplication.translate("PythonConsole", "Save Error") msgText = QCoreApplication.translate('PythonConsole', - 'The file {} could not be saved. Error: {}'.format(unicode(tabWidget.path), + 'The file {0} could not be saved. Error: {1}'.format(unicode(tabWidget.path), error.strerror)) self.callWidgetMessageBarEditor(msgText, 2, False) if fileNone: diff --git a/python/console/console_editor.py b/python/console/console_editor.py index 76b17184e071..b70640fdd32b 100644 --- a/python/console/console_editor.py +++ b/python/console/console_editor.py @@ -400,7 +400,7 @@ def findText(self, forward): styleError = 'QLineEdit {background-color: #d65253; \ color: #ffffff;}' msgText = QCoreApplication.translate('PythonConsole', - '"{}" was not found.'.format(text)) + '"{0}" was not found.'.format(text)) self.parent.pc.callWidgetMessageBarEditor(msgText, 0, True) else: styleError = '' @@ -522,17 +522,17 @@ def _runSubProcess(self, filename, tmp=False): else: raise e if tmp: - tmpFileTr = QCoreApplication.translate('PythonConsole', ' [Temporary file saved in {}]'.format(dir)) + tmpFileTr = QCoreApplication.translate('PythonConsole', ' [Temporary file saved in {0}]'.format(dir)) file = file + tmpFileTr if _traceback: - msgTraceTr = QCoreApplication.translate('PythonConsole', '## Script error: {}'.format(file)) + msgTraceTr = QCoreApplication.translate('PythonConsole', '## Script error: {0}'.format(file)) print "## %s" % datetime.datetime.now() print unicode(msgTraceTr) sys.stderr.write(_traceback) p.stderr.close() else: msgSuccessTr = QCoreApplication.translate('PythonConsole', - '## Script executed successfully: {}'.format(file)) + '## Script executed successfully: {0}'.format(file)) print "## %s" % datetime.datetime.now() print unicode(msgSuccessTr) sys.stdout.write(out) @@ -542,7 +542,7 @@ def _runSubProcess(self, filename, tmp=False): os.remove(filename) except IOError, error: IOErrorTr = QCoreApplication.translate('PythonConsole', - 'Cannot execute file {}. Error: {}\n'.format(unicode(filename), error.strerror)) + 'Cannot execute file {0}. Error: {1}\n'.format(unicode(filename), error.strerror)) print '## Error: ' + IOErrorTr except: s = traceback.format_exc() @@ -675,7 +675,7 @@ def focusInEvent(self, e): if pathfile: if not QFileInfo(pathfile).exists(): msgText = QCoreApplication.translate('PythonConsole', - 'The file "{}" has been deleted or is not accessible'.format(unicode(pathfile))) + 'The file "{0}" has been deleted or is not accessible'.format(unicode(pathfile))) self.parent.pc.callWidgetMessageBarEditor(msgText, 2, False) return if pathfile and self.lastModified != QFileInfo(pathfile).lastModified(): @@ -696,14 +696,14 @@ def focusInEvent(self, e): self.parent.tw.listObject(self.parent.tw.currentWidget()) self.lastModified = QFileInfo(pathfile).lastModified() msgText = QCoreApplication.translate('PythonConsole', - 'The file "{}" has been changed and reloaded'.format(unicode(pathfile))) + 'The file "{0}" has been changed and reloaded'.format(unicode(pathfile))) self.parent.pc.callWidgetMessageBarEditor(msgText, 1, False) QsciScintilla.focusInEvent(self, e) def fileReadOnly(self): tabWidget = self.parent.tw.currentWidget() msgText = QCoreApplication.translate('PythonConsole', - 'The file "{}" is read only, please save to different file first.'.format(unicode(tabWidget.path))) + 'The file "{0}" is read only, please save to different file first.'.format(unicode(tabWidget.path))) self.parent.pc.callWidgetMessageBarEditor(msgText, 1, False) class EditorTab(QWidget): @@ -997,14 +997,14 @@ def newTabEditor(self, tabName=None, filename=None): fn.close() except IOError, error: IOErrorTr = QCoreApplication.translate('PythonConsole', - 'The file {} could not be opened. Error: {}\n'.format(unicode(filename), error.strerror)) + 'The file {0} could not be opened. Error: {1}\n'.format(unicode(filename), error.strerror)) print '## Error: ' sys.stderr.write(IOErrorTr) return nr = self.count() if not tabName: - tabName = QCoreApplication.translate('PythonConsole', 'Untitled-{}'.format(nr)) + tabName = QCoreApplication.translate('PythonConsole', 'Untitled-{0}'.format(nr)) self.tab = EditorTab(self, self.parent, filename, readOnly) self.iconTab = QgsApplication.getThemeIcon('console/iconTabEditorConsole.png') self.addTab(self.tab, self.iconTab, tabName + ' (ro)' if readOnly else tabName) @@ -1039,7 +1039,7 @@ def _removeTab(self, tab, tab2index=False): txtSaveOnRemove = QCoreApplication.translate("PythonConsole", "Python Console: Save File") txtMsgSaveOnRemove = QCoreApplication.translate("PythonConsole", - "The file '{}' has been modified, save changes?".format(self.tabText(tab))) + "The file '{0}' has been modified, save changes?".format(self.tabText(tab))) res = QMessageBox.question( self, txtSaveOnRemove, txtMsgSaveOnRemove, QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel ) @@ -1083,7 +1083,7 @@ def restoreTabs(self): self.newTabEditor(tabName, pathFile) else: errOnRestore = QCoreApplication.translate("PythonConsole", - "Unable to restore the file: \n{}\n".format(unicode(pathFile))) + "Unable to restore the file: \n{0}\n".format(unicode(pathFile))) print '## Error: ' s = errOnRestore sys.stderr.write(s)