--- a/eric7/EricWidgets/EricSpellCheckedTextEdit.py Sat Sep 25 18:14:22 2021 +0200 +++ b/eric7/EricWidgets/EricSpellCheckedTextEdit.py Sun Sep 26 16:27:23 2021 +0200 @@ -530,49 +530,127 @@ data.misspelled = misspellings self.setCurrentBlockUserData(data) - class EricSpellCheckedPlainTextEdit(QPlainTextEdit, SpellCheckMixin): +else: + + class SpellCheckMixin(): """ - Class implementing a QPlainTextEdit with built-in spell checker. + Class implementing the spell-check mixin for the widget classes. """ - def __init__(self, *args): - """ - Constructor - - @param *args list of arguments for the QPlainTextEdit constructor. - @type list - """ - QPlainTextEdit.__init__(self, *args) - SpellCheckMixin.__init__(self) - - class EricSpellCheckedTextEdit(QTextEdit, SpellCheckMixin): - """ - Class implementing a QTextEdit with built-in spell checker. - """ - def __init__(self, *args): + # + # This is just a stub to provide the same API as the enchant enabled + # one. + # + def __init__(self): """ Constructor + """ + pass + + def setFormat(self, formatName): + """ + Public method to set the document format. - @param *args list of arguments for the QPlainTextEdit constructor. - @type list + @param formatName name of the document format + @type str + """ + pass + + def dict(self): + """ + Public method to get a reference to the dictionary in use. + + @return reference to the current dictionary + @rtype enchant.Dict + """ + return None + + def setDict(self, spellDict): """ - QTextEdit.__init__(self, *args) - SpellCheckMixin.__init__(self) + Public method to set the dictionary to be used. + + @param spellDict reference to the spell-check dictionary + @type emchant.Dict + """ + pass + + @pyqtSlot(str) + def setLanguage(self, language): + """ + Public slot to set the spellchecker language. - self.setFormat("html") + @param language language to be set + @type str + """ + pass - def setAcceptRichText(self, accept): + @pyqtSlot(str, str, str) + def setLanguageWithPWL(self, language, pwl, pel): + """ + Public slot to set the spellchecker language and associated user + word lists. + + @param language language to be set + @type str + @param pwl file name of the personal word list + @type str + @param pel file name of the personal exclude list + @type str """ - Public method to set the text edit mode. + pass + + @classmethod + def setDefaultLanguage(cls, language, pwl=None, pel=None): + """ + Class method to set the default spell-check language. - @param accept flag indicating to accept rich text - @type bool + @param language language to be set as default + @type str + @param pwl file name of the personal word list + @type str + @param pel file name of the personal exclude list + @type str """ - QTextEdit.setAcceptRichText(self, accept) - self.setFormat("html" if accept else "text") -else: - # enchant not available - EricSpellCheckedPlainTextEdit = QPlainTextEdit - EricSpellCheckedTextEdit = QTextEdit + pass + +class EricSpellCheckedPlainTextEdit(QPlainTextEdit, SpellCheckMixin): + """ + Class implementing a QPlainTextEdit with built-in spell checker. + """ + def __init__(self, *args): + """ + Constructor + + @param *args list of arguments for the QPlainTextEdit constructor. + @type list + """ + QPlainTextEdit.__init__(self, *args) + SpellCheckMixin.__init__(self) + +class EricSpellCheckedTextEdit(QTextEdit, SpellCheckMixin): + """ + Class implementing a QTextEdit with built-in spell checker. + """ + def __init__(self, *args): + """ + Constructor + + @param *args list of arguments for the QPlainTextEdit constructor. + @type list + """ + QTextEdit.__init__(self, *args) + SpellCheckMixin.__init__(self) + + self.setFormat("html") + + def setAcceptRichText(self, accept): + """ + Public method to set the text edit mode. + + @param accept flag indicating to accept rich text + @type bool + """ + QTextEdit.setAcceptRichText(self, accept) + self.setFormat("html" if accept else "text") if __name__ == '__main__': import sys