Skip to content

Commit

Permalink
[pyqgis-console] a simple syntax checker for the editor
Browse files Browse the repository at this point in the history
- some fixes and code cleanup
  • Loading branch information
slarosa committed May 11, 2013
1 parent adb2653 commit a60e74a
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 74 deletions.
1 change: 1 addition & 0 deletions images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
<file>themes/default/console/iconSearchEditorConsole.png</file>
<file>themes/default/console/iconSearchNextEditorConsole.png</file>
<file>themes/default/console/iconSearchPrevEditorConsole.png</file>
<file>themes/default/console/iconSyntaxErrorConsole.png</file>
<file>themes/default/extents.png</file>
<file>themes/default/favourites.png</file>
<file>themes/default/geographic.png</file>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion python/console/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def __init__(self, parent=None):
saveFileBt = QCoreApplication.translate("PythonConsole", "Save")
self.saveFileButton = QAction(self)
self.saveFileButton.setCheckable(False)
self.saveFileButton.setEnabled(True)
self.saveFileButton.setEnabled(False)
self.saveFileButton.setIcon(QgsApplication.getThemeIcon("console/iconSaveConsole.png"))
self.saveFileButton.setMenuRole(QAction.PreferencesRole)
self.saveFileButton.setIconVisibleInMenu(True)
Expand Down Expand Up @@ -537,6 +537,11 @@ def _textFindChanged(self):
self.findPrevButton.setEnabled(False)

def onClickGoToLine(self, item, column):
if item.text(1) == 'syntaxError':
check = self.tabEditorWidget.currentWidget().newEditor.syntaxCheck()
if check:
self.tabEditorWidget.currentWidget().save()
return
linenr = int(item.text(1))
itemName = str(item.text(0))
charPos = itemName.find(' ')
Expand Down
Loading

0 comments on commit a60e74a

Please sign in to comment.