diff -r e9e7eca7efee -r bf71ee032bb4 src/eric7/Preferences/ConfigurationPages/EditorSpellCheckingPage.py --- a/src/eric7/Preferences/ConfigurationPages/EditorSpellCheckingPage.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Preferences/ConfigurationPages/EditorSpellCheckingPage.py Wed Jul 13 14:55:47 2022 +0200 @@ -15,11 +15,11 @@ import Preferences -class EditorSpellCheckingPage(ConfigurationPageBase, - Ui_EditorSpellCheckingPage): +class EditorSpellCheckingPage(ConfigurationPageBase, Ui_EditorSpellCheckingPage): """ Class implementing the Editor Spellchecking configuration page. """ + def __init__(self): """ Constructor @@ -27,97 +27,107 @@ super().__init__() self.setupUi(self) self.setObjectName("EditorSpellCheckingPage") - + self.pwlPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) - self.pwlPicker.setFilters(self.tr( - "Dictionary File (*.dic);;All Files (*)")) - + self.pwlPicker.setFilters(self.tr("Dictionary File (*.dic);;All Files (*)")) + self.pelPicker.setMode(EricPathPickerModes.OPEN_FILE_MODE) - self.pelPicker.setFilters(self.tr( - "Dictionary File (*.dic);;All Files (*)")) - + self.pelPicker.setFilters(self.tr("Dictionary File (*.dic);;All Files (*)")) + from QScintilla.SpellChecker import SpellChecker + languages = sorted(SpellChecker.getAvailableLanguages()) self.defaultLanguageCombo.addItems(languages) if languages: self.errorLabel.hide() else: self.spellingFrame.setEnabled(False) - + # set initial values self.checkingEnabledCheckBox.setChecked( - Preferences.getEditor("SpellCheckingEnabled")) - + Preferences.getEditor("SpellCheckingEnabled") + ) + self.defaultLanguageCombo.setCurrentIndex( self.defaultLanguageCombo.findText( - Preferences.getEditor("SpellCheckingDefaultLanguage"))) - + Preferences.getEditor("SpellCheckingDefaultLanguage") + ) + ) + self.stringsOnlyCheckBox.setChecked( - Preferences.getEditor("SpellCheckStringsOnly")) + Preferences.getEditor("SpellCheckStringsOnly") + ) self.fullCheckUnknownCheckBox.setChecked( - Preferences.getEditor("FullSpellCheckUnknown")) + Preferences.getEditor("FullSpellCheckUnknown") + ) self.minimumWordSizeSlider.setValue( - Preferences.getEditor("SpellCheckingMinWordSize")) + Preferences.getEditor("SpellCheckingMinWordSize") + ) self.spellCheckTextFilesLineEdit.setText( - " ".join(Preferences.getEditor("FullSpellCheckExtensions"))) - + " ".join(Preferences.getEditor("FullSpellCheckExtensions")) + ) + self.initColour( - "SpellingMarkers", self.spellingMarkerButton, - Preferences.getEditorColour, hasAlpha=True) - - self.pwlPicker.setText( - Preferences.getEditor("SpellCheckingPersonalWordList")) + "SpellingMarkers", + self.spellingMarkerButton, + Preferences.getEditorColour, + hasAlpha=True, + ) + + self.pwlPicker.setText(Preferences.getEditor("SpellCheckingPersonalWordList")) self.pelPicker.setText( - Preferences.getEditor("SpellCheckingPersonalExcludeList")) - + Preferences.getEditor("SpellCheckingPersonalExcludeList") + ) + if self.spellingFrame.isEnabled(): self.enabledCheckBox.setChecked( - Preferences.getEditor("AutoSpellCheckingEnabled")) + Preferences.getEditor("AutoSpellCheckingEnabled") + ) else: self.enabledCheckBox.setChecked(False) # not available - self.chunkSizeSpinBox.setValue( - Preferences.getEditor("AutoSpellCheckChunkSize")) - + self.chunkSizeSpinBox.setValue(Preferences.getEditor("AutoSpellCheckChunkSize")) + def save(self): """ Public slot to save the Editor Search configuration. """ Preferences.setEditor( - "SpellCheckingEnabled", self.checkingEnabledCheckBox.isChecked()) - + "SpellCheckingEnabled", self.checkingEnabledCheckBox.isChecked() + ) + Preferences.setEditor( - "SpellCheckingDefaultLanguage", - self.defaultLanguageCombo.currentText()) - + "SpellCheckingDefaultLanguage", self.defaultLanguageCombo.currentText() + ) + Preferences.setEditor( - "SpellCheckStringsOnly", self.stringsOnlyCheckBox.isChecked()) + "SpellCheckStringsOnly", self.stringsOnlyCheckBox.isChecked() + ) Preferences.setEditor( - "FullSpellCheckUnknown", - self.fullCheckUnknownCheckBox.isChecked()) + "FullSpellCheckUnknown", self.fullCheckUnknownCheckBox.isChecked() + ) Preferences.setEditor( - "SpellCheckingMinWordSize", self.minimumWordSizeSlider.value()) + "SpellCheckingMinWordSize", self.minimumWordSizeSlider.value() + ) Preferences.setEditor( "FullSpellCheckExtensions", - [ext.strip() for ext in - self.spellCheckTextFilesLineEdit.text().split()]) - + [ext.strip() for ext in self.spellCheckTextFilesLineEdit.text().split()], + ) + self.saveColours(Preferences.setEditorColour) - + + Preferences.setEditor("SpellCheckingPersonalWordList", self.pwlPicker.text()) + Preferences.setEditor("SpellCheckingPersonalExcludeList", self.pelPicker.text()) + Preferences.setEditor( - "SpellCheckingPersonalWordList", self.pwlPicker.text()) - Preferences.setEditor( - "SpellCheckingPersonalExcludeList", self.pelPicker.text()) - - Preferences.setEditor( - "AutoSpellCheckingEnabled", self.enabledCheckBox.isChecked()) - Preferences.setEditor( - "AutoSpellCheckChunkSize", self.chunkSizeSpinBox.value()) + "AutoSpellCheckingEnabled", self.enabledCheckBox.isChecked() + ) + Preferences.setEditor("AutoSpellCheckChunkSize", self.chunkSizeSpinBox.value()) def create(dlg): """ Module function to create the configuration page. - + @param dlg reference to the configuration dialog @return reference to the instantiated page (ConfigurationPageBase) """