From d2cf4f866838ea9a3910d452d3d9449f0956a604 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Fri, 5 Aug 2005 15:34:53 +0000 Subject: [PATCH] * src/Spell.py: Make more robust to failure. * src/Makefile.am: Ship new file. * NEWS: Update. svn: r5023 --- gramps2/ChangeLog | 5 +++++ gramps2/NEWS | 1 + gramps2/src/Makefile.am | 5 ++++- gramps2/src/Spell.py | 35 ++++++++++++++++++++++------------- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 6dcfc420a..d46a6fc59 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2005-08-05 Alex Roitman + * src/Spell.py: Make more robust to failure. + * src/Makefile.am: Ship new file. + * NEWS: Update. + 2005-08-05 Martin Hawlisch * src/plugins/Checkpoint.py (rcs): define variable comment before using it. diff --git a/gramps2/NEWS b/gramps2/NEWS index 7271ede8e..9bd4f6162 100644 --- a/gramps2/NEWS +++ b/gramps2/NEWS @@ -1,6 +1,7 @@ Version 2.0.6 -- the "Just like my dear Papa!" release * New Narrative Web Page added to create a more complete web site. * Progress meters in plugins. +* Spell checking in Notes (requires gnome-python-extras). * Numerous bug fixes. Version 2.0.5 -- the "It's certainly uncontaminated by cheese" release diff --git a/gramps2/src/Makefile.am b/gramps2/src/Makefile.am index 3dcee442f..189e111c0 100644 --- a/gramps2/src/Makefile.am +++ b/gramps2/src/Makefile.am @@ -1,10 +1,12 @@ # $Id$ + # This is the src level Makefile for Gramps SUBDIRS = docgen plugins dates data po # For intl. support, how do we compile? MOSTLYCLEANFILES = CLEANFILES = const.pyc const.pyo + # What are the PYTHON scripts for this package that need to be handled? # # We only want optimized byte-compiled (.pyo) versions, no .pyc @@ -119,7 +121,8 @@ gdir_PYTHON = \ RecentFiles.py\ ReportOptions.py\ ReadGrdb.py\ - WriteGrdb.py + WriteGrdb.py\ + Spell.py # Could use GNU make's ':=' syntax for nice wildcard use. # If not using GNU make, then list all files individually diff --git a/gramps2/src/Spell.py b/gramps2/src/Spell.py index 407ae1f1c..5a08c7bb5 100644 --- a/gramps2/src/Spell.py +++ b/gramps2/src/Spell.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2004 Donald N. Allingham +# Copyright (C) 2005 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,32 +18,41 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -""" +# $Id$ +""" Provide an interface to the gtkspell interface. This requires python-gnome-extras package. If the gtkspell package is not present, we default to no spell checking. """ +success = False try: + import gtk import gtkspell import locale - class Spell: + text_view = gtk.TextView() + spell = gtkspell.Spell(text_view) + lang = locale.getlocale()[0] + spell.set_language(lang) + success = True +except ImportError, msg: + print "Spell.py:", msg +except RuntimeError,msg: + print "Spell.py:", msg +except SystemError,msg: + print "Spell.py:", msg + +if success: + class Spell: def __init__(self,obj): self.spell = gtkspell.Spell(obj) - try: - lang = locale.getlocale()[0] - self.spell.set_language(lang) - except RuntimeError,msg: - print "Spellchecker:", msg - -except ImportError: - + lang = locale.getlocale()[0] + self.spell.set_language(lang) +else: class Spell: - def __init__(self,obj): pass -