mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-17 11:22:28 +12:00
Avoid crash on spellcheck by ensuring enchant dictionary exists
See issue #273.
This commit is contained in:
parent
62a8a136c0
commit
43c077552a
|
@ -427,14 +427,15 @@ class textEditView(QTextEdit):
|
|||
|
||||
def setDict(self, d):
|
||||
self.currentDict = d
|
||||
self._dict = enchant.Dict(d)
|
||||
if d and enchant.dict_exists(d):
|
||||
self._dict = enchant.Dict(d)
|
||||
if self.highlighter:
|
||||
self.highlighter.rehighlight()
|
||||
|
||||
def toggleSpellcheck(self, v):
|
||||
self.spellcheck = v
|
||||
if enchant and self.spellcheck and not self._dict:
|
||||
if self.currentDict:
|
||||
if self.currentDict and enchant.dict_exists(self.currentDict):
|
||||
self._dict = enchant.Dict(self.currentDict)
|
||||
elif enchant.get_default_language() and enchant.dict_exists(enchant.get_default_language()):
|
||||
self._dict = enchant.Dict(enchant.get_default_language())
|
||||
|
|
Loading…
Reference in a new issue