From 0a5e09a69c4568ef86b9bd4d66e83b6660404c3b Mon Sep 17 00:00:00 2001 From: Salvatore Larosa Date: Sun, 12 May 2013 09:40:55 +0200 Subject: [PATCH] [pyqgis-console] minor fixes: followup a60e74a --- python/console/console.py | 7 ++++--- python/console/console_editor.py | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/python/console/console.py b/python/console/console.py index aa98e948ee2..b75f7d80225 100644 --- a/python/console/console.py +++ b/python/console/console.py @@ -537,9 +537,10 @@ class PythonConsoleWidget(QWidget): self.findPrevButton.setEnabled(False) def onClickGoToLine(self, item, column): + tabEditor = self.tabEditorWidget.currentWidget().newEditor if item.text(1) == 'syntaxError': - check = self.tabEditorWidget.currentWidget().newEditor.syntaxCheck() - if check: + check = self.tabEditorWidget.currentWidget().newEditor.syntaxCheck(fromContextMenu=False) + if check and not tabEditor.isReadOnly(): self.tabEditorWidget.currentWidget().save() return linenr = int(item.text(1)) @@ -549,7 +550,7 @@ class PythonConsoleWidget(QWidget): objName = itemName[0:charPos] else: objName = itemName - self.tabEditorWidget.currentWidget().newEditor.goToLine(objName, linenr) + tabEditor.goToLine(objName, linenr) def sextante(self): self.shell.commandConsole('sextante') diff --git a/python/console/console_editor.py b/python/console/console_editor.py index 79e1e5782bd..244b1d77ea1 100644 --- a/python/console/console_editor.py +++ b/python/console/console_editor.py @@ -733,7 +733,8 @@ class EditorTab(QWidget): if overwrite: os.remove(temp_path) fN = path.split('/')[-1] - self.tw.setTabTitle(self, fN) + if not self.newEditor.isReadOnly(): + self.tw.setTabTitle(self, fN) self.tw.setTabToolTip(self.tw.currentIndex(), path) self.newEditor.setModified(False) self.pc.saveFileButton.setEnabled(False) @@ -979,8 +980,8 @@ class EditorTabWidget(QTabWidget): return else: self.parent.updateTabListScript(self.widget(tab).path) - if self.count() <= 1: - self.removeTab(tab) + self.removeTab(tab) + if self.count() <= 1: self.newTabEditor() else: if self.widget(tab).path is not None or \