Move all handling of spell check instance to shared class

This commit is contained in:
Veronica Berglyd Olsen
2023-08-24 22:33:53 +02:00
parent b54f81355a
commit a72c824d8b
7 changed files with 23 additions and 45 deletions
+1 -20
View File
@@ -73,7 +73,6 @@ class GuiDocEditor(QTextEdit):
statusMessage = pyqtSignal(str)
docCountsChanged = pyqtSignal(str, int, int, int)
editedStatusChanged = pyqtSignal(bool)
spellDictionaryChanged = pyqtSignal(str, str)
loadDocumentTagRequest = pyqtSignal(str, Enum)
novelStructureChanged = pyqtSignal()
novelItemMetaChanged = pyqtSignal(str)
@@ -301,7 +300,7 @@ class GuiDocEditor(QTextEdit):
self._typPadAfter = CONFIG.fmtPadAfter
# Reload spell check and dictionaries
self.setDictionaries()
SHARED.updateSpellCheckLanguage()
# Set font
textFont = QFont()
@@ -691,24 +690,6 @@ class GuiDocEditor(QTextEdit):
# Spell Checking
##
def setDictionaries(self):
"""Set the spell checker dictionary language, and emit the
dictionary changed signal.
"""
if SHARED.project.data.spellLang is None:
theLang = CONFIG.spellLanguage
else:
theLang = SHARED.project.data.spellLang
SHARED.spelling.setLanguage(theLang)
_, theProvider = SHARED.spelling.describeDict()
self.spellDictionaryChanged.emit(str(theLang), str(theProvider))
if not self._bigDoc:
self.spellCheckDocument()
return True
def toggleSpellCheck(self, state: bool) -> None:
"""This is the main spell check setting function, and this one
should call all other setSpellCheck functions in other classes.