Skip to content

Spellcheck

Dual-language spellcheck service (German + English) with QTextEdit integration.

Components

File Responsibility
spell_check_service.py SpellCheckService singleton -- word validation, suggestions, personal dictionary
spell_highlighter.py SpellHighlighter(QSyntaxHighlighter) -- wavy underline for misspelled words
spell_icon.py render_spell_check_icon() -- dual-color spellcheck indicator pixmap

SpellCheckService

Uses pyenchant with Hunspell backend. A word is accepted if either the German (de_DE) or English (en_US) dictionary recognizes it. Uppercase codes (DO, PEW, PAW) and single-character tokens are automatically skipped.

  • check(word) -- boolean validation
  • suggest(word) -- suggestion list
  • ignore(word) -- session-only override
  • add_to_dictionary(word) -- persisted to personal word list

Degrades gracefully if dictionaries are unavailable.

SpellHighlighter

Attaches to a QTextDocument and highlights misspelled words with a wavy orange underline. Uses O(1) hash-based Hunspell lookups, so no debouncing is needed.