diff --git a/python/console/console_editor.py b/python/console/console_editor.py index ea976bab5ada..92db4c56dab8 100644 --- a/python/console/console_editor.py +++ b/python/console/console_editor.py @@ -186,7 +186,6 @@ def settingsEditor(self): threshold = self.settings.value("pythonConsole/autoCompThresholdEditor", 2).toInt()[0] radioButtonSource = self.settings.value("pythonConsole/autoCompleteSourceEditor", 'fromAPI').toString() autoCompEnabled = self.settings.value("pythonConsole/autoCompleteEnabledEditor", True).toBool() - self.setAutoCompletionThreshold(threshold) if autoCompEnabled: if radioButtonSource == 'fromDoc': @@ -958,11 +957,11 @@ def closeAll(self): self._removeTab(i) self.newTabEditor(tabName='Untitled-0') self._removeTab(0) - + def saveAs(self): idx = self.idx self.parent.saveAsScriptFile(idx) - + def enableSaveIfModified(self, tab): tabWidget = self.widget(tab) if tabWidget: diff --git a/python/console/console_sci.py b/python/console/console_sci.py index f7c1cd0cbf02..b6beaa6e4c3a 100644 --- a/python/console/console_sci.py +++ b/python/console/console_sci.py @@ -118,7 +118,6 @@ def settingsShell(self): self.setAutoCompletionThreshold(threshold) radioButtonSource = self.settings.value("pythonConsole/autoCompleteSource", 'fromAPI').toString() autoCompEnabled = self.settings.value("pythonConsole/autoCompleteEnabled", True).toBool() - self.setAutoCompletionThreshold(threshold) if autoCompEnabled: if radioButtonSource == 'fromDoc': self.setAutoCompletionSource(self.AcsDocument) diff --git a/python/console/console_settings.py b/python/console/console_settings.py index f67c3cffcff2..d032bab3d649 100644 --- a/python/console/console_settings.py +++ b/python/console/console_settings.py @@ -35,7 +35,6 @@ def __init__(self, parent): self.restoreSettings() self.initialCheck() - self.autoCompletionOptions() self.addAPIpath.setIcon(QIcon(":/images/themes/default/symbologyAdd.png")) self.addAPIpath.setToolTip(QCoreApplication.translate("PythonConsole", "Add API path")) @@ -44,10 +43,6 @@ def __init__(self, parent): self.connect( self.preloadAPI, SIGNAL("stateChanged(int)"), self.initialCheck) - self.connect( self.autoCompleteEnabled, - SIGNAL("stateChanged(int)"), self.autoCompletionOptions) - self.connect( self.autoCompleteEnabledEditor, - SIGNAL("stateChanged(int)"), self.autoCompletionOptions) self.connect(self.addAPIpath, SIGNAL("clicked()"), self.loadAPIFile) self.connect(self.removeAPIpath, @@ -64,28 +59,6 @@ def enableDisable(self, value): self.addAPIpath.setEnabled(value) self.removeAPIpath.setEnabled(value) - def autoCompletionOptions(self): - if self.autoCompleteEnabled.isChecked(): - self.enableDisableAutoCompleteOptions(True) - else: - self.enableDisableAutoCompleteOptions(False) - if self.autoCompleteEnabledEditor.isChecked(): - self.enableDisableAutoCompleteOptions(True, editor='editor') - else: - self.enableDisableAutoCompleteOptions(False, editor='editor') - - def enableDisableAutoCompleteOptions(self, value, editor=None): - if editor: - self.autoCompFromAPIEditor.setEnabled(value) - self.autoCompFromDocAPIEditor.setEnabled(value) - self.autoCompFromDocEditor.setEnabled(value) - self.autoCompThresholdEditor.setEnabled(value) - else: - self.autoCompFromAPI.setEnabled(value) - self.autoCompFromDocAPI.setEnabled(value) - self.autoCompFromDoc.setEnabled(value) - self.autoCompThreshold.setEnabled(value) - def loadAPIFile(self): settings = QSettings() lastDirPath = settings.value("pythonConsole/lastDirAPIPath").toString() @@ -146,6 +119,9 @@ def saveSettings(self): settings.setValue("pythonConsole/autoCompThreshold", QVariant(self.autoCompThreshold.value())) settings.setValue("pythonConsole/autoCompThresholdEditor", QVariant(self.autoCompThresholdEditor.value())) + settings.setValue("pythonConsole/autoCompleteEnabledEditor", QVariant(self.groupBoxAutoCompletionEditor.isChecked())) + settings.setValue("pythonConsole/autoCompleteEnabled", QVariant(self.groupBoxAutoCompletion.isChecked())) + if self.autoCompFromAPIEditor.isChecked(): settings.setValue("pythonConsole/autoCompleteSourceEditor", QVariant('fromAPI')) elif self.autoCompFromDocEditor.isChecked(): @@ -160,8 +136,6 @@ def saveSettings(self): elif self.autoCompFromDocAPI.isChecked(): settings.setValue("pythonConsole/autoCompleteSource", QVariant('fromDocAPI')) - settings.setValue("pythonConsole/autoCompleteEnabledEditor", QVariant(self.autoCompleteEnabledEditor.isChecked())) - settings.setValue("pythonConsole/autoCompleteEnabled", QVariant(self.autoCompleteEnabled.isChecked())) settings.setValue("pythonConsole/enableObjectInsp", QVariant(self.enableObjectInspector.isChecked())) settings.setValue("pythonConsole/autoCloseBracket", QVariant(self.autoCloseBracket.isChecked())) settings.setValue("pythonConsole/autoCloseBracketEditor", QVariant(self.autoCloseBracketEditor.isChecked())) @@ -188,8 +162,6 @@ def restoreSettings(self): self.autoCompThreshold.setValue(settings.value("pythonConsole/autoCompThreshold", 2).toInt()[0]) self.autoCompThresholdEditor.setValue(settings.value("pythonConsole/autoCompThresholdEditor", 2).toInt()[0]) - self.autoCompleteEnabledEditor.setChecked(settings.value("pythonConsole/autoCompleteEnabledEditor", True).toBool()) - self.autoCompleteEnabled.setChecked(settings.value("pythonConsole/autoCompleteEnabled", True).toBool()) self.enableObjectInspector.setChecked(settings.value("pythonConsole/enableObjectInsp", False).toBool()) self.autoCloseBracketEditor.setChecked(settings.value("pythonConsole/autoCloseBracketEditor", True).toBool()) self.autoCloseBracket.setChecked(settings.value("pythonConsole/autoCloseBracket", True).toBool()) diff --git a/python/console/console_settings.ui b/python/console/console_settings.ui index 96fc225ecbc5..0093fea895fa 100644 --- a/python/console/console_settings.ui +++ b/python/console/console_settings.ui @@ -58,8 +58,8 @@ 0 0 - 543 - 674 + 554 + 642 @@ -137,59 +137,37 @@ Autocompletion + + true + true - + + true + + + true + + - - - - - Autocompletion enabled - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Threshold - - - - - - - 10 - - - 2 - - - - - - + + + Autocompletion threshold + + + + + + + 10 + + + 2 + + - + @@ -255,103 +233,6 @@ Console - - - - Autocompletion - - - false - - - - - - - - Autocompletion enabled - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Threshold - - - - - - - 10 - - - 2 - - - - - - - - - - - - - Get autocompletion from current document - - - from Document - - - - - - - Get autocompletion from installed APIs - - - from APIs files - - - true - - - - - - - Get autocompletion from current document and installed APIs - - - from Doc and APIs - - - - - - - - @@ -408,13 +289,88 @@ - + Automatic parentheses insertion + + + + Autocompletion + + + true + + + false + + + true + + + true + + + + + + Autocompletion threshold + + + + + + + 10 + + + 2 + + + + + + + + + Get autocompletion from current document and installed APIs + + + from Doc and APIs + + + + + + + Get autocompletion from installed APIs + + + from APIs files + + + false + + + + + + + Get autocompletion from current document + + + from Document + + + + + + + +