Fix bug #801000 where Enchant falls over in one or two situations where there is no locale set or it encounters some other problem and generates a generic Error.

This commit is contained in:
Raoul Snyman 2011-06-23 07:26:20 +02:00
parent cb60e6e9ef
commit 114412e169

View File

@ -29,6 +29,7 @@ import re
try: try:
import enchant import enchant
from enchant import DictNotFoundError from enchant import DictNotFoundError
from enchant.errors import Error
ENCHANT_AVAILABLE = True ENCHANT_AVAILABLE = True
except ImportError: except ImportError:
ENCHANT_AVAILABLE = False ENCHANT_AVAILABLE = False
@ -56,7 +57,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit):
self.dictionary = enchant.Dict() self.dictionary = enchant.Dict()
self.highlighter = Highlighter(self.document()) self.highlighter = Highlighter(self.document())
self.highlighter.spellingDictionary = self.dictionary self.highlighter.spellingDictionary = self.dictionary
except DictNotFoundError: except Error, DictNotFoundError:
ENCHANT_AVAILABLE = False ENCHANT_AVAILABLE = False
log.debug(u'Could not load default dictionary') log.debug(u'Could not load default dictionary')