Skip to content

Commit a60e74a

Browse files
committed
[pyqgis-console] a simple syntax checker for the editor
- some fixes and code cleanup
1 parent adb2653 commit a60e74a

File tree

4 files changed

+140
-74
lines changed

4 files changed

+140
-74
lines changed

images/images.qrc

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
<file>themes/default/console/iconSearchEditorConsole.png</file>
103103
<file>themes/default/console/iconSearchNextEditorConsole.png</file>
104104
<file>themes/default/console/iconSearchPrevEditorConsole.png</file>
105+
<file>themes/default/console/iconSyntaxErrorConsole.png</file>
105106
<file>themes/default/extents.png</file>
106107
<file>themes/default/favourites.png</file>
107108
<file>themes/default/geographic.png</file>
Loading

python/console/console.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def __init__(self, parent=None):
160160
saveFileBt = QCoreApplication.translate("PythonConsole", "Save")
161161
self.saveFileButton = QAction(self)
162162
self.saveFileButton.setCheckable(False)
163-
self.saveFileButton.setEnabled(True)
163+
self.saveFileButton.setEnabled(False)
164164
self.saveFileButton.setIcon(QgsApplication.getThemeIcon("console/iconSaveConsole.png"))
165165
self.saveFileButton.setMenuRole(QAction.PreferencesRole)
166166
self.saveFileButton.setIconVisibleInMenu(True)
@@ -537,6 +537,11 @@ def _textFindChanged(self):
537537
self.findPrevButton.setEnabled(False)
538538

539539
def onClickGoToLine(self, item, column):
540+
if item.text(1) == 'syntaxError':
541+
check = self.tabEditorWidget.currentWidget().newEditor.syntaxCheck()
542+
if check:
543+
self.tabEditorWidget.currentWidget().save()
544+
return
540545
linenr = int(item.text(1))
541546
itemName = str(item.text(0))
542547
charPos = itemName.find(' ')

0 commit comments

Comments
 (0)