spellchecking dictionaries will be located in user's config directory. #208

This commit is contained in:
Manuel Cortez 2018-03-19 21:40:55 -06:00
parent da4658c220
commit 7478edd454

View File

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os
import logging import logging
import wx_ui import wx_ui
import widgetUtils import widgetUtils
@ -16,6 +17,12 @@ log = logging.getLogger("extra.SpellChecker.spellChecker")
class spellChecker(object): class spellChecker(object):
def __init__(self, text, dictionary): def __init__(self, text, dictionary):
super(spellChecker, self).__init__() super(spellChecker, self).__init__()
# Set Dictionary path if not set in a previous call to this method.
# Dictionary path will be located in user config, see https://github.com/manuelcortez/twblue/issues/208
dict_path = enchant.get_param("enchant.myspell.dictionary.path")
if dict_path == None:
enchant.set_param("enchant.myspell.dictionary.path", os.path.join(paths.config_path(), "dicts"))
log.debug("Dictionary path set to %s" % (os.path.join(paths.config_path(), "dicts"),))
log.debug("Creating the SpellChecker object. Dictionary: %s" % (dictionary,)) log.debug("Creating the SpellChecker object. Dictionary: %s" % (dictionary,))
self.active = True self.active = True
try: try: