Finished the GUI option for spell check provider

This commit is contained in:
Veronica K. B. Olsen
2019-11-07 20:00:19 +01:00
parent 334903daa9
commit f2265abf32
4 changed files with 48 additions and 17 deletions
+7 -3
View File
@@ -64,10 +64,9 @@ class GuiDocEditor(QTextEdit):
self.qDocument = self.document()
self.qDocument.setDocumentMargin(self.mainConf.textMargin)
self.qDocument.contentsChange.connect(self._docChange)
self._setupSpellChecking()
# Syntax
self.hLight = GuiDocHighlighter(self.qDocument, self.theParent)
self.hLight.setDict(self.theDict)
# Context Menu
self.setContextMenuPolicy(Qt.CustomContextMenu)
@@ -138,7 +137,8 @@ class GuiDocEditor(QTextEdit):
created, and when the user changes the main editor preferences.
"""
# Reload dictionaries
# Reload spell check and dictionaries
self._setupSpellChecking()
self.setDictionaries()
# Set font
@@ -727,11 +727,15 @@ class GuiDocEditor(QTextEdit):
"""Create the spell checking object based on the spellTool
setting in config.
"""
if self.mainConf.spellTool == "enchant":
from nw.tools.spellenchant import NWSpellEnchant
self.theDict = NWSpellEnchant()
else:
self.theDict = NWSpellSimple()
self.hLight.setDict(self.theDict)
return
# END Class GuiDocEditor