Move the spell check class constants to the nwConst class

This commit is contained in:
Veronica K. B. Olsen
2020-10-27 20:21:39 +01:00
parent 6e029f56a4
commit 91e2092674
6 changed files with 32 additions and 29 deletions
+2 -2
View File
@@ -50,7 +50,7 @@ from PyQt5.QtWidgets import (
QFrame
)
from nw.core import NWDoc, NWSpellCheck, NWSpellSimple, countWords
from nw.core import NWDoc, NWSpellSimple, countWords
from nw.gui.dochighlight import GuiDocHighlighter
from nw.common import transferCase
from nw.constants import (
@@ -1614,7 +1614,7 @@ class GuiDocEditor(QTextEdit):
"""Create the spell checking object based on the spellTool
setting in config.
"""
if self.mainConf.spellTool == NWSpellCheck.SP_ENCHANT:
if self.mainConf.spellTool == nwConst.SP_ENCHANT:
from nw.core.spellcheck import NWSpellEnchant
self.theDict = NWSpellEnchant()
else:
+6 -5
View File
@@ -37,7 +37,8 @@ from PyQt5.QtWidgets import (
)
from nw.gui.custom import QSwitch, QConfigLayout, PagedDialog, QuotesDialog
from nw.core import NWSpellCheck, NWSpellSimple, NWSpellEnchant
from nw.core import NWSpellSimple, NWSpellEnchant
from nw.constants import nwConst
logger = logging.getLogger(__name__)
@@ -703,11 +704,11 @@ class GuiConfigEditEditingTab(QWidget):
## Spell Check Provider and Language
self.spellLangList = QComboBox(self)
self.spellToolList = QComboBox(self)
self.spellToolList.addItem("Internal (difflib)", NWSpellCheck.SP_INTERNAL)
self.spellToolList.addItem("Spell Enchant (pyenchant)", NWSpellCheck.SP_ENCHANT)
self.spellToolList.addItem("Internal (difflib)", nwConst.SP_INTERNAL)
self.spellToolList.addItem("Spell Enchant (pyenchant)", nwConst.SP_ENCHANT)
theModel = self.spellToolList.model()
idEnchant = self.spellToolList.findData(NWSpellCheck.SP_ENCHANT)
idEnchant = self.spellToolList.findData(nwConst.SP_ENCHANT)
theModel.item(idEnchant).setEnabled(self.mainConf.hasEnchant)
self.spellToolList.currentIndexChanged.connect(self._doUpdateSpellTool)
@@ -814,7 +815,7 @@ class GuiConfigEditEditingTab(QWidget):
preserve the language choice, if the language exists in the
updated list.
"""
if spellTool == NWSpellCheck.SP_ENCHANT:
if spellTool == nwConst.SP_ENCHANT:
theDict = NWSpellEnchant()
else:
theDict = NWSpellSimple()