def addCustomDict(self, customDictPath): try: self._createCustomDictLang(self._folders[-1]) except IOError as err: logger.error("Can't create custom dictionary") key = (ENCHANT_CUSTOM_DICT_LANG, customDictPath) if key not in self._dictCache: broker = Broker() broker.set_param('enchant.myspell.dictionary.path', self._folders[-1]) try: currentDict = DictWithPWL(ENCHANT_CUSTOM_DICT_LANG, customDictPath, broker=broker) except enchant.errors.Error as err: logger.error('Custom dictionary error. path={}; lang={}'.format(customDictPath, key)) logger.error(err) return self._dictCache[key] = currentDict else: currentDict = self._dictCache[key] self._customCheckers.append(currentDict)
def addCustomDict(self, customDictPath): try: self._createCustomDictLang(self._folders[-1]) except IOError: pass key = (CUSTOM_DICT_LANG, customDictPath) if key not in self._dictCache: broker = Broker() broker.set_param('enchant.myspell.dictionary.path', self._folders[-1]) try: currentDict = DictWithPWL(CUSTOM_DICT_LANG, customDictPath, broker=broker) except enchant.errors.Error: return self._dictCache[key] = currentDict else: currentDict = self._dictCache[key] self._customCheckers.append(currentDict)
def addCustomDict (self, customDictPath): try: self._createCustomDictLang (self._folders[-1]) except IOError: pass key = (CUSTOM_DICT_LANG, customDictPath) if key not in self._dictCache: broker = Broker () broker.set_param ('enchant.myspell.dictionary.path', self._folders[-1]) try: currentDict = DictWithPWL (CUSTOM_DICT_LANG, customDictPath, broker=broker) except enchant.errors.Error: return self._dictCache[key] = currentDict else: currentDict = self._dictCache[key] self._customCheckers.append (currentDict)
def addCustomDict(self, customDictPath): try: self._createCustomDictLang(self._folders[-1]) except IOError as err: logger.error("Can't create custom dictionary") key = (CUSTOM_DICT_LANG, customDictPath) if key not in self._dictCache: broker = Broker() broker.set_param('enchant.myspell.dictionary.path', self._folders[-1]) try: currentDict = DictWithPWL(CUSTOM_DICT_LANG, customDictPath, broker=broker) except enchant.errors.Error as err: logger.error('Custom dictionary error. path={}; lang={}'.format(customDictPath, key)) logger.error(err) return self._dictCache[key] = currentDict else: currentDict = self._dictCache[key] self._customCheckers.append(currentDict)
def _getDict(self, lang, path): key = (lang, path) if key not in self._dictCache: broker = Broker() broker.set_param('enchant.myspell.dictionary.path', path) currentDict = Dict(lang, broker) self._dictCache[key] = currentDict else: currentDict = self._dictCache[key] return currentDict
def _getDict (self, lang, path): key = (lang, path) if key not in self._dictCache: broker = Broker () broker.set_param ('enchant.myspell.dictionary.path', path) currentDict = Dict (lang, broker) self._dictCache[key] = currentDict else: currentDict = self._dictCache[key] return currentDict