2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2005-03-03 20:30:55 +05:30
|
|
|
# Copyright (C) 2000-2005 Donald N. Allingham
|
2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modiy
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
2003-11-13 00:15:07 +05:30
|
|
|
# $Id$
|
|
|
|
|
2005-03-03 20:30:55 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2005-04-01 19:09:34 +05:30
|
|
|
import cPickle as pickle
|
2005-03-03 20:30:55 +05:30
|
|
|
from gettext import gettext as _
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GTK/Gnome modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import gtk
|
2004-08-21 10:03:55 +05:30
|
|
|
import gtk.gdk
|
2002-10-20 19:55:16 +05:30
|
|
|
import gtk.glade
|
2003-11-18 09:56:06 +05:30
|
|
|
import gnome
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
import const
|
|
|
|
import Utils
|
|
|
|
import AutoComp
|
2002-11-21 10:11:40 +05:30
|
|
|
import ListModel
|
2003-01-10 10:51:32 +05:30
|
|
|
import RelLib
|
2002-10-20 19:55:16 +05:30
|
|
|
import ImageSelect
|
2004-10-04 02:34:54 +05:30
|
|
|
import DateHandler
|
2003-10-29 10:34:43 +05:30
|
|
|
import Sources
|
2005-01-06 22:58:31 +05:30
|
|
|
import GrampsKeys
|
2005-01-01 09:57:15 +05:30
|
|
|
import NameDisplay
|
2005-03-19 23:51:57 +05:30
|
|
|
import Date
|
|
|
|
import DateEdit
|
2003-01-10 10:51:32 +05:30
|
|
|
|
2003-03-08 11:29:20 +05:30
|
|
|
from QuestionDialog import QuestionDialog, WarningDialog, SaveDialog
|
2005-03-26 02:35:09 +05:30
|
|
|
from DdTargets import DdTargets
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-01-10 10:51:32 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Globals
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2002-10-20 19:55:16 +05:30
|
|
|
_temple_names = const.lds_temple_codes.keys()
|
|
|
|
_temple_names.sort()
|
|
|
|
_temple_names = [""] + _temple_names
|
|
|
|
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Marriage class
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class Marriage:
|
|
|
|
|
2005-04-01 11:03:22 +05:30
|
|
|
def __init__(self,parent,family,db):
|
2002-10-20 19:55:16 +05:30
|
|
|
"""Initializes the Marriage class, and displays the window"""
|
|
|
|
self.family = family
|
2004-02-23 10:11:37 +05:30
|
|
|
self.parent = parent
|
2004-07-28 07:59:07 +05:30
|
|
|
if self.parent.child_windows.has_key(family.get_handle()):
|
|
|
|
self.parent.child_windows[family.get_handle()].present(None)
|
2004-02-23 10:11:37 +05:30
|
|
|
return
|
* src/AddrEdit.py, src/AttrEdit.py, src/EditPerson.py,
src/EditSource.py, src/EventEdit.py, src/ImageSelect.py,
src/Marriage.py, src/NameEdit.py, src/NoteEdit.py,
src/Sources.py, src/UrlEdit.py, src/Witness.py:
Register windows opened for existing objects. Prevent editing
same object twice.
svn: r2905
2004-02-24 11:07:06 +05:30
|
|
|
self.child_windows = {}
|
2002-10-20 19:55:16 +05:30
|
|
|
self.db = db
|
2004-02-14 11:10:30 +05:30
|
|
|
self.path = db.get_save_path()
|
2002-10-20 19:55:16 +05:30
|
|
|
self.pmap = {}
|
2004-12-29 10:36:10 +05:30
|
|
|
self.dp = DateHandler.parser
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-10-29 10:34:43 +05:30
|
|
|
if family:
|
2004-02-14 11:10:30 +05:30
|
|
|
self.srcreflist = family.get_source_references()
|
2003-10-29 10:34:43 +05:30
|
|
|
else:
|
|
|
|
self.srcreflist = []
|
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
for key in db.get_place_handles():
|
|
|
|
p = db.get_place_from_handle(key).get_display_info()
|
2002-10-20 19:55:16 +05:30
|
|
|
self.pmap[p[0]] = key
|
|
|
|
|
2003-08-17 07:44:33 +05:30
|
|
|
self.top = gtk.glade.XML(const.marriageFile,"marriageEditor","gramps")
|
2003-09-14 02:12:57 +05:30
|
|
|
self.window = self.get_widget("marriageEditor")
|
2003-03-06 11:42:51 +05:30
|
|
|
|
2003-09-14 02:12:57 +05:30
|
|
|
Utils.set_titles(self.window, self.top.get_widget('title'),
|
2003-03-06 11:42:51 +05:30
|
|
|
_('Marriage/Relationship Editor'))
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.icon_list = self.get_widget('iconlist')
|
2004-06-12 10:09:45 +05:30
|
|
|
self.gallery = ImageSelect.Gallery(family, self.db.commit_family,
|
|
|
|
self.path, self.icon_list, db, self)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.top.signal_autoconnect({
|
|
|
|
"destroy_passed_object" : self.on_cancel_edit,
|
2003-11-18 09:56:06 +05:30
|
|
|
"on_help_marriage_editor" : self.on_help_clicked,
|
2002-10-20 19:55:16 +05:30
|
|
|
"on_up_clicked" : self.on_up_clicked,
|
|
|
|
"on_down_clicked" : self.on_down_clicked,
|
2002-11-21 10:11:40 +05:30
|
|
|
"on_attr_up_clicked" : self.on_attr_up_clicked,
|
|
|
|
"on_attr_down_clicked" : self.on_attr_down_clicked,
|
2002-10-20 19:55:16 +05:30
|
|
|
"on_add_attr_clicked" : self.on_add_attr_clicked,
|
2002-11-21 10:11:40 +05:30
|
|
|
"on_delete_attr_clicked" : self.on_delete_attr_clicked,
|
2004-02-23 08:15:36 +05:30
|
|
|
"on_addphoto_clicked" : self.gallery.on_add_media_clicked,
|
|
|
|
"on_selectphoto_clicked" : self.gallery.on_select_media_clicked,
|
2002-10-20 19:55:16 +05:30
|
|
|
"on_close_marriage_editor" : self.on_close_marriage_editor,
|
|
|
|
"on_delete_event" : self.on_delete_event,
|
|
|
|
"on_lds_src_clicked" : self.lds_src_clicked,
|
|
|
|
"on_lds_note_clicked" : self.lds_note_clicked,
|
2004-02-23 08:15:36 +05:30
|
|
|
"on_deletephoto_clicked" : self.gallery.on_delete_media_clicked,
|
|
|
|
"on_edit_photo_clicked" : self.gallery.on_edit_media_clicked,
|
2002-10-20 19:55:16 +05:30
|
|
|
"on_edit_properties_clicked": self.gallery.popup_change_description,
|
|
|
|
"on_marriageAddBtn_clicked" : self.on_add_clicked,
|
2003-05-08 23:08:49 +05:30
|
|
|
"on_event_update_clicked" : self.on_event_update_clicked,
|
|
|
|
"on_attr_update_clicked" : self.on_update_attr_clicked,
|
2002-10-20 19:55:16 +05:30
|
|
|
"on_marriageDeleteBtn_clicked" : self.on_delete_clicked,
|
2003-11-13 00:15:07 +05:30
|
|
|
"on_switch_page" : self.on_switch_page
|
2002-10-20 19:55:16 +05:30
|
|
|
})
|
|
|
|
|
2004-02-15 08:03:44 +05:30
|
|
|
|
2005-02-19 10:11:59 +05:30
|
|
|
mode = not self.db.readonly
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
fid = family.get_father_handle()
|
|
|
|
mid = family.get_mother_handle()
|
2004-02-26 10:21:57 +05:30
|
|
|
|
2004-08-07 10:46:57 +05:30
|
|
|
father = self.db.get_person_from_handle(fid)
|
|
|
|
mother = self.db.get_person_from_handle(mid)
|
2004-02-15 08:03:44 +05:30
|
|
|
|
2005-01-01 09:57:15 +05:30
|
|
|
self.title = _("%s and %s") % (NameDisplay.displayer.display(father),
|
|
|
|
NameDisplay.displayer.display(mother))
|
2003-03-06 06:42:21 +05:30
|
|
|
|
2004-02-23 10:11:37 +05:30
|
|
|
Utils.set_title_label(self.top,self.title)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.event_list = self.get_widget("marriageEventList")
|
|
|
|
|
2004-08-21 10:03:55 +05:30
|
|
|
if gtk.gdk.screen_height() > 700:
|
|
|
|
self.event_list.set_size_request(500,250)
|
|
|
|
else:
|
|
|
|
self.event_list.set_size_request(500,-1)
|
|
|
|
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
# widgets
|
2003-10-29 10:34:43 +05:30
|
|
|
self.complete = self.get_widget('complete')
|
2005-02-19 10:11:59 +05:30
|
|
|
self.complete.set_sensitive(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.date_field = self.get_widget("marriageDate")
|
|
|
|
self.place_field = self.get_widget("marriagePlace")
|
|
|
|
self.cause_field = self.get_widget("marriageCause")
|
|
|
|
self.name_field = self.get_widget("marriageEventName")
|
|
|
|
self.descr_field = self.get_widget("marriageDescription")
|
|
|
|
self.type_field = self.get_widget("marriage_type")
|
2005-02-19 10:11:59 +05:30
|
|
|
self.type_field.set_sensitive(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.notes_field = self.get_widget("marriageNotes")
|
2005-02-19 10:11:59 +05:30
|
|
|
self.notes_field.set_editable(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.gid = self.get_widget("gid")
|
2005-02-19 10:11:59 +05:30
|
|
|
self.gid.set_editable(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.attr_list = self.get_widget("attr_list")
|
|
|
|
self.attr_type = self.get_widget("attr_type")
|
|
|
|
self.attr_value = self.get_widget("attr_value")
|
|
|
|
self.event_src_field = self.get_widget("event_srcinfo")
|
|
|
|
self.event_conf_field = self.get_widget("event_conf")
|
|
|
|
self.attr_src_field = self.get_widget("attr_srcinfo")
|
|
|
|
self.attr_conf_field = self.get_widget("attr_conf")
|
|
|
|
self.lds_date = self.get_widget("lds_date")
|
2005-02-19 10:11:59 +05:30
|
|
|
self.lds_date.set_editable(mode)
|
2005-03-19 23:51:57 +05:30
|
|
|
self.lds_date_led = self.get_widget("lds_date_stat")
|
|
|
|
self.lds_date_led.set_sensitive(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.lds_temple = self.get_widget("lds_temple")
|
2005-02-19 10:11:59 +05:30
|
|
|
self.lds_temple.set_sensitive(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.lds_status = self.get_widget("lds_status")
|
2005-02-19 10:11:59 +05:30
|
|
|
self.lds_status.set_sensitive(mode)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.lds_place = self.get_widget("lds_place")
|
2005-02-19 10:11:59 +05:30
|
|
|
self.lds_place.set_sensitive(mode)
|
2003-10-29 10:34:43 +05:30
|
|
|
self.slist = self.get_widget("slist")
|
2003-11-13 00:15:07 +05:30
|
|
|
self.sources_label = self.get_widget("sourcesMarriage")
|
|
|
|
self.gallery_label = self.get_widget("galleryMarriage")
|
|
|
|
self.sources_label = self.get_widget("sourcesMarriage")
|
|
|
|
self.events_label = self.get_widget("eventsMarriage")
|
|
|
|
self.attr_label = self.get_widget("attrMarriage")
|
|
|
|
self.notes_label = self.get_widget("notesMarriage")
|
|
|
|
self.lds_label = self.get_widget("ldsMarriage")
|
|
|
|
|
2003-12-16 06:07:47 +05:30
|
|
|
self.flowed = self.get_widget("mar_flowed")
|
2005-02-19 10:11:59 +05:30
|
|
|
self.flowed.set_sensitive(mode)
|
2003-12-16 06:07:47 +05:30
|
|
|
self.preform = self.get_widget("mar_preform")
|
2005-02-19 10:11:59 +05:30
|
|
|
self.preform.set_sensitive(mode)
|
2003-12-16 06:07:47 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
self.elist = family.get_event_list()[:]
|
|
|
|
self.alist = family.get_attribute_list()[:]
|
2002-10-20 19:55:16 +05:30
|
|
|
self.lists_changed = 0
|
|
|
|
|
2004-08-24 09:18:15 +05:30
|
|
|
self.get_widget('changed').set_text(family.get_change_display())
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
# set initial data
|
|
|
|
self.gallery.load_images()
|
|
|
|
|
2003-03-03 10:02:53 +05:30
|
|
|
etitles = [(_('Event'),-1,100),(_('Date'),-1,125),(_('Place'),-1,150)]
|
2003-01-13 09:29:10 +05:30
|
|
|
atitles = [(_('Attribute'),-1,150),(_('Value'),-1,150)]
|
2002-11-21 10:11:40 +05:30
|
|
|
|
|
|
|
self.etree = ListModel.ListModel(self.event_list, etitles,
|
|
|
|
self.on_select_row,
|
2003-05-13 01:09:49 +05:30
|
|
|
self.on_event_update_clicked)
|
2002-11-21 10:11:40 +05:30
|
|
|
self.atree = ListModel.ListModel(self.attr_list, atitles,
|
|
|
|
self.on_attr_list_select_row,
|
|
|
|
self.on_update_attr_clicked)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-08-07 08:41:04 +05:30
|
|
|
rel_list = []
|
|
|
|
for (val,junk) in const.family_relations:
|
|
|
|
rel_list.append(val)
|
|
|
|
AutoComp.fill_option_text(self.type_field,rel_list)
|
|
|
|
|
2004-07-31 00:26:49 +05:30
|
|
|
frel = family.get_relationship()
|
|
|
|
self.type_field.set_active(frel)
|
2004-08-20 07:50:06 +05:30
|
|
|
self.gid.set_text(family.get_gramps_id())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
2003-11-26 07:51:29 +05:30
|
|
|
place_list = self.pmap.keys()
|
|
|
|
place_list.sort()
|
2004-08-07 08:41:04 +05:30
|
|
|
AutoComp.fill_combo(self.lds_place, place_list)
|
2003-11-26 07:51:29 +05:30
|
|
|
|
2004-08-23 04:46:57 +05:30
|
|
|
lds_ord = self.family.get_lds_sealing()
|
|
|
|
if lds_ord:
|
|
|
|
if lds_ord.get_place_handle():
|
|
|
|
self.lds_place.child.set_text(lds_ord.get_place_handle().get_title())
|
|
|
|
self.lds_date.set_text(lds_ord.get_date())
|
|
|
|
self.seal_stat = lds_ord.get_status()
|
2005-03-19 23:51:57 +05:30
|
|
|
self.lds_date_object = lds_ord.get_date_object()
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-08-07 08:41:04 +05:30
|
|
|
self.lds_place.child.set_text("")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.seal_stat = 0
|
2005-03-19 23:51:57 +05:30
|
|
|
self.lds_date_object = Date.Date()
|
|
|
|
|
|
|
|
self.lds_date_check = DateEdit.DateEdit(
|
|
|
|
self.lds_date_object, self.lds_date,
|
|
|
|
self.lds_date_led, self.window)
|
2003-05-23 07:42:55 +05:30
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
if self.family.get_complete_flag():
|
2003-10-29 10:34:43 +05:30
|
|
|
self.complete.set_active(1)
|
|
|
|
|
2005-03-03 07:12:17 +05:30
|
|
|
self.lds_field(lds_ord,self.lds_temple)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.build_seal_menu()
|
2003-11-26 07:51:29 +05:30
|
|
|
|
2004-08-23 04:46:57 +05:30
|
|
|
if lds_ord:
|
2003-11-26 07:51:29 +05:30
|
|
|
Utils.bold_label(self.lds_label)
|
|
|
|
else:
|
|
|
|
Utils.unbold_label(self.lds_label)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-08-07 08:41:04 +05:30
|
|
|
self.event_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
|
2005-03-26 02:35:09 +05:30
|
|
|
[DdTargets.FAMILY_EVENT.target()],
|
|
|
|
gtk.gdk.ACTION_COPY)
|
2004-08-07 08:41:04 +05:30
|
|
|
self.event_list.drag_source_set(gtk.gdk.BUTTON1_MASK,
|
2005-03-26 02:35:09 +05:30
|
|
|
[DdTargets.FAMILY_EVENT.target()],
|
|
|
|
gtk.gdk.ACTION_COPY)
|
2004-08-07 08:41:04 +05:30
|
|
|
self.event_list.connect('drag_data_get',
|
|
|
|
self.ev_source_drag_data_get)
|
|
|
|
self.event_list.connect('drag_data_received',
|
|
|
|
self.ev_dest_drag_data_received)
|
2003-01-13 09:29:10 +05:30
|
|
|
self.event_list.connect('drag_begin', self.ev_drag_begin)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-08-07 08:41:04 +05:30
|
|
|
self.attr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
|
2005-03-26 02:35:09 +05:30
|
|
|
[DdTargets.FAMILY_ATTRIBUTE.target()],
|
|
|
|
gtk.gdk.ACTION_COPY)
|
2004-08-07 08:41:04 +05:30
|
|
|
self.attr_list.drag_source_set(gtk.gdk.BUTTON1_MASK,
|
2005-03-26 02:35:09 +05:30
|
|
|
[DdTargets.FAMILY_ATTRIBUTE.target()],
|
|
|
|
gtk.gdk.ACTION_COPY)
|
2004-08-07 08:41:04 +05:30
|
|
|
self.attr_list.connect('drag_data_get',
|
|
|
|
self.at_source_drag_data_get)
|
|
|
|
self.attr_list.connect('drag_data_received',
|
|
|
|
self.at_dest_drag_data_received)
|
2003-01-13 09:29:10 +05:30
|
|
|
self.attr_list.connect('drag_begin', self.at_drag_begin)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
# set notes data
|
|
|
|
self.notes_buffer = self.notes_field.get_buffer()
|
2004-02-14 11:10:30 +05:30
|
|
|
if family.get_note():
|
|
|
|
self.notes_buffer.set_text(family.get_note())
|
2003-11-13 00:15:07 +05:30
|
|
|
Utils.bold_label(self.notes_label)
|
2005-03-09 03:32:49 +05:30
|
|
|
if family.get_note_format() == 1:
|
|
|
|
self.preform.set_active(1)
|
2003-12-16 06:07:47 +05:30
|
|
|
else:
|
|
|
|
self.flowed.set_active(1)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-27 11:21:59 +05:30
|
|
|
self.sourcetab = Sources.SourceTab(
|
|
|
|
self.srcreflist, self, self.top, self.window, self.slist,
|
|
|
|
self.top.get_widget('add_src'), self.top.get_widget('edit_src'),
|
2005-04-01 11:03:22 +05:30
|
|
|
self.top.get_widget('del_src'), self.db.readonly)
|
2003-10-29 10:34:43 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.redraw_event_list()
|
|
|
|
self.redraw_attr_list()
|
2004-02-23 10:11:37 +05:30
|
|
|
self.add_itself_to_winsmenu()
|
2005-02-17 10:16:13 +05:30
|
|
|
self.top.get_widget('ok').set_sensitive(not self.db.readonly)
|
|
|
|
|
|
|
|
self.top.get_widget('marriage_del').set_sensitive(mode)
|
|
|
|
self.top.get_widget('marriage_add').set_sensitive(mode)
|
|
|
|
self.top.get_widget('attr_del').set_sensitive(mode)
|
|
|
|
self.top.get_widget('attr_add').set_sensitive(mode)
|
|
|
|
self.top.get_widget('media_del').set_sensitive(mode)
|
|
|
|
self.top.get_widget('media_add').set_sensitive(mode)
|
|
|
|
self.top.get_widget('media_sel').set_sensitive(mode)
|
2003-09-14 02:12:57 +05:30
|
|
|
self.window.show()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-03-03 07:12:17 +05:30
|
|
|
def lds_field(self,lds_ord,combo):
|
|
|
|
|
|
|
|
cell = gtk.CellRendererText()
|
|
|
|
combo.pack_start(cell,True)
|
|
|
|
combo.add_attribute(cell,'text',0)
|
|
|
|
store = gtk.ListStore(str)
|
|
|
|
for value in _temple_names:
|
|
|
|
node = store.append()
|
|
|
|
store.set(node,0,unicode(value))
|
|
|
|
combo.set_model(store)
|
|
|
|
|
|
|
|
if lds_ord:
|
|
|
|
temple_code = const.lds_temple_to_abrev.get(lds_ord.get_temple(),"")
|
|
|
|
index = _temple_names.index(temple_code)
|
|
|
|
else:
|
|
|
|
index = 0
|
|
|
|
combo.set_active(index)
|
|
|
|
|
2004-02-23 10:11:37 +05:30
|
|
|
def close_child_windows(self):
|
* src/AddrEdit.py, src/AttrEdit.py, src/EditPerson.py,
src/EditSource.py, src/EventEdit.py, src/ImageSelect.py,
src/Marriage.py, src/NameEdit.py, src/NoteEdit.py,
src/Sources.py, src/UrlEdit.py, src/Witness.py:
Register windows opened for existing objects. Prevent editing
same object twice.
svn: r2905
2004-02-24 11:07:06 +05:30
|
|
|
for child_window in self.child_windows.values():
|
2004-02-23 10:11:37 +05:30
|
|
|
child_window.close(None)
|
* src/AddrEdit.py, src/AttrEdit.py, src/EditPerson.py,
src/EditSource.py, src/EventEdit.py, src/ImageSelect.py,
src/Marriage.py, src/NameEdit.py, src/NoteEdit.py,
src/Sources.py, src/UrlEdit.py, src/Witness.py:
Register windows opened for existing objects. Prevent editing
same object twice.
svn: r2905
2004-02-24 11:07:06 +05:30
|
|
|
self.child_windows = {}
|
2004-02-23 10:11:37 +05:30
|
|
|
|
2005-04-05 10:03:11 +05:30
|
|
|
def close(self):
|
2004-08-07 08:41:04 +05:30
|
|
|
self.gallery.close()
|
2004-02-23 10:11:37 +05:30
|
|
|
self.close_child_windows()
|
|
|
|
self.remove_itself_from_winsmenu()
|
|
|
|
self.window.destroy()
|
|
|
|
|
|
|
|
def add_itself_to_winsmenu(self):
|
2004-07-28 07:59:07 +05:30
|
|
|
self.parent.child_windows[self.family.get_handle()] = self
|
2004-02-23 10:11:37 +05:30
|
|
|
win_menu_label = self.title
|
|
|
|
if not win_menu_label.strip():
|
|
|
|
win_menu_label = _("New Relationship")
|
|
|
|
self.win_menu_item = gtk.MenuItem(win_menu_label)
|
|
|
|
self.win_menu_item.set_submenu(gtk.Menu())
|
|
|
|
self.win_menu_item.show()
|
|
|
|
self.parent.winsmenu.append(self.win_menu_item)
|
2004-02-25 08:50:53 +05:30
|
|
|
self.winsmenu = self.win_menu_item.get_submenu()
|
2004-02-23 10:11:37 +05:30
|
|
|
self.menu_item = gtk.MenuItem(_('Marriage/Relationship Editor'))
|
|
|
|
self.menu_item.connect("activate",self.present)
|
|
|
|
self.menu_item.show()
|
2004-02-25 08:50:53 +05:30
|
|
|
self.winsmenu.append(self.menu_item)
|
2004-02-23 10:11:37 +05:30
|
|
|
|
|
|
|
def remove_itself_from_winsmenu(self):
|
2004-07-28 07:59:07 +05:30
|
|
|
del self.parent.child_windows[self.family.get_handle()]
|
2004-02-23 10:11:37 +05:30
|
|
|
self.menu_item.destroy()
|
2004-02-25 08:50:53 +05:30
|
|
|
self.winsmenu.destroy()
|
2004-02-23 10:11:37 +05:30
|
|
|
self.win_menu_item.destroy()
|
|
|
|
|
|
|
|
def present(self,obj):
|
|
|
|
self.window.present()
|
|
|
|
|
2003-11-18 09:56:06 +05:30
|
|
|
def on_help_clicked(self,obj):
|
|
|
|
"""Display the relevant portion of GRAMPS manual"""
|
2003-12-02 09:57:23 +05:30
|
|
|
gnome.help_display('gramps-manual','gramps-edit-complete')
|
2003-11-18 09:56:06 +05:30
|
|
|
|
2003-01-13 09:29:10 +05:30
|
|
|
def ev_drag_begin(self, context, a):
|
|
|
|
return
|
|
|
|
|
|
|
|
def at_drag_begin(self, context, a):
|
|
|
|
return
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def build_seal_menu(self):
|
2005-01-07 10:04:02 +05:30
|
|
|
cell = gtk.CellRendererText()
|
|
|
|
self.lds_status.pack_start(cell,True)
|
|
|
|
self.lds_status.add_attribute(cell,'text',0)
|
|
|
|
|
|
|
|
store = gtk.ListStore(str)
|
2002-10-20 19:55:16 +05:30
|
|
|
for val in const.lds_ssealing:
|
2005-01-07 10:04:02 +05:30
|
|
|
store.append(row=[val])
|
|
|
|
self.lds_status.set_model(store)
|
|
|
|
self.lds_status.connect('changed',self.set_lds_seal)
|
|
|
|
self.lds_status.set_active(self.seal_stat)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def set_lds_seal(self,obj):
|
2005-01-07 10:04:02 +05:30
|
|
|
self.seal_stat = obj.get_active()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def lds_src_clicked(self,obj):
|
2004-08-23 04:46:57 +05:30
|
|
|
lds_ord = self.family.get_lds_sealing()
|
|
|
|
if lds_ord == None:
|
|
|
|
lds_ord = RelLib.LdsOrd()
|
|
|
|
self.family.set_lds_sealing(lds_ord)
|
|
|
|
Sources.SourceSelector(lds_ord.get_source_references(),self,self.window)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def lds_note_clicked(self,obj):
|
|
|
|
import NoteEdit
|
2004-08-23 04:46:57 +05:30
|
|
|
lds_ord = self.family.get_lds_sealing()
|
|
|
|
if lds_ord == None:
|
|
|
|
lds_ord = RelLib.LdsOrd()
|
|
|
|
self.family.set_lds_sealing(lds_ord)
|
2005-02-20 06:32:15 +05:30
|
|
|
NoteEdit.NoteEditor(lds_ord,self,self.window,readonly=self.db.readonly)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_up_clicked(self,obj):
|
2004-08-23 04:46:57 +05:30
|
|
|
model,node = self.etree.get_selected()
|
|
|
|
if not node:
|
2002-10-20 19:55:16 +05:30
|
|
|
return
|
2002-11-21 10:11:40 +05:30
|
|
|
|
2004-08-23 04:46:57 +05:30
|
|
|
row = self.etree.get_row(node)
|
2002-10-20 19:55:16 +05:30
|
|
|
if row != 0:
|
2002-11-21 10:11:40 +05:30
|
|
|
self.etree.select_row(row-1)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_down_clicked(self,obj):
|
2004-08-23 04:46:57 +05:30
|
|
|
model,node = self.etree.get_selected()
|
|
|
|
if not node:
|
2002-10-20 19:55:16 +05:30
|
|
|
return
|
2002-11-21 10:11:40 +05:30
|
|
|
|
2004-08-23 04:46:57 +05:30
|
|
|
row = self.etree.get_row(node)
|
2002-11-21 10:11:40 +05:30
|
|
|
self.etree.select_row(row+1)
|
|
|
|
|
|
|
|
def on_attr_up_clicked(self,obj):
|
2004-08-23 04:46:57 +05:30
|
|
|
model,node = self.atree.get_selected()
|
|
|
|
if not node:
|
2002-11-21 10:11:40 +05:30
|
|
|
return
|
|
|
|
|
2004-08-23 04:46:57 +05:30
|
|
|
row = self.atree.get_row(node)
|
2002-11-21 10:11:40 +05:30
|
|
|
if row != 0:
|
|
|
|
self.atree.select_row(row-1)
|
|
|
|
|
|
|
|
def on_attr_down_clicked(self,obj):
|
2004-08-23 04:46:57 +05:30
|
|
|
model,node = self.atree.get_selected()
|
|
|
|
if not node:
|
2002-11-21 10:11:40 +05:30
|
|
|
return
|
|
|
|
|
2004-08-23 04:46:57 +05:30
|
|
|
row = self.atree.get_row(node)
|
2002-11-21 10:11:40 +05:30
|
|
|
self.atree.select_row(row+1)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def ev_dest_drag_data_received(self,widget,context,x,y,selection_data,info,time):
|
2003-01-13 09:29:10 +05:30
|
|
|
row = self.etree.get_row_at(x,y)
|
2002-10-20 19:55:16 +05:30
|
|
|
if selection_data and selection_data.data:
|
|
|
|
exec 'data = %s' % selection_data.data
|
|
|
|
exec 'mytype = "%s"' % data[0]
|
|
|
|
exec 'family = "%s"' % data[1]
|
2005-03-29 18:46:24 +05:30
|
|
|
|
|
|
|
if mytype != DdTargets.FAMILY_EVENT.drag_type:
|
2002-10-20 19:55:16 +05:30
|
|
|
return
|
2005-03-29 18:46:24 +05:30
|
|
|
|
|
|
|
foo = pickle.loads(data[2]);
|
|
|
|
|
|
|
|
if family == self.family.get_handle() and \
|
|
|
|
foo.get_handle() in self.elist:
|
2004-08-07 08:41:04 +05:30
|
|
|
self.move_element(self.elist,self.etree.get_selected_row(),
|
|
|
|
row)
|
2003-01-13 09:29:10 +05:30
|
|
|
else:
|
2004-02-14 11:10:30 +05:30
|
|
|
for src in foo.get_source_references():
|
2004-07-28 07:59:07 +05:30
|
|
|
base_handle = src.get_base_handle()
|
2004-08-07 10:46:57 +05:30
|
|
|
newbase = self.db.get_source_from_handle(base_handle)
|
2005-03-29 18:46:24 +05:30
|
|
|
src.set_base_handle(newbase.get_handle())
|
2004-07-28 07:59:07 +05:30
|
|
|
place = foo.get_place_handle()
|
2003-01-13 09:29:10 +05:30
|
|
|
if place:
|
2005-03-29 18:46:24 +05:30
|
|
|
foo.set_place_handle(
|
|
|
|
self.db.get_place_from_handle(place.get_handle()).get_handle())
|
|
|
|
self.elist.insert(row,foo.get_handle())
|
2003-01-13 09:29:10 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.lists_changed = 1
|
|
|
|
self.redraw_event_list()
|
|
|
|
|
|
|
|
def ev_source_drag_data_get(self,widget, context, selection_data, info, time):
|
2003-01-13 09:29:10 +05:30
|
|
|
ev = self.etree.get_selected_objects()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
bits_per = 8; # we're going to pass a string
|
2003-01-13 09:29:10 +05:30
|
|
|
pickled = pickle.dumps(ev[0]);
|
2005-03-29 18:46:24 +05:30
|
|
|
data = str((DdTargets.FAMILY_EVENT.drag_type,
|
|
|
|
self.family.get_handle(),pickled));
|
2002-10-20 19:55:16 +05:30
|
|
|
selection_data.set(selection_data.target, bits_per, data)
|
|
|
|
|
|
|
|
def at_dest_drag_data_received(self,widget,context,x,y,selection_data,info,time):
|
2003-01-13 09:29:10 +05:30
|
|
|
row = self.atree.get_row_at(x,y)
|
2002-10-20 19:55:16 +05:30
|
|
|
if selection_data and selection_data.data:
|
|
|
|
exec 'data = %s' % selection_data.data
|
|
|
|
exec 'mytype = "%s"' % data[0]
|
|
|
|
exec 'family = "%s"' % data[1]
|
2005-03-29 18:46:24 +05:30
|
|
|
|
|
|
|
if mytype != DdTargets.FAMILY_ATTRIBUTE.drag_type:
|
2002-10-20 19:55:16 +05:30
|
|
|
return
|
2005-03-29 18:46:24 +05:30
|
|
|
|
|
|
|
foo = pickle.loads(data[2]);
|
|
|
|
|
|
|
|
if family == self.family.get_handle() and \
|
|
|
|
foo in self.alist:
|
|
|
|
self.move_element(self.alist,self.atree.get_selected_row(),row)
|
2003-01-13 09:29:10 +05:30
|
|
|
else:
|
|
|
|
foo = pickle.loads(data[2]);
|
2004-02-14 11:10:30 +05:30
|
|
|
for src in foo.get_source_references():
|
2004-07-28 07:59:07 +05:30
|
|
|
base_handle = src.get_base_handle()
|
2004-08-07 10:46:57 +05:30
|
|
|
newbase = self.db.get_source_from_handle(base_handle)
|
2005-03-29 18:46:24 +05:30
|
|
|
src.set_base_handle(newbase.get_handle())
|
2003-01-13 09:29:10 +05:30
|
|
|
self.alist.insert(row,foo)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.lists_changed = 1
|
|
|
|
self.redraw_attr_list()
|
|
|
|
|
|
|
|
def at_source_drag_data_get(self,widget, context, selection_data, info, time):
|
2003-01-13 09:29:10 +05:30
|
|
|
ev = self.atree.get_selected_objects()
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
bits_per = 8; # we're going to pass a string
|
2003-01-13 09:29:10 +05:30
|
|
|
pickled = pickle.dumps(ev[0]);
|
2005-03-29 18:46:24 +05:30
|
|
|
data = str((DdTargets.FAMILY_ATTRIBUTE.drag_type,
|
|
|
|
self.family.get_handle(),pickled));
|
2002-10-20 19:55:16 +05:30
|
|
|
selection_data.set(selection_data.target, bits_per, data)
|
|
|
|
|
|
|
|
def update_lists(self):
|
2004-02-14 11:10:30 +05:30
|
|
|
self.family.set_event_list(self.elist)
|
|
|
|
self.family.set_attribute_list(self.alist)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-06-11 08:24:57 +05:30
|
|
|
def attr_edit_callback(self,attr):
|
|
|
|
self.redraw_attr_list()
|
|
|
|
self.atree.select_iter(self.amap[str(attr)])
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def redraw_attr_list(self):
|
2002-11-25 10:00:36 +05:30
|
|
|
self.atree.clear()
|
2003-06-11 08:24:57 +05:30
|
|
|
self.amap = {}
|
2002-11-25 10:00:36 +05:30
|
|
|
for attr in self.alist:
|
2004-02-14 11:10:30 +05:30
|
|
|
d = [const.display_fattr(attr.get_type()),attr.get_value()]
|
2004-08-23 04:46:57 +05:30
|
|
|
node = self.atree.add(d,attr)
|
|
|
|
self.amap[str(attr)] = node
|
2002-12-14 10:37:09 +05:30
|
|
|
if self.alist:
|
|
|
|
self.atree.select_row(0)
|
2003-11-13 00:15:07 +05:30
|
|
|
Utils.bold_label(self.attr_label)
|
|
|
|
else:
|
|
|
|
Utils.unbold_label(self.attr_label)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def redraw_event_list(self):
|
2002-11-25 10:00:36 +05:30
|
|
|
self.etree.clear()
|
2003-06-11 08:24:57 +05:30
|
|
|
self.emap = {}
|
2004-07-28 07:59:07 +05:30
|
|
|
for event_handle in self.elist:
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
event = self.db.get_event_from_handle(event_handle)
|
2004-02-29 05:38:12 +05:30
|
|
|
if not event:
|
|
|
|
continue
|
2004-07-28 07:59:07 +05:30
|
|
|
place_handle = event.get_place_handle()
|
2004-02-19 10:35:43 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
if place_handle:
|
2004-08-07 10:46:57 +05:30
|
|
|
place_name = self.db.get_place_from_handle(place_handle).get_title()
|
2004-02-15 08:03:44 +05:30
|
|
|
else:
|
|
|
|
place_name = ""
|
2004-08-23 04:46:57 +05:30
|
|
|
node = self.etree.add([const.display_fevent(event.get_name()),
|
2004-02-29 05:38:12 +05:30
|
|
|
event.get_quote_date(),place_name],event)
|
2004-08-23 04:46:57 +05:30
|
|
|
self.emap[str(event)] = node
|
2002-12-14 10:37:09 +05:30
|
|
|
if self.elist:
|
|
|
|
self.etree.select_row(0)
|
2003-11-13 00:15:07 +05:30
|
|
|
Utils.bold_label(self.events_label)
|
|
|
|
else:
|
|
|
|
Utils.unbold_label(self.events_label)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def get_widget(self,name):
|
|
|
|
return self.top.get_widget(name)
|
|
|
|
|
|
|
|
def did_data_change(self):
|
|
|
|
changed = 0
|
2004-07-31 00:26:49 +05:30
|
|
|
if self.type_field.get_active() != self.family.get_relationship():
|
2002-10-20 19:55:16 +05:30
|
|
|
changed = 1
|
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
if self.complete.get_active() != self.family.get_complete_flag():
|
2003-10-29 10:34:43 +05:30
|
|
|
changed = 1
|
|
|
|
|
2003-12-17 21:36:36 +05:30
|
|
|
text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(),
|
2005-02-24 05:55:34 +05:30
|
|
|
self.notes_buffer.get_end_iter(),False))
|
2003-12-16 06:07:47 +05:30
|
|
|
format = self.preform.get_active()
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if text != self.family.get_note():
|
2002-10-20 19:55:16 +05:30
|
|
|
changed = 1
|
2004-02-14 11:10:30 +05:30
|
|
|
if format != self.family.get_note_format():
|
2003-12-16 06:07:47 +05:30
|
|
|
changed = 1
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
if self.lists_changed:
|
|
|
|
changed = 1
|
|
|
|
|
2003-12-17 10:53:16 +05:30
|
|
|
idval = unicode(self.gid.get_text())
|
2004-08-27 03:24:14 +05:30
|
|
|
if idval == "":
|
|
|
|
idval = None
|
2005-03-09 21:55:15 +05:30
|
|
|
if self.family.get_gramps_id() != idval:
|
2002-10-20 19:55:16 +05:30
|
|
|
changed = 1
|
|
|
|
|
2003-12-17 10:53:16 +05:30
|
|
|
date = unicode(self.lds_date.get_text())
|
2005-03-03 07:12:17 +05:30
|
|
|
try:
|
|
|
|
temple = _temple_names[self.lds_temple.get_active()]
|
|
|
|
except:
|
2002-10-20 19:55:16 +05:30
|
|
|
temple = ""
|
|
|
|
|
2004-04-04 10:09:52 +05:30
|
|
|
place = self.get_place(0)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-08-23 04:46:57 +05:30
|
|
|
lds_ord = self.family.get_lds_sealing()
|
|
|
|
if not lds_ord:
|
2002-10-20 19:55:16 +05:30
|
|
|
if date or temple or place or self.seal_stat:
|
|
|
|
changed = 1
|
|
|
|
else:
|
2004-10-04 02:34:54 +05:30
|
|
|
d = self.dp.parse(date)
|
|
|
|
if d.is_equal(lds_ord.get_date_object()) or \
|
2004-08-23 04:46:57 +05:30
|
|
|
lds_ord.get_temple() != temple or \
|
|
|
|
(place and lds_ord.get_place_handle() != place.get_handle()) or \
|
|
|
|
lds_ord.get_status() != self.seal_stat:
|
2002-10-20 19:55:16 +05:30
|
|
|
changed = 1
|
|
|
|
|
|
|
|
return changed
|
|
|
|
|
|
|
|
def cancel_callback(self):
|
2005-04-05 10:03:11 +05:30
|
|
|
self.close()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_cancel_edit(self,obj):
|
2005-01-06 22:58:31 +05:30
|
|
|
if self.did_data_change() and not GrampsKeys.get_dont_ask():
|
2003-03-08 11:29:20 +05:30
|
|
|
SaveDialog(_('Save Changes?'),
|
2003-02-24 10:21:57 +05:30
|
|
|
_('If you close without saving, the changes you '
|
|
|
|
'have made will be lost'),
|
|
|
|
self.cancel_callback,
|
|
|
|
self.save)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-04-05 10:03:11 +05:30
|
|
|
self.close()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-08-20 07:50:06 +05:30
|
|
|
def save(self):
|
|
|
|
self.on_close_marriage_editor(None)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def on_delete_event(self,obj,b):
|
2005-04-05 10:03:11 +05:30
|
|
|
if self.did_data_change() and not GrampsKeys.get_dont_ask():
|
|
|
|
SaveDialog(_('Save Changes?'),
|
|
|
|
_('If you close without saving, the changes you '
|
|
|
|
'have made will be lost'),
|
|
|
|
self.cancel_callback,
|
|
|
|
self.save)
|
|
|
|
return True
|
|
|
|
else:
|
|
|
|
self.close()
|
|
|
|
return False
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-04-04 10:09:52 +05:30
|
|
|
def on_close_marriage_editor(self,*obj):
|
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
trans = self.db.transaction_begin()
|
2004-04-04 10:09:52 +05:30
|
|
|
|
2003-12-17 10:53:16 +05:30
|
|
|
idval = unicode(self.gid.get_text())
|
2002-10-20 19:55:16 +05:30
|
|
|
family = self.family
|
2004-08-20 07:50:06 +05:30
|
|
|
if idval != family.get_gramps_id():
|
|
|
|
if not self.db.get_family_from_gramps_id(idval):
|
|
|
|
family.set_gramps_id(idval)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2003-02-27 06:07:46 +05:30
|
|
|
WarningDialog(_("GRAMPS ID value was not changed."),
|
|
|
|
_('The GRAMPS ID that you chose for this '
|
|
|
|
'relationship is already being used.'))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-07-31 00:26:49 +05:30
|
|
|
relation = self.type_field.get_active()
|
2004-07-28 07:59:07 +05:30
|
|
|
father = self.family.get_father_handle()
|
|
|
|
mother = self.family.get_mother_handle()
|
2002-10-20 19:55:16 +05:30
|
|
|
if father and mother:
|
2004-07-31 00:26:49 +05:30
|
|
|
if relation != self.family.get_relationship():
|
|
|
|
self.family.set_relationship(relation)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-12-17 21:36:36 +05:30
|
|
|
text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(),
|
2005-02-24 05:55:34 +05:30
|
|
|
self.notes_buffer.get_end_iter(),False))
|
2004-02-14 11:10:30 +05:30
|
|
|
if text != self.family.get_note():
|
|
|
|
self.family.set_note(text)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-12-16 06:07:47 +05:30
|
|
|
format = self.preform.get_active()
|
2004-02-14 11:10:30 +05:30
|
|
|
if format != self.family.get_note_format():
|
|
|
|
self.family.set_note_format(format)
|
2003-12-16 06:07:47 +05:30
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
if self.complete.get_active() != self.family.get_complete_flag():
|
|
|
|
self.family.set_complete_flag(self.complete.get_active())
|
2003-10-29 10:34:43 +05:30
|
|
|
|
2003-12-17 10:53:16 +05:30
|
|
|
date = unicode(self.lds_date.get_text())
|
2005-03-03 07:12:17 +05:30
|
|
|
try:
|
|
|
|
temple = _temple_names[self.lds_temple.get_active()]
|
|
|
|
except:
|
2002-10-20 19:55:16 +05:30
|
|
|
temple = ""
|
2004-04-04 10:09:52 +05:30
|
|
|
place = self.get_place(1,trans)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-08-23 04:46:57 +05:30
|
|
|
lds_ord = self.family.get_lds_sealing()
|
|
|
|
if not lds_ord:
|
2002-10-20 19:55:16 +05:30
|
|
|
if date or temple or place or self.seal_stat:
|
2004-08-23 04:46:57 +05:30
|
|
|
lds_ord = RelLib.LdsOrd()
|
|
|
|
lds_ord.set_date(date)
|
2005-03-03 07:12:17 +05:30
|
|
|
temple_code = const.lds_temple_codes.get(temple,"")
|
|
|
|
lds_ord.set_temple(temple_code)
|
2004-08-23 04:46:57 +05:30
|
|
|
lds_ord.set_status(self.seal_stat)
|
|
|
|
lds_ord.set_place_handle(place)
|
|
|
|
self.family.set_lds_sealing(lds_ord)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-10-04 02:34:54 +05:30
|
|
|
d = self.dp.parse(date)
|
|
|
|
if d.is_equal(lds_ord.get_date_object()):
|
2004-08-23 04:46:57 +05:30
|
|
|
lds_ord.set_date_object(d)
|
2005-03-03 07:12:17 +05:30
|
|
|
temple_code = const.lds_temple_codes.get(temple,"")
|
|
|
|
if lds_ord.get_temple() != temple_code:
|
|
|
|
lds_ord.set_temple(temple_code)
|
2004-08-23 04:46:57 +05:30
|
|
|
if lds_ord.get_status() != self.seal_stat:
|
|
|
|
lds_ord.set_status(self.seal_stat)
|
2005-03-03 07:12:17 +05:30
|
|
|
if place and lds_ord.get_place_handle() != place.get_handle():
|
2004-08-23 04:46:57 +05:30
|
|
|
lds_ord.set_place_handle(place.get_handle())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-10-29 10:34:43 +05:30
|
|
|
if self.lists_changed:
|
2004-02-14 11:10:30 +05:30
|
|
|
self.family.set_source_reference_list(self.srcreflist)
|
2003-10-29 10:34:43 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.update_lists()
|
2004-03-30 10:20:24 +05:30
|
|
|
self.db.commit_family(self.family,trans)
|
2004-08-13 10:04:07 +05:30
|
|
|
self.db.transaction_commit(trans,_("Edit Marriage"))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-04-05 10:03:11 +05:30
|
|
|
self.close()
|
2004-02-23 10:11:37 +05:30
|
|
|
|
2003-06-11 08:24:57 +05:30
|
|
|
def event_edit_callback(self,event):
|
|
|
|
"""Birth and death events may not be in the map"""
|
|
|
|
self.redraw_event_list()
|
|
|
|
try:
|
|
|
|
self.etree.select_iter(self.emap[str(event)])
|
|
|
|
except:
|
|
|
|
pass
|
|
|
|
|
2004-04-17 00:45:02 +05:30
|
|
|
def on_add_clicked(self,*obj):
|
2002-10-20 19:55:16 +05:30
|
|
|
import EventEdit
|
2004-02-23 10:11:37 +05:30
|
|
|
name = Utils.family_name(self.family,self.db)
|
2005-04-01 11:03:22 +05:30
|
|
|
EventEdit.EventEditor(
|
|
|
|
self,name, const.marriageEvents, const.family_events,
|
|
|
|
None, None, 0, self.event_edit_callback,
|
|
|
|
const.defaultMarriageEvent, self.db.readonly)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-05-08 23:08:49 +05:30
|
|
|
def on_event_update_clicked(self,obj):
|
2002-10-20 19:55:16 +05:30
|
|
|
import EventEdit
|
2004-08-23 04:46:57 +05:30
|
|
|
model,node = self.etree.get_selected()
|
|
|
|
if not node:
|
2002-10-20 19:55:16 +05:30
|
|
|
return
|
2004-08-23 04:46:57 +05:30
|
|
|
event = self.etree.get_object(node)
|
2004-02-23 10:11:37 +05:30
|
|
|
name = Utils.family_name(self.family,self.db)
|
2005-04-01 11:03:22 +05:30
|
|
|
EventEdit.EventEditor(
|
|
|
|
self, name, const.marriageEvents, const.family_events,event,
|
|
|
|
None, 0,self.event_edit_callback, None, self.db.readonly)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_delete_clicked(self,obj):
|
|
|
|
if Utils.delete_selected(obj,self.elist):
|
|
|
|
self.lists_changed = 1
|
|
|
|
self.redraw_event_list()
|
|
|
|
|
2002-11-21 10:11:40 +05:30
|
|
|
def on_select_row(self,obj):
|
|
|
|
|
2004-08-23 04:46:57 +05:30
|
|
|
model,node = self.etree.get_selected()
|
|
|
|
if not node:
|
2002-11-21 10:11:40 +05:30
|
|
|
return
|
2004-08-23 04:46:57 +05:30
|
|
|
event = self.etree.get_object(node)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
self.date_field.set_text(event.get_date())
|
2004-07-28 07:59:07 +05:30
|
|
|
place_handle = event.get_place_handle()
|
|
|
|
if place_handle:
|
2004-08-07 10:46:57 +05:30
|
|
|
place_name = self.db.get_place_from_handle(place_handle).get_title()
|
2004-02-15 08:03:44 +05:30
|
|
|
else:
|
|
|
|
place_name = u""
|
|
|
|
self.place_field.set_text(place_name)
|
2004-02-14 11:10:30 +05:30
|
|
|
self.cause_field.set_text(event.get_cause())
|
|
|
|
self.name_field.set_label(const.display_fevent(event.get_name()))
|
|
|
|
if len(event.get_source_references()) > 0:
|
2004-02-23 10:11:37 +05:30
|
|
|
psrc_ref = event.get_source_references()[0]
|
2004-07-28 07:59:07 +05:30
|
|
|
psrc_id = psrc_ref.get_base_handle()
|
2004-08-07 10:46:57 +05:30
|
|
|
psrc = self.db.get_source_from_handle(psrc_id)
|
2004-02-23 10:11:37 +05:30
|
|
|
self.event_src_field.set_text(psrc.get_title())
|
|
|
|
self.event_conf_field.set_text(const.confidence[psrc_ref.get_confidence_level()])
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
self.event_src_field.set_text('')
|
|
|
|
self.event_conf_field.set_text('')
|
2004-02-14 11:10:30 +05:30
|
|
|
self.descr_field.set_text(event.get_description())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2002-11-21 10:11:40 +05:30
|
|
|
def on_attr_list_select_row(self,obj):
|
2004-08-23 04:46:57 +05:30
|
|
|
model,node = self.atree.get_selected()
|
|
|
|
if not node:
|
2002-11-21 10:11:40 +05:30
|
|
|
return
|
2004-08-23 04:46:57 +05:30
|
|
|
attr = self.atree.get_object(node)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
self.attr_type.set_label(const.display_fattr(attr.get_type()))
|
|
|
|
self.attr_value.set_text(attr.get_value())
|
|
|
|
if len(attr.get_source_references()) > 0:
|
2004-02-23 10:11:37 +05:30
|
|
|
psrc_ref = attr.get_source_references()[0]
|
2004-07-28 07:59:07 +05:30
|
|
|
psrc_id = psrc_ref.get_base_handle()
|
2004-08-07 10:46:57 +05:30
|
|
|
psrc = self.db.get_source_from_handle(psrc_id)
|
2004-02-23 10:11:37 +05:30
|
|
|
self.attr_src_field.set_text(psrc.get_title())
|
|
|
|
self.attr_conf_field.set_text(const.confidence[psrc_ref.get_confidence_level()])
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
self.attr_src_field.set_text('')
|
|
|
|
self.attr_conf_field.set_text('')
|
|
|
|
|
|
|
|
def on_update_attr_clicked(self,obj):
|
|
|
|
import AttrEdit
|
2004-08-23 04:46:57 +05:30
|
|
|
model,node = self.atree.get_selected()
|
|
|
|
if not node:
|
2002-11-21 10:11:40 +05:30
|
|
|
return
|
|
|
|
|
2004-08-23 04:46:57 +05:30
|
|
|
attr = self.atree.get_object(node)
|
2002-11-21 10:11:40 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
father_handle = self.family.get_father_handle()
|
|
|
|
mother_handle = self.family.get_mother_handle()
|
2004-08-07 10:46:57 +05:30
|
|
|
father = self.db.get_person_from_handle(father_handle)
|
|
|
|
mother = self.db.get_person_from_handle(mother_handle)
|
2002-11-21 10:11:40 +05:30
|
|
|
if father and mother:
|
2005-01-01 09:57:15 +05:30
|
|
|
name = _("%s and %s") % (
|
|
|
|
NameDisplay.displayer.display(father),
|
|
|
|
NameDisplay.displayer.display(mother))
|
2002-11-21 10:11:40 +05:30
|
|
|
elif father:
|
2005-01-01 09:57:15 +05:30
|
|
|
name = NameDisplay.displayer.display(father)
|
2002-11-21 10:11:40 +05:30
|
|
|
else:
|
2005-01-01 09:57:15 +05:30
|
|
|
name = NameDisplay.displayer.display(mother)
|
2005-02-27 11:21:59 +05:30
|
|
|
AttrEdit.AttributeEditor(
|
|
|
|
self, attr, name, const.familyAttributes,
|
2005-04-02 11:42:46 +05:30
|
|
|
self.attr_edit_callback, self.window)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_delete_attr_clicked(self,obj):
|
|
|
|
if Utils.delete_selected(obj,self.alist):
|
|
|
|
self.lists_changed = 1
|
|
|
|
self.redraw_attr_list()
|
|
|
|
|
|
|
|
def on_add_attr_clicked(self,obj):
|
|
|
|
import AttrEdit
|
2004-07-28 07:59:07 +05:30
|
|
|
father_handle = self.family.get_father_handle()
|
|
|
|
mother_handle = self.family.get_mother_handle()
|
2004-08-07 10:46:57 +05:30
|
|
|
father = self.db.get_person_from_handle(father_handle)
|
|
|
|
mother = self.db.get_person_from_handle(mother_handle)
|
2002-10-20 19:55:16 +05:30
|
|
|
if father and mother:
|
2005-01-01 09:57:15 +05:30
|
|
|
name = _("%s and %s") % (
|
|
|
|
NameDisplay.displayer.display(father),
|
|
|
|
NameDisplay.displayer.display(mother))
|
2002-10-20 19:55:16 +05:30
|
|
|
elif father:
|
2005-01-01 09:57:15 +05:30
|
|
|
name = NameDisplay.displayer.display(father)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-01-01 09:57:15 +05:30
|
|
|
name = NameDisplay.displayer.display(mother)
|
2005-02-27 11:21:59 +05:30
|
|
|
AttrEdit.AttributeEditor(
|
|
|
|
self, None, name, const.familyAttributes,
|
2005-04-02 11:42:46 +05:30
|
|
|
self.attr_edit_callback, self.window)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-01-13 09:29:10 +05:30
|
|
|
def move_element(self,list,src,dest):
|
|
|
|
if src == -1:
|
|
|
|
return
|
|
|
|
obj = list[src]
|
|
|
|
list.remove(obj)
|
|
|
|
list.insert(dest,obj)
|
2003-11-13 00:15:07 +05:30
|
|
|
|
|
|
|
def on_switch_page(self,obj,a,page):
|
2003-12-17 21:36:36 +05:30
|
|
|
text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(),
|
2005-02-24 05:55:34 +05:30
|
|
|
self.notes_buffer.get_end_iter(),False))
|
2003-11-13 00:15:07 +05:30
|
|
|
if text:
|
|
|
|
Utils.bold_label(self.notes_label)
|
|
|
|
else:
|
|
|
|
Utils.unbold_label(self.notes_label)
|
2003-11-14 03:14:09 +05:30
|
|
|
|
2003-12-17 10:53:16 +05:30
|
|
|
date = unicode(self.lds_date.get_text())
|
2005-03-03 07:12:17 +05:30
|
|
|
|
|
|
|
try:
|
|
|
|
temple = _temple_names[self.lds_temple.get_active()]
|
|
|
|
except:
|
2003-11-14 03:14:09 +05:30
|
|
|
temple = ""
|
|
|
|
|
2004-06-12 10:09:45 +05:30
|
|
|
if date or temple:
|
2003-11-14 03:14:09 +05:30
|
|
|
Utils.bold_label(self.lds_label)
|
|
|
|
else:
|
|
|
|
Utils.unbold_label(self.lds_label)
|
|
|
|
|
2004-04-04 10:09:52 +05:30
|
|
|
def get_place(self,makenew,trans=None):
|
2004-08-07 08:41:04 +05:30
|
|
|
field = self.lds_place.child
|
2005-03-03 20:30:55 +05:30
|
|
|
text = unicode(field.get_text()).strip()
|
2003-11-14 03:14:09 +05:30
|
|
|
if text:
|
|
|
|
if self.pmap.has_key(text):
|
2004-08-07 10:46:57 +05:30
|
|
|
return self.db.get_place_from_handle(self.pmap[text])
|
2003-11-14 03:14:09 +05:30
|
|
|
elif makenew:
|
|
|
|
place = RelLib.Place()
|
|
|
|
place.set_title(text)
|
2004-04-04 10:09:52 +05:30
|
|
|
self.db.add_place(place,trans)
|
2004-07-28 07:59:07 +05:30
|
|
|
self.pmap[text] = place.get_handle()
|
2003-11-14 03:14:09 +05:30
|
|
|
return place
|
|
|
|
else:
|
|
|
|
return None
|
|
|
|
else:
|
|
|
|
return None
|