We should read back the language dictionary setting from the spell class before updating status bar
This commit is contained in:
@@ -29,6 +29,7 @@ class NWSpellCheck():
|
||||
def __init__(self):
|
||||
self.mainConf = nw.CONFIG
|
||||
self.projectDict = None
|
||||
self.spellLanguage = None
|
||||
return
|
||||
|
||||
def setLanguage(self, theLang, projectDict=None):
|
||||
@@ -45,11 +46,10 @@ class NWSpellCheck():
|
||||
newWord = newWord.strip()
|
||||
self.PROJW.append(newWord)
|
||||
try:
|
||||
with open(self.projectDict,mode="w+",encoding="utf-8") as outFile:
|
||||
for pWord in self.PROJW:
|
||||
outFile.write("%s\n" % pWord)
|
||||
with open(self.projectDict,mode="a+",encoding="utf-8") as outFile:
|
||||
outFile.write("%s\n" % newWord)
|
||||
except Exception as e:
|
||||
logger.error("Failed to write to project word list at %s" % str(self.projectDict))
|
||||
logger.error("Failed to add word to project word list %s" % str(self.projectDict))
|
||||
logger.error(str(e))
|
||||
return
|
||||
|
||||
|
||||
@@ -32,10 +32,12 @@ class NWSpellEnchant(NWSpellCheck):
|
||||
"""
|
||||
try:
|
||||
self.theDict = enchant.Dict(theLang)
|
||||
self.spellLanguage = theLang
|
||||
logger.debug("Enchant spell checking for language %s loaded" % theLang)
|
||||
except:
|
||||
logger.error("Failed to load enchant spell checking for language %s" % theLang)
|
||||
self.theDict = NWSpellEnchantDummy()
|
||||
self.spellLanguage = None
|
||||
|
||||
self._readProjectDictionary(projectDict)
|
||||
for pWord in self.PROJW:
|
||||
|
||||
@@ -41,9 +41,11 @@ class NWSpellSimple(NWSpellCheck):
|
||||
self.WORDS.append(theLine.strip().lower())
|
||||
logger.debug("Spell check word list for language %s loaded" % theLang)
|
||||
logger.debug("Word list contains %d words" % len(self.WORDS))
|
||||
self.spellLanguage = theLang
|
||||
except Exception as e:
|
||||
logger.error("Failed to load spell check word list for language %s" % theLang)
|
||||
logger.error(str(e))
|
||||
self.spellLanguage = None
|
||||
|
||||
self._readProjectDictionary(projectDict)
|
||||
for pWord in self.PROJW:
|
||||
@@ -104,7 +106,7 @@ class NWSpellSimple(NWSpellCheck):
|
||||
if theBits[1] != ".dict":
|
||||
continue
|
||||
|
||||
spName = "%s [nternal]" % self.expandLanguage(theBits[0])
|
||||
spName = "%s [Internal]" % self.expandLanguage(theBits[0])
|
||||
retList.append((theBits[0], spName))
|
||||
|
||||
return retList
|
||||
|
||||
Reference in New Issue
Block a user