From b0c0c037273da6c63089dcd58cc2ea26fbafd51c Mon Sep 17 00:00:00 2001 From: Josip Date: Mon, 6 Jan 2014 20:19:25 +0100 Subject: [PATCH] 7339: Spell: Gramps crashes if myspell folder doesn't contain files for the currently used LANG With patch works like: * default to dictionary in system locale if exist (language Gramps use) * if no system-locale dictionary default to English dictionary if exist but allow selection of any other installed one * if both English and system-locale dictionary is not available, disable spellchecking --- gramps/gui/spell.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gramps/gui/spell.py b/gramps/gui/spell.py index 0963ffda0..b1d134a4c 100644 --- a/gramps/gui/spell.py +++ b/gramps/gui/spell.py @@ -116,6 +116,18 @@ class Spell(object): self.gtkspell_spell = Gtkspell.Spell.new() elif Gtkspell._namespace == "GtkSpell": self.gtkspell_spell = Gtkspell.Checker.new() + try: + #check for dictionary in system locale (LANG) + #if exist it will be default one + self.gtkspell_spell.set_language(None) + #TODO: use "get_language_list" for use when there + #is no English or systemlocale one + except: + #else check for English dictionary + #if exist it will be default one + #other installed one will also be available + self.gtkspell_spell.set_language("en") + #if that fails no spellchecker will be available success = self.gtkspell_spell.attach(self.textview) try: #show decoded language codes in the context menu