* src/Spell.py: Interface to gtkspell

* 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


svn: r5021
This commit is contained in:
Don Allingham 2005-08-05 03:41:23 +00:00
parent ef444d3843
commit 55447ac858
13 changed files with 106 additions and 19 deletions

View File

@ -1,4 +1,16 @@
2005-08-04 Don Allingham <don@gramps-project.org> 2005-08-04 Don Allingham <don@gramps-project.org>
* 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/ImageSelect.py: fixed thumbnail dnd selection
* src/AttrEdit.py: don't used reserved word "list" * src/AttrEdit.py: don't used reserved word "list"
* src/EditPerson.py: Pass correct attribute list to editor * src/EditPerson.py: Pass correct attribute list to editor

View File

@ -51,6 +51,7 @@ import Date
import RelLib import RelLib
import Sources import Sources
import DateEdit import DateEdit
import Spell
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -94,6 +95,7 @@ class AddressEditor:
self.postal = self.top.get_widget("postal") self.postal = self.top.get_widget("postal")
self.phone = self.top.get_widget("phone") self.phone = self.top.get_widget("phone")
self.note_field = self.top.get_widget("addr_note") self.note_field = self.top.get_widget("addr_note")
self.spell = Spell.Spell(self.note_field)
self.priv = self.top.get_widget("priv") self.priv = self.top.get_widget("priv")
self.slist = self.top.get_widget("slist") self.slist = self.top.get_widget("slist")
self.sources_label = self.top.get_widget("sourcesAddr") self.sources_label = self.top.get_widget("sourcesAddr")

View File

@ -53,6 +53,8 @@ import Utils
import Sources import Sources
import AutoComp import AutoComp
import RelLib import RelLib
import Spell
from QuestionDialog import WarningDialog from QuestionDialog import WarningDialog
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -94,6 +96,7 @@ class AttributeEditor:
self.slist = self.top.get_widget("slist") self.slist = self.top.get_widget("slist")
self.value_field = self.top.get_widget("attr_value") self.value_field = self.top.get_widget("attr_value")
self.note_field = self.top.get_widget("attr_note") 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.attrib_menu = self.top.get_widget("attr_menu")
self.type_field = self.attrib_menu.child self.type_field = self.attrib_menu.child
self.source_field = self.top.get_widget("attr_source") self.source_field = self.top.get_widget("attr_source")

View File

@ -61,6 +61,7 @@ import Date
import DateHandler import DateHandler
import TransTable import TransTable
import NameDisplay import NameDisplay
import Spell
from QuestionDialog import WarningDialog, ErrorDialog, SaveDialog, QuestionDialog2 from QuestionDialog import WarningDialog, ErrorDialog, SaveDialog, QuestionDialog2
@ -159,6 +160,7 @@ class EditPerson:
self.notes_field = self.get_widget("personNotes") self.notes_field = self.get_widget("personNotes")
self.notes_field.set_editable(mod) self.notes_field.set_editable(mod)
self.spell_notes = Spell.Spell(self.notes_field)
self.flowed = self.get_widget("flowed") self.flowed = self.get_widget("flowed")
self.flowed.set_sensitive(mod) self.flowed.set_sensitive(mod)
self.preform = self.get_widget("preform") self.preform = self.get_widget("preform")

View File

@ -48,10 +48,10 @@ import Utils
import Sources import Sources
import ImageSelect import ImageSelect
import NameDisplay import NameDisplay
import Spell
from DdTargets import DdTargets from DdTargets import DdTargets
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# EditPlace # EditPlace
@ -116,6 +116,7 @@ class EditPlace:
self.latitude.set_editable(mode) self.latitude.set_editable(mode)
self.note = self.top_window.get_widget("place_note") self.note = self.top_window.get_widget("place_note")
self.note.set_editable(mode) self.note.set_editable(mode)
self.spell = Spell.Spell(self.note)
self.web_list = self.top_window.get_widget("web_list") self.web_list = self.top_window.get_widget("web_list")
self.web_url = self.top_window.get_widget("web_url") self.web_url = self.top_window.get_widget("web_url")

View File

@ -47,6 +47,7 @@ import ImageSelect
import ListModel import ListModel
import RelLib import RelLib
import NameDisplay import NameDisplay
import Spell
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -97,6 +98,7 @@ class EditSource:
self.abbrev = self.top_window.get_widget("abbrev") self.abbrev = self.top_window.get_widget("abbrev")
self.note = self.top_window.get_widget("source_note") self.note = self.top_window.get_widget("source_note")
self.note.set_editable(mode) self.note.set_editable(mode)
self.spell = Spell.Spell(self.note)
self.notes_buffer = self.note.get_buffer() self.notes_buffer = self.note.get_buffer()
self.gallery_label = self.top_window.get_widget("gallerySourceEditor") self.gallery_label = self.top_window.get_widget("gallerySourceEditor")
self.refs_label = self.top_window.get_widget("refsSourceEditor") self.refs_label = self.top_window.get_widget("refsSourceEditor")

View File

@ -52,6 +52,8 @@ import Date
import DateHandler import DateHandler
import ImageSelect import ImageSelect
import DateEdit import DateEdit
import Spell
from QuestionDialog import WarningDialog, ErrorDialog from QuestionDialog import WarningDialog, ErrorDialog
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -132,6 +134,7 @@ class EventEditor:
self.descr_field.set_editable(not noedit) self.descr_field.set_editable(not noedit)
self.note_field = self.top.get_widget("eventNote") self.note_field = self.top.get_widget("eventNote")
self.note_field.set_editable(not noedit) self.note_field.set_editable(not noedit)
self.spell = Spell.Spell(self.note_field)
self.event_menu = self.top.get_widget("personal_events") self.event_menu = self.top.get_widget("personal_events")
self.priv = self.top.get_widget("priv") self.priv = self.top.get_widget("priv")
self.priv.set_sensitive(not noedit) self.priv.set_sensitive(not noedit)

View File

@ -65,6 +65,7 @@ import DateEdit
import DateHandler import DateHandler
import Date import Date
import ImgManip import ImgManip
import Spell
from QuestionDialog import ErrorDialog from QuestionDialog import ErrorDialog
from DdTargets import DdTargets from DdTargets import DdTargets
@ -719,6 +720,7 @@ class LocalMediaProperties:
mt = Utils.get_mime_description(mtype) mt = Utils.get_mime_description(mtype)
self.change_dialog.get_widget("type").set_text(mt) self.change_dialog.get_widget("type").set_text(mt)
self.notes = self.change_dialog.get_widget("notes") self.notes = self.change_dialog.get_widget("notes")
self.spell = Spell.Spell(self.notes)
if self.photo.get_note(): if self.photo.get_note():
self.notes.get_buffer().set_text(self.photo.get_note()) self.notes.get_buffer().set_text(self.photo.get_note())
Utils.bold_label(self.notes_label) 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()) 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()) global_note.insert_at_cursor(media_obj.get_note())
self.redraw_attr_list() self.redraw_attr_list()
@ -927,15 +931,14 @@ class GlobalMediaProperties:
self.notes = self.change_dialog.get_widget("notes") self.notes = self.change_dialog.get_widget("notes")
self.notes.set_editable(mode) self.notes.set_editable(mode)
self.spell = Spell.Spell(self.notes)
self.date_edit = self.change_dialog.get_widget("date_edit") self.date_edit = self.change_dialog.get_widget("date_edit")
self.date_edit.set_sensitive(mode) self.date_edit.set_sensitive(mode)
self.date_check = DateEdit.DateEdit( self.date_check = DateEdit.DateEdit(
self.date_object, self.date_object, self.date_entry,
self.date_entry, self.date_edit, self.window)
self.date_edit,
self.window)
self.pixmap = self.change_dialog.get_widget("pixmap") self.pixmap = self.change_dialog.get_widget("pixmap")
self.attr_type = self.change_dialog.get_widget("attr_type") self.attr_type = self.change_dialog.get_widget("attr_type")

View File

@ -57,6 +57,7 @@ import GrampsKeys
import NameDisplay import NameDisplay
import Date import Date
import DateEdit import DateEdit
import Spell
from QuestionDialog import QuestionDialog, WarningDialog, SaveDialog from QuestionDialog import QuestionDialog, WarningDialog, SaveDialog
from DdTargets import DdTargets from DdTargets import DdTargets
@ -175,6 +176,7 @@ class Marriage:
self.type_field.set_sensitive(mode) self.type_field.set_sensitive(mode)
self.notes_field = self.get_widget("marriageNotes") self.notes_field = self.get_widget("marriageNotes")
self.notes_field.set_editable(mode) self.notes_field.set_editable(mode)
self.spell = Spell.Spell(self.notes_field)
self.gid = self.get_widget("gid") self.gid = self.get_widget("gid")
self.gid.set_editable(mode) self.gid.set_editable(mode)
self.attr_list = self.get_widget("attr_list") self.attr_list = self.get_widget("attr_list")

View File

@ -49,6 +49,7 @@ import NameDisplay
import Date import Date
import DateEdit import DateEdit
import DateHandler import DateHandler
import Spell
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -103,6 +104,8 @@ class NameEditor:
self.type_combo = self.top.get_widget("name_type") self.type_combo = self.top.get_widget("name_type")
self.note_field = self.top.get_widget("alt_note") self.note_field = self.top.get_widget("alt_note")
self.spell = Spell.Spell(self.note_field)
self.slist = self.top.get_widget('slist') self.slist = self.top.get_widget('slist')
self.priv = self.top.get_widget("priv") self.priv = self.top.get_widget("priv")
self.sources_label = self.top.get_widget("sourcesName") self.sources_label = self.top.get_widget("sourcesName")

View File

@ -36,6 +36,7 @@ import gtk.glade
from gettext import gettext as _ from gettext import gettext as _
import const import const
import Utils import Utils
import Spell
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -80,6 +81,7 @@ class NoteEditor:
self.entry = self.glade.get_widget('note') self.entry = self.glade.get_widget('note')
self.entry.get_buffer().set_text(self.data.get_note()) self.entry.get_buffer().set_text(self.data.get_note())
self.entry.set_editable(not self.readonly) self.entry.set_editable(not self.readonly)
self.spellcheck = Spell.Spell(self.entry)
cancel_button = self.glade.get_widget('cancel') cancel_button = self.glade.get_widget('cancel')
ok_button = self.glade.get_widget('ok') ok_button = self.glade.get_widget('ok')

View File

@ -51,6 +51,7 @@ import Date
import DateEdit import DateEdit
import DateHandler import DateHandler
import GrampsDBCallback import GrampsDBCallback
import Spell
from DdTargets import DdTargets from DdTargets import DdTargets
@ -418,6 +419,12 @@ class SourceEditor:
self.date_obj, self.date_entry_field, self.date_obj, self.date_entry_field,
date_stat, self.sourceDisplay) 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.draw(self.active_source,fresh=True)
self.set_button() self.set_button()
if self.parent: if self.parent:
@ -477,9 +484,9 @@ class SourceEditor:
def set_button(self): def set_button(self):
if self.active_source: if self.active_source:
self.ok.set_sensitive(1) self.ok.set_sensitive(True)
else: else:
self.ok.set_sensitive(0) self.ok.set_sensitive(False)
def get_widget(self,name): def get_widget(self,name):
"""returns the widget associated with the specified name""" """returns the widget associated with the specified name"""
@ -487,14 +494,10 @@ class SourceEditor:
def draw(self,sel=None,fresh=False): def draw(self,sel=None,fresh=False):
if self.source_ref and fresh: if self.source_ref and fresh:
spage = self.get_widget("spage") self.spage.get_buffer().set_text(self.source_ref.get_page())
spage.get_buffer().set_text(self.source_ref.get_page())
text = self.get_widget("stext") self.stext.get_buffer().set_text(self.source_ref.get_text())
text.get_buffer().set_text(self.source_ref.get_text()) self.scom.get_buffer().set_text(self.source_ref.get_note())
scom = self.get_widget("scomment")
scom.get_buffer().set_text(self.source_ref.get_note())
idval = self.source_ref.get_base_handle() idval = self.source_ref.get_base_handle()
src = self.db.get_source_from_handle(idval) src = self.db.get_source_from_handle(idval)
self.active_source = src self.active_source = src
@ -545,15 +548,15 @@ class SourceEditor:
conf = self.get_widget("conf").get_active() 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(), comments = unicode(buf.get_text(buf.get_start_iter(),
buf.get_end_iter(),False)) 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(), text = unicode(buf.get_text(buf.get_start_iter(),
buf.get_end_iter(),False)) 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(), page = unicode(buf.get_text(buf.get_start_iter(),
buf.get_end_iter(),False)) buf.get_end_iter(),False))

49
gramps2/src/Spell.py Normal file
View File

@ -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