diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 6e1547434..361dcf633 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,16 @@ 2005-08-04 Don Allingham + * src/Spell.py: Interface to gtkspell + * src/AddrEdit.py: add spell checker to notes + * src/AttrEdit.py: add spell checker to notes + * src/EditPerson.py: add spell checker to notes + * src/EditPlace.py: add spell checker to notes + * src/EditSource.py: add spell checker to notes + * src/EventEdit.py: add spell checker to notes + * src/ImageSelect.py: add spell checker to notes + * src/Marriage.py: add spell checker to notes + * src/NameEdit.py: add spell checker to notes + * src/NoteEdit.py: add spell checker to notes + * src/Sources.py: add spell checker to notes * src/ImageSelect.py: fixed thumbnail dnd selection * src/AttrEdit.py: don't used reserved word "list" * src/EditPerson.py: Pass correct attribute list to editor diff --git a/gramps2/src/AddrEdit.py b/gramps2/src/AddrEdit.py index 99c84d4c9..0622f3f79 100644 --- a/gramps2/src/AddrEdit.py +++ b/gramps2/src/AddrEdit.py @@ -51,6 +51,7 @@ import Date import RelLib import Sources import DateEdit +import Spell #------------------------------------------------------------------------- # @@ -94,6 +95,7 @@ class AddressEditor: self.postal = self.top.get_widget("postal") self.phone = self.top.get_widget("phone") self.note_field = self.top.get_widget("addr_note") + self.spell = Spell.Spell(self.note_field) self.priv = self.top.get_widget("priv") self.slist = self.top.get_widget("slist") self.sources_label = self.top.get_widget("sourcesAddr") diff --git a/gramps2/src/AttrEdit.py b/gramps2/src/AttrEdit.py index 2c6ec0b03..86c4a7d9a 100644 --- a/gramps2/src/AttrEdit.py +++ b/gramps2/src/AttrEdit.py @@ -53,6 +53,8 @@ import Utils import Sources import AutoComp import RelLib +import Spell + from QuestionDialog import WarningDialog #------------------------------------------------------------------------- @@ -94,6 +96,7 @@ class AttributeEditor: self.slist = self.top.get_widget("slist") self.value_field = self.top.get_widget("attr_value") self.note_field = self.top.get_widget("attr_note") + self.spell = Spell.Spell(self.note_field) self.attrib_menu = self.top.get_widget("attr_menu") self.type_field = self.attrib_menu.child self.source_field = self.top.get_widget("attr_source") diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index d48c249cf..7429fe3de 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -61,6 +61,7 @@ import Date import DateHandler import TransTable import NameDisplay +import Spell from QuestionDialog import WarningDialog, ErrorDialog, SaveDialog, QuestionDialog2 @@ -159,6 +160,7 @@ class EditPerson: self.notes_field = self.get_widget("personNotes") self.notes_field.set_editable(mod) + self.spell_notes = Spell.Spell(self.notes_field) self.flowed = self.get_widget("flowed") self.flowed.set_sensitive(mod) self.preform = self.get_widget("preform") diff --git a/gramps2/src/EditPlace.py b/gramps2/src/EditPlace.py index 5a77ba757..72881c10e 100644 --- a/gramps2/src/EditPlace.py +++ b/gramps2/src/EditPlace.py @@ -48,10 +48,10 @@ import Utils import Sources import ImageSelect import NameDisplay +import Spell from DdTargets import DdTargets - #------------------------------------------------------------------------- # # EditPlace @@ -116,6 +116,7 @@ class EditPlace: self.latitude.set_editable(mode) self.note = self.top_window.get_widget("place_note") self.note.set_editable(mode) + self.spell = Spell.Spell(self.note) self.web_list = self.top_window.get_widget("web_list") self.web_url = self.top_window.get_widget("web_url") diff --git a/gramps2/src/EditSource.py b/gramps2/src/EditSource.py index 0d4275290..c20fddd45 100644 --- a/gramps2/src/EditSource.py +++ b/gramps2/src/EditSource.py @@ -47,6 +47,7 @@ import ImageSelect import ListModel import RelLib import NameDisplay +import Spell #------------------------------------------------------------------------- # @@ -97,6 +98,7 @@ class EditSource: self.abbrev = self.top_window.get_widget("abbrev") self.note = self.top_window.get_widget("source_note") self.note.set_editable(mode) + self.spell = Spell.Spell(self.note) self.notes_buffer = self.note.get_buffer() self.gallery_label = self.top_window.get_widget("gallerySourceEditor") self.refs_label = self.top_window.get_widget("refsSourceEditor") diff --git a/gramps2/src/EventEdit.py b/gramps2/src/EventEdit.py index fb0471234..d147b11a7 100644 --- a/gramps2/src/EventEdit.py +++ b/gramps2/src/EventEdit.py @@ -52,6 +52,8 @@ import Date import DateHandler import ImageSelect import DateEdit +import Spell + from QuestionDialog import WarningDialog, ErrorDialog #------------------------------------------------------------------------- @@ -132,6 +134,7 @@ class EventEditor: self.descr_field.set_editable(not noedit) self.note_field = self.top.get_widget("eventNote") self.note_field.set_editable(not noedit) + self.spell = Spell.Spell(self.note_field) self.event_menu = self.top.get_widget("personal_events") self.priv = self.top.get_widget("priv") self.priv.set_sensitive(not noedit) diff --git a/gramps2/src/ImageSelect.py b/gramps2/src/ImageSelect.py index cb97ac669..2bd4eeb25 100644 --- a/gramps2/src/ImageSelect.py +++ b/gramps2/src/ImageSelect.py @@ -65,6 +65,7 @@ import DateEdit import DateHandler import Date import ImgManip +import Spell from QuestionDialog import ErrorDialog from DdTargets import DdTargets @@ -719,6 +720,7 @@ class LocalMediaProperties: mt = Utils.get_mime_description(mtype) self.change_dialog.get_widget("type").set_text(mt) self.notes = self.change_dialog.get_widget("notes") + self.spell = Spell.Spell(self.notes) if self.photo.get_note(): self.notes.get_buffer().set_text(self.photo.get_note()) Utils.bold_label(self.notes_label) @@ -739,7 +741,9 @@ class LocalMediaProperties: }) media_obj = self.db.get_object_from_handle(self.photo.get_reference_handle()) - global_note = self.change_dialog.get_widget('global_notes').get_buffer() + gnote = self.change_dialog.get_widget('global_notes') + spell = Spell.Spell(gnote) + global_note = gnote.get_buffer() global_note.insert_at_cursor(media_obj.get_note()) self.redraw_attr_list() @@ -927,15 +931,14 @@ class GlobalMediaProperties: self.notes = self.change_dialog.get_widget("notes") self.notes.set_editable(mode) - + self.spell = Spell.Spell(self.notes) + self.date_edit = self.change_dialog.get_widget("date_edit") self.date_edit.set_sensitive(mode) self.date_check = DateEdit.DateEdit( - self.date_object, - self.date_entry, - self.date_edit, - self.window) + self.date_object, self.date_entry, + self.date_edit, self.window) self.pixmap = self.change_dialog.get_widget("pixmap") self.attr_type = self.change_dialog.get_widget("attr_type") diff --git a/gramps2/src/Marriage.py b/gramps2/src/Marriage.py index 0f262e3b1..34e0a53b2 100644 --- a/gramps2/src/Marriage.py +++ b/gramps2/src/Marriage.py @@ -57,6 +57,7 @@ import GrampsKeys import NameDisplay import Date import DateEdit +import Spell from QuestionDialog import QuestionDialog, WarningDialog, SaveDialog from DdTargets import DdTargets @@ -175,6 +176,7 @@ class Marriage: self.type_field.set_sensitive(mode) self.notes_field = self.get_widget("marriageNotes") self.notes_field.set_editable(mode) + self.spell = Spell.Spell(self.notes_field) self.gid = self.get_widget("gid") self.gid.set_editable(mode) self.attr_list = self.get_widget("attr_list") diff --git a/gramps2/src/NameEdit.py b/gramps2/src/NameEdit.py index 0db19c700..b1ea0bf9c 100644 --- a/gramps2/src/NameEdit.py +++ b/gramps2/src/NameEdit.py @@ -49,6 +49,7 @@ import NameDisplay import Date import DateEdit import DateHandler +import Spell #------------------------------------------------------------------------- # @@ -103,6 +104,8 @@ class NameEditor: self.type_combo = self.top.get_widget("name_type") self.note_field = self.top.get_widget("alt_note") + self.spell = Spell.Spell(self.note_field) + self.slist = self.top.get_widget('slist') self.priv = self.top.get_widget("priv") self.sources_label = self.top.get_widget("sourcesName") diff --git a/gramps2/src/NoteEdit.py b/gramps2/src/NoteEdit.py index dae769398..995d36877 100644 --- a/gramps2/src/NoteEdit.py +++ b/gramps2/src/NoteEdit.py @@ -36,6 +36,7 @@ import gtk.glade from gettext import gettext as _ import const import Utils +import Spell #------------------------------------------------------------------------- # @@ -80,6 +81,7 @@ class NoteEditor: self.entry = self.glade.get_widget('note') self.entry.get_buffer().set_text(self.data.get_note()) self.entry.set_editable(not self.readonly) + self.spellcheck = Spell.Spell(self.entry) cancel_button = self.glade.get_widget('cancel') ok_button = self.glade.get_widget('ok') diff --git a/gramps2/src/Sources.py b/gramps2/src/Sources.py index c596ab62c..3a904128a 100644 --- a/gramps2/src/Sources.py +++ b/gramps2/src/Sources.py @@ -51,6 +51,7 @@ import Date import DateEdit import DateHandler import GrampsDBCallback +import Spell from DdTargets import DdTargets @@ -418,6 +419,12 @@ class SourceEditor: self.date_obj, self.date_entry_field, date_stat, self.sourceDisplay) + self.spage = self.get_widget("spage") + self.scom = self.get_widget("scomment") + self.spell1 = Spell.Spell(self.scom) + self.stext = self.get_widget("stext") + self.spell2 = Spell.Spell(self.stext) + self.draw(self.active_source,fresh=True) self.set_button() if self.parent: @@ -477,9 +484,9 @@ class SourceEditor: def set_button(self): if self.active_source: - self.ok.set_sensitive(1) + self.ok.set_sensitive(True) else: - self.ok.set_sensitive(0) + self.ok.set_sensitive(False) def get_widget(self,name): """returns the widget associated with the specified name""" @@ -487,14 +494,10 @@ class SourceEditor: def draw(self,sel=None,fresh=False): if self.source_ref and fresh: - spage = self.get_widget("spage") - spage.get_buffer().set_text(self.source_ref.get_page()) + self.spage.get_buffer().set_text(self.source_ref.get_page()) - text = self.get_widget("stext") - text.get_buffer().set_text(self.source_ref.get_text()) - - scom = self.get_widget("scomment") - scom.get_buffer().set_text(self.source_ref.get_note()) + self.stext.get_buffer().set_text(self.source_ref.get_text()) + self.scom.get_buffer().set_text(self.source_ref.get_note()) idval = self.source_ref.get_base_handle() src = self.db.get_source_from_handle(idval) self.active_source = src @@ -545,15 +548,15 @@ class SourceEditor: conf = self.get_widget("conf").get_active() - buf = self.get_widget("scomment").get_buffer() + buf = self.scom.get_buffer() comments = unicode(buf.get_text(buf.get_start_iter(), buf.get_end_iter(),False)) - buf = self.get_widget("stext").get_buffer() + buf = self.stext.get_buffer() text = unicode(buf.get_text(buf.get_start_iter(), buf.get_end_iter(),False)) - buf = self.get_widget('spage').get_buffer() + buf = self.spage.get_buffer() page = unicode(buf.get_text(buf.get_start_iter(), buf.get_end_iter(),False)) diff --git a/gramps2/src/Spell.py b/gramps2/src/Spell.py new file mode 100644 index 000000000..407ae1f1c --- /dev/null +++ b/gramps2/src/Spell.py @@ -0,0 +1,49 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2000-2004 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 +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +""" + +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. + +""" + +try: + import gtkspell + import locale + + 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: + + class Spell: + + def __init__(self,obj): + pass +