Skip to content

Commit

Permalink
[pyqgis-console] small fix for autocompletion bracket, also sets to F…
Browse files Browse the repository at this point in the history
…alse the default setting
  • Loading branch information
slarosa committed Aug 27, 2013
1 parent 580b947 commit c2310fd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions python/console/console_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ def syntaxCheck(self, filename=None, fromContextMenu=True):
return True

def keyPressEvent(self, e):
if self.settings.value("pythonConsole/autoCloseBracketEditor", True, type=bool):
if self.settings.value("pythonConsole/autoCloseBracketEditor", False, type=bool):
startLine, _, endLine, endPos = self.getSelection()
t = unicode(e.text())
## Close bracket automatically
Expand All @@ -674,7 +674,7 @@ def keyPressEvent(self, e):
self.insert(self.closing[i])
## FIXES #8392 (automatically removes the redundant char
## when autoclosing brackets option is enabled)
if t in self.closing:
if t in [')', ']', '}']:
l, pos = self.getCursorPosition()
txt = self.text(l)
try:
Expand Down
4 changes: 2 additions & 2 deletions python/console/console_sci.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def keyPressEvent(self, e):
self.showNext()
## TODO: press event for auto-completion file directory
else:
if self.settings.value("pythonConsole/autoCloseBracket", True, type=bool):
if self.settings.value("pythonConsole/autoCloseBracket", False, type=bool):
t = unicode(e.text())
## Close bracket automatically
if t in self.opening:
Expand All @@ -425,7 +425,7 @@ def keyPressEvent(self, e):
self.insert(self.closing[i])
## FIXES #8392 (automatically removes the redundant char
## when autoclosing brackets option is enabled)
if t in self.closing:
if t in [')', ']', '}']:
l, pos = self.getCursorPosition()
txt = self.text(l)
try:
Expand Down
4 changes: 2 additions & 2 deletions python/console/console_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ def restoreSettings(self):
self.autoCompThresholdEditor.setValue(settings.value("pythonConsole/autoCompThresholdEditor", 2, type=int))

self.enableObjectInspector.setChecked(settings.value("pythonConsole/enableObjectInsp", False, type=bool))
self.autoCloseBracketEditor.setChecked(settings.value("pythonConsole/autoCloseBracketEditor", True, type=bool))
self.autoCloseBracket.setChecked(settings.value("pythonConsole/autoCloseBracket", True, type=bool))
self.autoCloseBracketEditor.setChecked(settings.value("pythonConsole/autoCloseBracketEditor", False, type=bool))
self.autoCloseBracket.setChecked(settings.value("pythonConsole/autoCloseBracket", False, type=bool))

if settings.value("pythonConsole/autoCompleteSource") == 'fromDoc':
self.autoCompFromDoc.setChecked(True)
Expand Down

0 comments on commit c2310fd

Please sign in to comment.