From 7478edd454d3bf0ddecb1cce44c68258a675e0a9 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Mon, 19 Mar 2018 21:40:55 -0600 Subject: [PATCH] spellchecking dictionaries will be located in user's config directory. #208 --- src/extra/SpellChecker/spellchecker.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/extra/SpellChecker/spellchecker.py b/src/extra/SpellChecker/spellchecker.py index a0afdcee..a40102b5 100644 --- a/src/extra/SpellChecker/spellchecker.py +++ b/src/extra/SpellChecker/spellchecker.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import os import logging import wx_ui import widgetUtils @@ -16,6 +17,12 @@ log = logging.getLogger("extra.SpellChecker.spellChecker") class spellChecker(object): def __init__(self, text, dictionary): 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,)) self.active = True try: