diff -r e9e7eca7efee -r bf71ee032bb4 src/eric7/Preferences/ConfigurationPages/EditorTypingPage.py --- a/src/eric7/Preferences/ConfigurationPages/EditorTypingPage.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Preferences/ConfigurationPages/EditorTypingPage.py Wed Jul 13 14:55:47 2022 +0200 @@ -19,6 +19,7 @@ """ Class implementing the Editor Typing configuration page. """ + def __init__(self): """ Constructor @@ -26,196 +27,224 @@ super().__init__() self.setupUi(self) self.setObjectName("EditorTypingPage") - + # set initial values self.pageIds = { - ' ': self.stackedWidget.indexOf(self.emptyPage), - 'Python': self.stackedWidget.indexOf(self.pythonPage), - 'Ruby': self.stackedWidget.indexOf(self.rubyPage), - 'YAML': self.stackedWidget.indexOf(self.yamlPage), + " ": self.stackedWidget.indexOf(self.emptyPage), + "Python": self.stackedWidget.indexOf(self.pythonPage), + "Ruby": self.stackedWidget.indexOf(self.rubyPage), + "YAML": self.stackedWidget.indexOf(self.yamlPage), } languages = sorted(self.pageIds.keys()) for language in languages: self.languageCombo.addItem(language, self.pageIds[language]) - + # Python self.pythonGroup.setChecked( - Preferences.getEditorTyping("Python/EnabledTypingAids")) + Preferences.getEditorTyping("Python/EnabledTypingAids") + ) self.pythonInsertClosingBraceCheckBox.setChecked( - Preferences.getEditorTyping("Python/InsertClosingBrace")) + Preferences.getEditorTyping("Python/InsertClosingBrace") + ) self.pythonSkipBraceCheckBox.setChecked( - Preferences.getEditorTyping("Python/SkipBrace")) + Preferences.getEditorTyping("Python/SkipBrace") + ) self.pythonIndentBraceCheckBox.setChecked( - Preferences.getEditorTyping("Python/IndentBrace")) + Preferences.getEditorTyping("Python/IndentBrace") + ) self.pythonInsertQuoteCheckBox.setChecked( - Preferences.getEditorTyping("Python/InsertQuote")) + Preferences.getEditorTyping("Python/InsertQuote") + ) self.pythonDedentElseCheckBox.setChecked( - Preferences.getEditorTyping("Python/DedentElse")) + Preferences.getEditorTyping("Python/DedentElse") + ) self.pythonDedentExceptCheckBox.setChecked( - Preferences.getEditorTyping("Python/DedentExcept")) + Preferences.getEditorTyping("Python/DedentExcept") + ) self.pythonInsertImportCheckBox.setChecked( - Preferences.getEditorTyping("Python/InsertImport")) + Preferences.getEditorTyping("Python/InsertImport") + ) self.pythonImportBraceTypeCheckBox.setChecked( - Preferences.getEditorTyping("Python/ImportBraceType")) + Preferences.getEditorTyping("Python/ImportBraceType") + ) self.pythonInsertSelfCheckBox.setChecked( - Preferences.getEditorTyping("Python/InsertSelf")) + Preferences.getEditorTyping("Python/InsertSelf") + ) self.pythonInsertBlankCheckBox.setChecked( - Preferences.getEditorTyping("Python/InsertBlank")) + Preferences.getEditorTyping("Python/InsertBlank") + ) self.pythonColonDetectionCheckBox.setChecked( - Preferences.getEditorTyping("Python/ColonDetection")) + Preferences.getEditorTyping("Python/ColonDetection") + ) self.pythonDedentDefCheckBox.setChecked( - Preferences.getEditorTyping("Python/DedentDef")) - + Preferences.getEditorTyping("Python/DedentDef") + ) + # Ruby - self.rubyGroup.setChecked( - Preferences.getEditorTyping("Ruby/EnabledTypingAids")) + self.rubyGroup.setChecked(Preferences.getEditorTyping("Ruby/EnabledTypingAids")) self.rubyInsertClosingBraceCheckBox.setChecked( - Preferences.getEditorTyping("Ruby/InsertClosingBrace")) + Preferences.getEditorTyping("Ruby/InsertClosingBrace") + ) self.rubySkipBraceCheckBox.setChecked( - Preferences.getEditorTyping("Ruby/SkipBrace")) + Preferences.getEditorTyping("Ruby/SkipBrace") + ) self.rubyIndentBraceCheckBox.setChecked( - Preferences.getEditorTyping("Ruby/IndentBrace")) + Preferences.getEditorTyping("Ruby/IndentBrace") + ) self.rubyInsertQuoteCheckBox.setChecked( - Preferences.getEditorTyping("Ruby/InsertQuote")) + Preferences.getEditorTyping("Ruby/InsertQuote") + ) self.rubyInsertBlankCheckBox.setChecked( - Preferences.getEditorTyping("Ruby/InsertBlank")) + Preferences.getEditorTyping("Ruby/InsertBlank") + ) self.rubyInsertHereDocCheckBox.setChecked( - Preferences.getEditorTyping("Ruby/InsertHereDoc")) + Preferences.getEditorTyping("Ruby/InsertHereDoc") + ) self.rubyInsertInlineDocCheckBox.setChecked( - Preferences.getEditorTyping("Ruby/InsertInlineDoc")) - + Preferences.getEditorTyping("Ruby/InsertInlineDoc") + ) + # YAML - self.yamlGroup.setChecked( - Preferences.getEditorTyping("Yaml/EnabledTypingAids")) + self.yamlGroup.setChecked(Preferences.getEditorTyping("Yaml/EnabledTypingAids")) self.yamlInsertClosingBraceCheckBox.setChecked( - Preferences.getEditorTyping("Yaml/InsertClosingBrace")) + Preferences.getEditorTyping("Yaml/InsertClosingBrace") + ) self.yamlSkipBraceCheckBox.setChecked( - Preferences.getEditorTyping("Yaml/SkipBrace")) + Preferences.getEditorTyping("Yaml/SkipBrace") + ) self.yamlInsertQuoteCheckBox.setChecked( - Preferences.getEditorTyping("Yaml/InsertQuote")) + Preferences.getEditorTyping("Yaml/InsertQuote") + ) self.yamlAutoIndentationCheckBox.setChecked( - Preferences.getEditorTyping("Yaml/AutoIndentation")) + Preferences.getEditorTyping("Yaml/AutoIndentation") + ) self.yamlColonDetectionCheckBox.setChecked( - Preferences.getEditorTyping("Yaml/ColonDetection")) + Preferences.getEditorTyping("Yaml/ColonDetection") + ) self.yamlInsertBlankDashCheckBox.setChecked( - Preferences.getEditorTyping("Yaml/InsertBlankDash")) + Preferences.getEditorTyping("Yaml/InsertBlankDash") + ) self.yamlInsertBlankColonCheckBox.setChecked( - Preferences.getEditorTyping("Yaml/InsertBlankColon")) + Preferences.getEditorTyping("Yaml/InsertBlankColon") + ) self.yamlInsertBlankQuestionCheckBox.setChecked( - Preferences.getEditorTyping("Yaml/InsertBlankQuestion")) + Preferences.getEditorTyping("Yaml/InsertBlankQuestion") + ) self.yamlInsertBlankCommaCheckBox.setChecked( - Preferences.getEditorTyping("Yaml/InsertBlankComma")) - + Preferences.getEditorTyping("Yaml/InsertBlankComma") + ) + self.on_languageCombo_activated(0) - + def save(self): """ Public slot to save the Editor Typing configuration. """ # Python Preferences.setEditorTyping( - "Python/EnabledTypingAids", - self.pythonGroup.isChecked()) + "Python/EnabledTypingAids", self.pythonGroup.isChecked() + ) Preferences.setEditorTyping( "Python/InsertClosingBrace", - self.pythonInsertClosingBraceCheckBox.isChecked()) + self.pythonInsertClosingBraceCheckBox.isChecked(), + ) Preferences.setEditorTyping( - "Python/SkipBrace", - self.pythonSkipBraceCheckBox.isChecked()) + "Python/SkipBrace", self.pythonSkipBraceCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Python/IndentBrace", - self.pythonIndentBraceCheckBox.isChecked()) + "Python/IndentBrace", self.pythonIndentBraceCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Python/InsertQuote", - self.pythonInsertQuoteCheckBox.isChecked()) + "Python/InsertQuote", self.pythonInsertQuoteCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Python/DedentElse", - self.pythonDedentElseCheckBox.isChecked()) + "Python/DedentElse", self.pythonDedentElseCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Python/DedentExcept", - self.pythonDedentExceptCheckBox.isChecked()) + "Python/DedentExcept", self.pythonDedentExceptCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Python/InsertImport", - self.pythonInsertImportCheckBox.isChecked()) + "Python/InsertImport", self.pythonInsertImportCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Python/ImportBraceType", - self.pythonImportBraceTypeCheckBox.isChecked()) + "Python/ImportBraceType", self.pythonImportBraceTypeCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Python/InsertSelf", - self.pythonInsertSelfCheckBox.isChecked()) + "Python/InsertSelf", self.pythonInsertSelfCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Python/InsertBlank", - self.pythonInsertBlankCheckBox.isChecked()) + "Python/InsertBlank", self.pythonInsertBlankCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Python/ColonDetection", - self.pythonColonDetectionCheckBox.isChecked()) + "Python/ColonDetection", self.pythonColonDetectionCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Python/DedentDef", - self.pythonDedentDefCheckBox.isChecked()) - + "Python/DedentDef", self.pythonDedentDefCheckBox.isChecked() + ) + # Ruby Preferences.setEditorTyping( - "Ruby/EnabledTypingAids", - self.rubyGroup.isChecked()) + "Ruby/EnabledTypingAids", self.rubyGroup.isChecked() + ) Preferences.setEditorTyping( - "Ruby/InsertClosingBrace", - self.rubyInsertClosingBraceCheckBox.isChecked()) + "Ruby/InsertClosingBrace", self.rubyInsertClosingBraceCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Ruby/SkipBrace", - self.rubySkipBraceCheckBox.isChecked()) + "Ruby/SkipBrace", self.rubySkipBraceCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Ruby/IndentBrace", - self.rubyIndentBraceCheckBox.isChecked()) + "Ruby/IndentBrace", self.rubyIndentBraceCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Ruby/InsertQuote", - self.rubyInsertQuoteCheckBox.isChecked()) + "Ruby/InsertQuote", self.rubyInsertQuoteCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Ruby/InsertBlank", - self.rubyInsertBlankCheckBox.isChecked()) + "Ruby/InsertBlank", self.rubyInsertBlankCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Ruby/InsertHereDoc", - self.rubyInsertHereDocCheckBox.isChecked()) + "Ruby/InsertHereDoc", self.rubyInsertHereDocCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Ruby/InsertInlineDoc", - self.rubyInsertInlineDocCheckBox.isChecked()) - + "Ruby/InsertInlineDoc", self.rubyInsertInlineDocCheckBox.isChecked() + ) + # YAML Preferences.setEditorTyping( - "Yaml/EnabledTypingAids", - self.yamlGroup.isChecked()) + "Yaml/EnabledTypingAids", self.yamlGroup.isChecked() + ) Preferences.setEditorTyping( - "Yaml/InsertClosingBrace", - self.yamlInsertClosingBraceCheckBox.isChecked()) + "Yaml/InsertClosingBrace", self.yamlInsertClosingBraceCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Yaml/SkipBrace", - self.yamlSkipBraceCheckBox.isChecked()) + "Yaml/SkipBrace", self.yamlSkipBraceCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Yaml/InsertQuote", - self.yamlInsertQuoteCheckBox.isChecked()) + "Yaml/InsertQuote", self.yamlInsertQuoteCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Yaml/AutoIndentation", - self.yamlAutoIndentationCheckBox.isChecked()) + "Yaml/AutoIndentation", self.yamlAutoIndentationCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Yaml/ColonDetection", - self.yamlColonDetectionCheckBox.isChecked()) + "Yaml/ColonDetection", self.yamlColonDetectionCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Yaml/InsertBlankDash", - self.yamlInsertBlankDashCheckBox.isChecked()) + "Yaml/InsertBlankDash", self.yamlInsertBlankDashCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Yaml/InsertBlankColon", - self.yamlInsertBlankColonCheckBox.isChecked()) + "Yaml/InsertBlankColon", self.yamlInsertBlankColonCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Yaml/InsertBlankQuestion", - self.yamlInsertBlankQuestionCheckBox.isChecked()) + "Yaml/InsertBlankQuestion", self.yamlInsertBlankQuestionCheckBox.isChecked() + ) Preferences.setEditorTyping( - "Yaml/InsertBlankComma", - self.yamlInsertBlankCommaCheckBox.isChecked()) - + "Yaml/InsertBlankComma", self.yamlInsertBlankCommaCheckBox.isChecked() + ) + @pyqtSlot(int) def on_languageCombo_activated(self, index): """ Private slot to select the page related to the selected language. - + @param index index of the selected entry @type int """ @@ -223,14 +252,14 @@ try: index = self.pageIds[language] except KeyError: - index = self.pageIds[' '] + index = self.pageIds[" "] self.stackedWidget.setCurrentIndex(index) def create(dlg): """ Module function to create the configuration page. - + @param dlg reference to the configuration dialog @return reference to the instantiated page (ConfigurationPageBase) """