Update spell_check.py

This commit is contained in:
chrys87 2016-09-06 09:41:43 +02:00 committed by GitHub
parent 3a5c37ff6a
commit 375031d3f6

View File

@ -10,6 +10,7 @@ except:
class command():
def __init__(self):
self.language = ''
self.spellChecker = None
def run(self, environment):
if not environment['runtime']['settingsManager'].getSettingAsBool(environment, 'general', 'autoSpellCheck'):
@ -20,7 +21,7 @@ class command():
return environment
if environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage') != self.language:
try:
spellChecker = enchant.Dict(environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage'))
self.spellChecker = enchant.Dict(environment['runtime']['settingsManager'].getSetting(environment, 'general', 'spellCheckLanguage'))
except:
return environment
@ -34,7 +35,7 @@ class command():
x, y, currWord = word_utils.getCurrentWord(cursorPos['x'], 0, newContent)
if currWord != '':
if not spellChecker.check(currWord):
if not self.spellChecker.check(currWord):
environment['runtime']['outputManager'].presentText(environment, 'misspelled', interrupt=True)
return environment