Skip to content
Permalink
Browse files

[pyqgis-console] restore marker icon for syntax check

  • Loading branch information
slarosa authored and nyalldawson committed Oct 11, 2020
1 parent e4fa6cb commit cce7aa7315df395d8f1c0ee85f9cf58ece99fef1
Showing with 11 additions and 6 deletions.
  1. +1 −1 python/console/console.py
  2. +10 −5 python/console/console_editor.py
@@ -618,7 +618,7 @@ def _textFindChanged(self):
def onClickGoToLine(self, item, column):
tabEditor = self.tabEditorWidget.currentWidget().newEditor
if item.text(1) == 'syntaxError':
check = tabEditor.syntaxCheck(fromContextMenu=False)
check = tabEditor.syntaxCheck()
if check and not tabEditor.isReadOnly():
self.tabEditorWidget.currentWidget().save()
return
@@ -495,14 +495,16 @@ def goToLine(self, objName, linenr):
self.ensureLineVisible(linenr)
self.setFocus()

def syntaxCheck(self, filename=None, fromContextMenu=True):
def syntaxCheck(self):
eline = None
ecolumn = 0
edescr = ''
source = self.text()
try:
filename = self.parent.tw.currentWidget().path
if not filename:
filename = self.parent.tw.currentWidget().path
tmpFile = self.createTempFile()
filename = tmpFile
# source = open(filename, 'r').read() + '\n'
if isinstance(source, type("")):
source = source.encode('utf-8')
@@ -522,13 +524,15 @@ def syntaxCheck(self, filename=None, fromContextMenu=True):
self.bufferMarkerLine.remove(markerLine)
if (eline) not in self.bufferMarkerLine:
self.bufferMarkerLine.append(eline)

self.setMarginWidth(1, "0000")
self.markerAdd(eline, self.MARKER_NUM)
loadFont = self.settings.value("pythonConsole/fontfamilytext",
"Monospace")
font = self.lexerFont()
font.setItalic(True)
styleAnn = QsciStyle(-1, "Annotation",
QColor(255, 0, 0),
QColor(255, 200, 0),
QFont(loadFont, 8, -1, True),
font,
True)
self.annotate(eline, edescr, styleAnn)
self.setCursorPosition(eline, ecolumn - 1)
@@ -537,6 +541,7 @@ def syntaxCheck(self, filename=None, fromContextMenu=True):
# self.ensureCursorVisible()
return False
else:
self.setMarginWidth(1, 0)
self.markerDeleteAll()
self.clearAnnotations()
return True

0 comments on commit cce7aa7

Please sign in to comment.
You can’t perform that action at this time.