From 1d3a4efc89f1c250b6ac584ef7a070a1bcf06106 Mon Sep 17 00:00:00 2001 From: Josip Pisoj Date: Mon, 8 Oct 2012 15:53:09 +0000 Subject: [PATCH] support newer version of gtkspell3 svn: r20542 --- gramps/gui/spell.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/gramps/gui/spell.py b/gramps/gui/spell.py index 8b62e0bec..d1a0872ab 100644 --- a/gramps/gui/spell.py +++ b/gramps/gui/spell.py @@ -62,6 +62,12 @@ if repository.enumerate_versions("Gtkspell"): HAVE_GTKSPELL = True except: pass +elif repository.enumerate_versions("GtkSpell"): + try: + from gi.repository import GtkSpell as Gtkspell + HAVE_GTKSPELL = True + except: + pass if not HAVE_GTKSPELL: LOG.warn(_("Spelling checker is not installed")) @@ -108,7 +114,10 @@ class Spell(object): else: try: #transfer full GTK object, so assign to an attribute! - self.gtkspell_spell = Gtkspell.Spell.new() + if Gtkspell._namespace == "Gtkspell": + self.gtkspell_spell = Gtkspell.Spell.new() + elif Gtkspell._namespace == "GtkSpell": + self.gtkspell_spell = Gtkspell.Checker.new() success = self.gtkspell_spell.attach(self.textview) self._active_spellcheck = spellcheck_code except: @@ -120,9 +129,12 @@ class Spell(object): if spellcheck_code == 'on': return else: - self.gtkspell_spell = Gtkspell.Spell.get_from_text_view(self.textview) - self.gtkspell_spell.detach() - self._active_spellcheck = spellcheck_code + if Gtkspell._namespace == "Gtkspell": + self.gtkspell_spell = Gtkspell.Spell.get_from_text_view(self.textview) + elif Gtkspell._namespace == "GtkSpell": + self.gtkspell_spell = Gtkspell.Checker.get_from_text_view(self.textview) + self.gtkspell_spell.detach() + self._active_spellcheck = spellcheck_code # Public API