Skip to content

Commit

Permalink
[pyqgis-console] allows comments and quotes folding in editor lexer
Browse files Browse the repository at this point in the history
  • Loading branch information
slarosa committed Apr 29, 2013
1 parent 1959182 commit e755815
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 5 additions & 4 deletions python/console/console_editor.py
Expand Up @@ -82,9 +82,6 @@ def __init__(self, parent=None):
# Enable non-ascii chars for editor
self.setUtf8(True)

#self.insertInitText()
self.setLexers()

# Set the default font
font = QFont()
font.setFamily('Courier')
Expand All @@ -102,7 +99,7 @@ def __init__(self, parent=None):
self.setMarginsBackgroundColor(QColor("#f9f9f9"))
self.setCaretLineVisible(True)
self.setCaretLineBackgroundColor(QColor("#fcf3ed"))

# Clickable margin 1 for showing markers
# self.setMarginSensitivity(1, True)
# self.connect(self,
Expand Down Expand Up @@ -172,6 +169,7 @@ def __init__(self, parent=None):
self.uncommentScut.activated.connect(self.parent.pc.uncommentCode)

def settingsEditor(self):
# Set Python lexer
self.setLexers()
threshold = self.settings.value("pythonConsole/autoCompThresholdEditor", 2).toInt()[0]
radioButtonSource = self.settings.value("pythonConsole/autoCompleteSourceEditor", 'fromAPI').toString()
Expand Down Expand Up @@ -209,6 +207,9 @@ def setLexers(self):
from qgis.core import QgsApplication

self.lexer = QsciLexerPython()
self.lexer.setIndentationWarning(QsciLexerPython.Inconsistent)
self.lexer.setFoldComments(True)
self.lexer.setFoldQuotes(True)

loadFont = self.settings.value("pythonConsole/fontfamilytextEditor", "Monospace").toString()
fontSize = self.settings.value("pythonConsole/fontsizeEditor", 10).toInt()[0]
Expand Down
4 changes: 1 addition & 3 deletions python/console/console_sci.py
Expand Up @@ -73,9 +73,6 @@ def __init__(self, parent=None):
# Current line visible with special background color
self.setCaretWidth(2)

# Set Python lexer
self.setLexers()

self.settingsShell()

# Don't want to see the horizontal scrollbar at all
Expand Down Expand Up @@ -110,6 +107,7 @@ def __init__(self, parent=None):
self.completion_list_selected)

def settingsShell(self):
# Set Python lexer
self.setLexers()
threshold = self.settings.value("pythonConsole/autoCompThreshold", 2).toInt()[0]
self.setAutoCompletionThreshold(threshold)
Expand Down

0 comments on commit e755815

Please sign in to comment.