From 97f26ed1184d1039dbc697e2fd87d9905ccbadce Mon Sep 17 00:00:00 2001 From: Gary Burton Date: Wed, 8 Aug 2012 21:50:38 +0000 Subject: [PATCH] Just log a warning rather than show an error dialog if spell checker cannot be imported svn: r20197 --- src/gui/spell.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/gui/spell.py b/src/gui/spell.py index 82a81c1fa..ab93acce4 100644 --- a/src/gui/spell.py +++ b/src/gui/spell.py @@ -49,12 +49,19 @@ LOG = logging.getLogger(".Spell") # #------------------------------------------------------------------------- from gi.repository import Gtk +from gi import Repository -try: - from gi.repository import Gtkspell - HAVE_GTKSPELL = True -except ImportError: - HAVE_GTKSPELL = False +HAVE_GTKSPELL = False + +# Attempting to import gtkspell gives an error dialog if gtkspell is not +# available so test first and log just a warning to the console instead. +repository = Repository.get_default() +if repository.enumerate_versions("Gtkspell"): + try: + from gi.repository import Gtkspell + HAVE_GTKSPELL = True + except: + pass if not HAVE_GTKSPELL: LOG.warn(_("Spelling checker is not installed"))