2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2005-01-19 08:54:33 +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 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
|
|
|
|
#
|
|
|
|
|
2003-10-20 08:17:03 +05:30
|
|
|
# $Id$
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Standard python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2005-04-01 19:09:34 +05:30
|
|
|
import cPickle as pickle
|
2004-10-09 07:05:58 +05:30
|
|
|
import os
|
2005-03-14 03:40:40 +05:30
|
|
|
import locale
|
2005-03-08 22:48:33 +05:30
|
|
|
from gettext import gettext as _
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GTK/Gnome modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import gtk
|
|
|
|
import gtk.glade
|
2004-05-02 09:40:33 +05:30
|
|
|
import gobject
|
2003-03-03 10:02:53 +05:30
|
|
|
import gnome
|
2002-11-15 09:19:39 +05:30
|
|
|
from gtk.gdk import ACTION_COPY, BUTTON1_MASK, INTERP_BILINEAR, pixbuf_new_from_file
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import const
|
|
|
|
import Utils
|
2005-01-06 22:58:31 +05:30
|
|
|
import GrampsKeys
|
2004-11-29 08:54:02 +05:30
|
|
|
import GrampsMime
|
2002-10-20 19:55:16 +05:30
|
|
|
import ImageSelect
|
|
|
|
import AutoComp
|
2002-11-21 10:11:40 +05:30
|
|
|
import ListModel
|
2003-01-10 10:51:32 +05:30
|
|
|
import RelLib
|
2003-10-29 10:34:43 +05:30
|
|
|
import Sources
|
2003-10-30 09:47:05 +05:30
|
|
|
import DateEdit
|
2004-09-19 20:47:57 +05:30
|
|
|
import Date
|
2004-09-17 09:00:04 +05:30
|
|
|
import DateHandler
|
2004-06-23 10:24:33 +05:30
|
|
|
import TransTable
|
2005-01-01 09:57:15 +05:30
|
|
|
import NameDisplay
|
2003-10-30 09:47:05 +05:30
|
|
|
|
2005-04-04 06:41:50 +05:30
|
|
|
from QuestionDialog import WarningDialog, ErrorDialog, SaveDialog, QuestionDialog2
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-03-26 02:35:09 +05:30
|
|
|
from DdTargets import DdTargets
|
|
|
|
|
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Constants
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
_PICTURE_WIDTH = 200.0
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
_temple_names = const.lds_temple_codes.keys()
|
|
|
|
_temple_names.sort()
|
|
|
|
_temple_names = [""] + _temple_names
|
2005-04-19 09:50:17 +05:30
|
|
|
_select_gender = ((True,False,False),(False,True,False),(False,False,True))
|
2004-10-09 07:05:58 +05:30
|
|
|
_use_patronymic = [
|
|
|
|
"ru","RU","ru_RU","koi8r","ru_koi8r","russian","Russian",
|
|
|
|
]
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# EditPerson class
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class EditPerson:
|
|
|
|
|
2004-12-01 09:45:08 +05:30
|
|
|
use_patronymic = locale.getlocale(locale.LC_TIME)[0] in _use_patronymic
|
2004-10-09 07:05:58 +05:30
|
|
|
|
2004-02-19 19:10:09 +05:30
|
|
|
def __init__(self,parent,person,db,callback=None):
|
2002-10-20 19:55:16 +05:30
|
|
|
"""Creates an edit window. Associates a person with the window."""
|
2004-02-14 11:10:30 +05:30
|
|
|
|
2005-02-27 11:21:59 +05:30
|
|
|
self.retval = const.UPDATE_PERSON
|
|
|
|
|
2004-12-29 10:36:10 +05:30
|
|
|
self.dp = DateHandler.parser
|
|
|
|
self.dd = DateHandler.displayer
|
2002-10-20 19:55:16 +05:30
|
|
|
self.person = person
|
2004-10-18 04:47:30 +05:30
|
|
|
self.orig_surname = person.get_primary_name().get_group_name()
|
2004-02-19 19:10:09 +05:30
|
|
|
self.parent = parent
|
2004-08-24 10:21:11 +05:30
|
|
|
self.orig_handle = self.person.get_handle()
|
|
|
|
if self.parent.child_windows.has_key(self.orig_handle):
|
2004-07-28 07:59:07 +05:30
|
|
|
self.parent.child_windows[self.person.get_handle()].present(None)
|
2004-02-20 06:22:24 +05:30
|
|
|
return
|
2002-10-20 19:55:16 +05:30
|
|
|
self.db = db
|
|
|
|
self.callback = callback
|
* 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-14 11:10:30 +05:30
|
|
|
self.path = db.get_save_path()
|
2004-09-20 08:42:51 +05:30
|
|
|
self.not_loaded = True
|
|
|
|
self.lds_not_loaded = True
|
|
|
|
self.lists_changed = False
|
|
|
|
self.update_birth = False
|
|
|
|
self.update_death = False
|
2003-06-13 20:38:07 +05:30
|
|
|
self.pdmap = {}
|
2002-10-20 19:55:16 +05:30
|
|
|
self.add_places = []
|
2005-01-01 09:57:15 +05:30
|
|
|
self.name_display = NameDisplay.displayer
|
2004-08-24 10:21:11 +05:30
|
|
|
self.should_guess_gender = (person.get_gramps_id() == '' and
|
2004-02-14 11:10:30 +05:30
|
|
|
person.get_gender () ==
|
2005-02-01 09:16:29 +05:30
|
|
|
RelLib.Person.UNKNOWN)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
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()
|
2003-06-13 20:38:07 +05:30
|
|
|
self.pdmap[p[0]] = key
|
2005-02-18 10:19:59 +05:30
|
|
|
|
|
|
|
mod = not self.db.readonly
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.load_obj = None
|
2005-04-23 21:23:30 +05:30
|
|
|
self.top = gtk.glade.XML(const.editPersonFile, "edit_person","gramps")
|
|
|
|
self.window = self.get_widget("edit_person")
|
* src/SourceView.py (button_press,on_add_clicked,on_delete_clicked,
on_edit_clicked): Pass parent window to the child dialog.
* src/Sources.py (add_src_clicked): Likewise.
* src/EditSource.py (__init__): Add optional parent_window argument.
Make dialog modal and transient for its parent.
* src/gramps.glade (sourceEditor dialog): Delete unneeded handlers
for buttons.
* src/QuestionDialog.py (SaveDialog,QuestionDialog,OptionDialog,
ErrorDialog,WarningDialog,MissingMediaDialog): Set transient status
if parent is given.
* src/EventEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/Witness.py: Make WittnessEditor dialog modal and transient for
its parent. Call SelectPerson with itself as a parent.
* src/SelectPerson.py (__init__): Make dialog transient for its parent.
* src/imagesel.glade: Define proper responses and delete unneeded handlers
for buttons. Make gtkFileEntry modal.
* src/dialog.glade (all dialogs): Define proper responses for buttons.
* src/EditPerson.py (on_add_aka_clicked, on_aka_update_clicked):
Call NameEdit with itself as a parent; (on_add_attr_clicked,
on_update_attr_clicked): Call AttributeEditor with itself as a parent;
(on_add_addr_clicked,on_update_addr_clicked): Call AddressEditor with
itself as a parent; (on_add_url_clicked,on_update_url_clicked): Call
UrlEditor with itself as a parent; (on_name_note_clicked,
on_ldsbap_note_clicked,on_ldsendow_note_clicked,
on_ldsseal_note_clicked): Call NoteEditor with itself as a parent.
* src/NameEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/AttrEdit.py (__init__): Likewise.
* src/AddrEdit.py (__init__): Likewise.
* src/UrlEdit.py (__init__): Likewise.
* src/NoteEdit.py (__init__): Likewise.
svn: r2131
2003-09-15 09:41:30 +05:30
|
|
|
self.window.set_title("%s - GRAMPS" % _('Edit Person'))
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.icon_list = self.top.get_widget("iconlist")
|
2005-04-19 09:50:17 +05:30
|
|
|
#self.gallery = ImageSelect.Gallery(person, self.db.commit_person,
|
|
|
|
# self.path, self.icon_list,
|
|
|
|
# self.db, self, self.window)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-12-03 09:19:39 +05:30
|
|
|
self.complete = self.get_widget('complete')
|
2005-02-18 10:19:59 +05:30
|
|
|
self.complete.set_sensitive(mod)
|
2005-04-19 09:50:17 +05:30
|
|
|
self.gender = self.get_widget('gender')
|
|
|
|
self.gender.set_sensitive(mod)
|
2005-02-20 03:41:51 +05:30
|
|
|
self.private = self.get_widget('private')
|
|
|
|
self.private.set_sensitive(mod)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.name_delete_btn = self.top.get_widget('aka_delete')
|
2003-02-28 10:19:18 +05:30
|
|
|
self.name_edit_btn = self.top.get_widget('aka_edit')
|
2002-10-20 19:55:16 +05:30
|
|
|
self.web_delete_btn = self.top.get_widget('delete_url')
|
2003-03-03 10:02:53 +05:30
|
|
|
self.web_edit_btn = self.top.get_widget('edit_url')
|
2005-02-19 08:59:56 +05:30
|
|
|
self.event_delete_btn = self.top.get_widget('event_del')
|
2005-04-19 09:50:17 +05:30
|
|
|
self.event_edit_btn = self.top.get_widget('event_edit')
|
2005-02-25 22:06:47 +05:30
|
|
|
self.attr_delete_btn = self.top.get_widget('attr_del')
|
2003-03-03 10:02:53 +05:30
|
|
|
self.attr_edit_btn = self.top.get_widget('attr_edit_btn')
|
2005-02-25 22:06:47 +05:30
|
|
|
self.addr_delete_btn = self.top.get_widget('addr_del')
|
2003-03-03 10:02:53 +05:30
|
|
|
self.addr_edit_btn = self.top.get_widget('addr_edit_btn')
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.notes_field = self.get_widget("personNotes")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.notes_field.set_editable(mod)
|
2003-12-10 19:51:48 +05:30
|
|
|
self.flowed = self.get_widget("flowed")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.flowed.set_sensitive(mod)
|
2003-12-10 19:51:48 +05:30
|
|
|
self.preform = self.get_widget("preform")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.preform.set_sensitive(mod)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.attr_conf_field = self.get_widget("attr_conf")
|
2002-11-15 09:19:39 +05:30
|
|
|
self.addr_conf_field = self.get_widget("addr_conf")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.name_conf_field = self.get_widget("name_conf")
|
|
|
|
self.attr_src_field = self.get_widget("attr_srcinfo")
|
|
|
|
self.name_src_field = self.get_widget("name_srcinfo")
|
|
|
|
self.addr_src_field = self.get_widget("addr_srcinfo")
|
|
|
|
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.web_list = self.get_widget("web_list")
|
|
|
|
self.web_url = self.get_widget("web_url")
|
|
|
|
self.web_go = self.get_widget("web_go")
|
|
|
|
self.web_description = self.get_widget("url_des")
|
|
|
|
self.addr_list = self.get_widget("address_list")
|
|
|
|
self.addr_start = self.get_widget("address_start")
|
|
|
|
self.addr_street = self.get_widget("street")
|
|
|
|
self.addr_city = self.get_widget("city")
|
|
|
|
self.addr_state = self.get_widget("state")
|
|
|
|
self.addr_country = self.get_widget("country")
|
|
|
|
self.addr_postal = self.get_widget("postal")
|
2003-12-09 11:32:36 +05:30
|
|
|
self.addr_phone = self.get_widget("phone")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.event_list = self.get_widget("eventList")
|
|
|
|
self.edit_person = self.get_widget("editPerson")
|
|
|
|
self.name_list = self.get_widget("nameList")
|
|
|
|
self.alt_given_field = self.get_widget("alt_given")
|
|
|
|
self.alt_last_field = self.get_widget("alt_last")
|
|
|
|
self.alt_title_field = self.get_widget("alt_title")
|
|
|
|
self.alt_suffix_field = self.get_widget("alt_suffix")
|
2002-12-04 10:28:07 +05:30
|
|
|
self.alt_prefix_field = self.get_widget("alt_prefix")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.name_type_field = self.get_widget("name_type")
|
|
|
|
self.ntype_field = self.get_widget("ntype")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.ntype_field.set_sensitive(mod)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.suffix = self.get_widget("suffix")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.suffix.set_editable(mod)
|
2002-12-04 10:28:07 +05:30
|
|
|
self.prefix = self.get_widget("prefix")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.prefix.set_editable(mod)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.given = self.get_widget("givenName")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.given.set_editable(mod)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.title = self.get_widget("title")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.title.set_editable(mod)
|
2004-05-02 09:40:33 +05:30
|
|
|
self.surname = self.get_widget("surname")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.surname.set_editable(mod)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.addr_note = self.get_widget("addr_note")
|
|
|
|
self.addr_source = self.get_widget("addr_source")
|
|
|
|
self.attr_note = self.get_widget("attr_note")
|
|
|
|
self.attr_source = self.get_widget("attr_source")
|
|
|
|
self.name_note = self.get_widget("name_note")
|
|
|
|
self.name_source = self.get_widget("name_source")
|
|
|
|
self.gid = self.get_widget("gid")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.gid.set_editable(mod)
|
2003-10-29 10:34:43 +05:30
|
|
|
self.slist = self.get_widget("slist")
|
2003-11-11 06:02:28 +05:30
|
|
|
self.names_label = self.get_widget("names_label")
|
|
|
|
self.attr_label = self.get_widget("attr_label")
|
|
|
|
self.addr_label = self.get_widget("addr_label")
|
|
|
|
self.notes_label = self.get_widget("notes_label")
|
|
|
|
self.sources_label = self.get_widget("sources_label")
|
2005-04-23 21:23:30 +05:30
|
|
|
self.events_label = self.get_widget("events_label")
|
2003-11-11 06:02:28 +05:30
|
|
|
self.inet_label = self.get_widget("inet_label")
|
|
|
|
self.gallery_label = self.get_widget("gallery_label")
|
|
|
|
self.lds_tab = self.get_widget("lds_tab")
|
2004-11-29 08:54:02 +05:30
|
|
|
self.person_photo = self.get_widget("personPix")
|
|
|
|
self.eventbox = self.get_widget("eventbox1")
|
|
|
|
|
2004-10-09 07:05:58 +05:30
|
|
|
self.prefix_label = self.get_widget('prefix_label')
|
|
|
|
|
|
|
|
if self.use_patronymic:
|
|
|
|
self.prefix_label.set_text(_('Patronymic:'))
|
|
|
|
self.prefix_label.set_use_underline(True)
|
|
|
|
|
2005-01-16 09:30:35 +05:30
|
|
|
birth_handle = person.get_birth_handle()
|
2005-03-14 03:40:40 +05:30
|
|
|
if birth_handle:
|
|
|
|
self.orig_birth = self.db.get_event_from_handle(birth_handle)
|
|
|
|
else:
|
|
|
|
self.orig_birth = RelLib.Event()
|
|
|
|
self.orig_birth.set_name("Birth")
|
|
|
|
|
2005-01-16 09:30:35 +05:30
|
|
|
death_handle = person.get_death_handle()
|
2005-03-14 03:40:40 +05:30
|
|
|
if death_handle:
|
|
|
|
self.orig_death = self.db.get_event_from_handle(death_handle)
|
|
|
|
else:
|
|
|
|
self.orig_death = RelLib.Event()
|
|
|
|
self.orig_death.set_name("Death")
|
|
|
|
|
2004-02-19 10:37:46 +05:30
|
|
|
self.death = RelLib.Event(self.orig_death)
|
|
|
|
self.birth = RelLib.Event(self.orig_birth)
|
2004-02-14 11:10:30 +05:30
|
|
|
self.pname = RelLib.Name(person.get_primary_name())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-04-19 09:50:17 +05:30
|
|
|
self.gender.set_active(person.get_gender())
|
|
|
|
|
|
|
|
self.elist = []
|
|
|
|
for val in [birth_handle, death_handle] + person.get_event_list():
|
|
|
|
if val:
|
|
|
|
self.elist.append(val)
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
self.nlist = person.get_alternate_names()[:]
|
|
|
|
self.alist = person.get_attribute_list()[:]
|
|
|
|
self.ulist = person.get_url_list()[:]
|
|
|
|
self.plist = person.get_address_list()[:]
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-10-29 10:34:43 +05:30
|
|
|
if person:
|
2004-02-14 11:10:30 +05:30
|
|
|
self.srcreflist = person.get_source_references()
|
2003-10-29 10:34:43 +05:30
|
|
|
else:
|
|
|
|
self.srcreflist = []
|
|
|
|
|
2005-04-23 21:23:30 +05:30
|
|
|
if self.event_list:
|
|
|
|
Utils.bold_label(self.events_label)
|
|
|
|
if self.srcreflist:
|
|
|
|
Utils.bold_label(self.sources_label)
|
|
|
|
if self.nlist:
|
|
|
|
Utils.bold_label(self.names_label)
|
|
|
|
if self.alist:
|
|
|
|
Utils.bold_label(self.attr_label)
|
|
|
|
if self.ulist:
|
|
|
|
Utils.bold_label(self.inet_label)
|
|
|
|
if self.plist:
|
|
|
|
Utils.bold_label(self.addr_label)
|
|
|
|
if self.person.get_media_list():
|
|
|
|
Utils.bold_label(self.gallery_label)
|
2003-11-11 06:02:28 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
# event display
|
2004-06-23 10:24:33 +05:30
|
|
|
|
2005-04-23 21:23:30 +05:30
|
|
|
event_default = [ 'Event', 'Description', 'Date', 'Place',
|
|
|
|
'Source', 'Note' ]
|
2004-06-23 10:24:33 +05:30
|
|
|
self.event_trans = TransTable.TransTable(event_default)
|
|
|
|
evalues = {
|
2005-04-23 21:23:30 +05:30
|
|
|
'Event' : (_('Event'),-1,125),
|
2004-06-23 10:24:33 +05:30
|
|
|
'Description' : (_('Description'),-1,150),
|
|
|
|
'Date' : (_('Date'),-1,100),
|
2005-04-23 21:23:30 +05:30
|
|
|
'Place' : (_('Place'),-1,100),
|
|
|
|
'Source' : (_(':Source'),-1,50),
|
|
|
|
'Note' : (_(':Note'),-1,50)
|
2004-06-23 10:24:33 +05:30
|
|
|
}
|
|
|
|
|
2005-02-17 04:19:54 +05:30
|
|
|
if not self.db.readonly:
|
|
|
|
values = self.db.metadata.get('event_order',event_default)
|
|
|
|
else:
|
2004-06-23 10:24:33 +05:30
|
|
|
values = event_default
|
|
|
|
|
|
|
|
etitles = []
|
|
|
|
for val in values:
|
|
|
|
etitles.append(evalues[val])
|
|
|
|
|
2002-11-21 10:11:40 +05:30
|
|
|
self.etree = ListModel.ListModel(self.event_list,etitles,
|
|
|
|
self.on_event_select_row,
|
|
|
|
self.on_event_update_clicked)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
# attribute display
|
2005-04-24 09:09:07 +05:30
|
|
|
atitles = [
|
|
|
|
(_('Attribute'),-1,200),
|
|
|
|
(_('Value'),-1,350),
|
|
|
|
(_(':Source'),-1,50),
|
|
|
|
(_(':Note'),-1,50),
|
|
|
|
]
|
2002-11-21 10:11:40 +05:30
|
|
|
self.atree = ListModel.ListModel(self.attr_list,atitles,
|
|
|
|
self.on_attr_select_row,
|
|
|
|
self.on_update_attr_clicked)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
# address display
|
2005-04-24 09:09:07 +05:30
|
|
|
ptitles = [
|
|
|
|
(_('Date'),-1,175),
|
|
|
|
(_('Address'),-1,150),
|
|
|
|
(_('City'),-1,100),
|
|
|
|
(_('State/Province'),-1,75),
|
|
|
|
(_('Country'),-1,100),
|
|
|
|
(_(':Source'),-1,50),
|
|
|
|
(_(':Note'),-1,50),
|
|
|
|
]
|
2002-11-21 10:11:40 +05:30
|
|
|
self.ptree = ListModel.ListModel(self.addr_list, ptitles,
|
|
|
|
self.on_addr_select_row,
|
|
|
|
self.on_update_addr_clicked)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
# name display
|
2005-04-24 09:09:07 +05:30
|
|
|
ntitles = [
|
|
|
|
(_('Family Name'),-1,225),
|
|
|
|
(_('Prefix'),-1,50),
|
|
|
|
(_('Given Name'),-1,200),
|
|
|
|
(_('Suffix'),-1,50),
|
|
|
|
(_('Type'),-1,100),
|
|
|
|
(_(':Source'),-1,50), (_(':Note'),-1,50),
|
|
|
|
]
|
2002-11-21 10:11:40 +05:30
|
|
|
self.ntree = ListModel.ListModel(self.name_list,ntitles,
|
|
|
|
self.on_name_select_row)
|
|
|
|
self.ntree.tree.connect('event',self.aka_double_click)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
# web display
|
2003-01-06 10:44:49 +05:30
|
|
|
wtitles = [(_('Path'),-1,250),(_('Description'),-1,100)]
|
2002-11-21 10:11:40 +05:30
|
|
|
self.wtree = ListModel.ListModel(self.web_list,wtitles,
|
|
|
|
self.on_web_select_row,
|
|
|
|
self.on_update_url_clicked)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-05-02 09:40:33 +05:30
|
|
|
self.place_list = self.pdmap.keys()
|
|
|
|
self.place_list.sort()
|
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
build_dropdown(self.surname,self.db.get_surname_list())
|
2004-08-19 09:14:10 +05:30
|
|
|
|
|
|
|
gid = person.get_gramps_id()
|
|
|
|
if gid:
|
|
|
|
self.gid.set_text(gid)
|
2004-07-09 10:01:43 +05:30
|
|
|
self.gid.set_editable(1)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
self.lds_baptism = RelLib.LdsOrd(self.person.get_lds_baptism())
|
|
|
|
self.lds_endowment = RelLib.LdsOrd(self.person.get_lds_endowment())
|
|
|
|
self.lds_sealing = RelLib.LdsOrd(self.person.get_lds_sealing())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-04-23 21:23:30 +05:30
|
|
|
self.get_widget("lds_tab").show()
|
|
|
|
self.get_widget("lds_page").show()
|
|
|
|
if (not self.lds_baptism.is_empty()) \
|
|
|
|
or (not self.lds_endowment.is_empty()) \
|
|
|
|
or (not self.lds_sealing.is_empty()):
|
|
|
|
Utils.bold_label(self.lds_tab)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-01-21 05:00:15 +05:30
|
|
|
types = const.NameTypesMap.get_values()
|
2002-10-20 19:55:16 +05:30
|
|
|
types.sort()
|
2004-08-04 10:23:29 +05:30
|
|
|
AutoComp.fill_combo(self.ntype_field,types)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.write_primary_name()
|
|
|
|
|
|
|
|
self.load_person_image()
|
|
|
|
|
|
|
|
# set notes data
|
|
|
|
self.notes_buffer = self.notes_field.get_buffer()
|
2004-02-14 11:10:30 +05:30
|
|
|
if person.get_note():
|
|
|
|
self.notes_buffer.set_text(person.get_note())
|
|
|
|
if person.get_note_object().get_format() == 1:
|
2003-12-10 19:51:48 +05:30
|
|
|
self.preform.set_active(1)
|
|
|
|
else:
|
|
|
|
self.flowed.set_active(1)
|
2005-04-23 21:23:30 +05:30
|
|
|
Utils.bold_label(self.notes_label)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-04-01 19:52:26 +05:30
|
|
|
self.name_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
|
|
|
|
[DdTargets.NAME.target()],
|
|
|
|
ACTION_COPY)
|
|
|
|
self.name_list.drag_source_set(BUTTON1_MASK,
|
|
|
|
[DdTargets.NAME.target()],
|
|
|
|
ACTION_COPY)
|
|
|
|
self.name_list.connect('drag_data_get', self.name_drag_data_get)
|
|
|
|
self.name_list.connect('drag_begin', self.name_drag_begin)
|
|
|
|
self.name_list.connect('drag_data_received',
|
|
|
|
self.name_drag_data_received)
|
|
|
|
|
2005-03-26 02:35:09 +05:30
|
|
|
self.event_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
|
|
|
|
[DdTargets.EVENT.target()],
|
2004-06-23 10:24:33 +05:30
|
|
|
ACTION_COPY)
|
2005-03-26 02:35:09 +05:30
|
|
|
self.event_list.drag_source_set(BUTTON1_MASK,
|
|
|
|
[DdTargets.EVENT.target()],
|
|
|
|
ACTION_COPY)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.event_list.connect('drag_data_get', self.ev_drag_data_get)
|
2003-01-06 10:44:49 +05:30
|
|
|
self.event_list.connect('drag_begin', self.ev_drag_begin)
|
2004-06-23 10:24:33 +05:30
|
|
|
self.event_list.connect('drag_data_received',
|
|
|
|
self.ev_drag_data_received)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-03-26 02:35:09 +05:30
|
|
|
self.web_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
|
|
|
|
[DdTargets.URL.target()],
|
2004-06-23 10:24:33 +05:30
|
|
|
ACTION_COPY)
|
2005-03-26 02:35:09 +05:30
|
|
|
self.web_list.drag_source_set(BUTTON1_MASK,
|
|
|
|
[DdTargets.URL.target()],
|
|
|
|
ACTION_COPY)
|
2002-11-15 09:19:39 +05:30
|
|
|
self.web_list.connect('drag_data_get', self.url_drag_data_get)
|
2003-01-08 11:11:35 +05:30
|
|
|
self.web_list.connect('drag_begin', self.url_drag_begin)
|
2003-01-10 10:51:32 +05:30
|
|
|
self.web_list.connect('drag_data_received',self.url_drag_data_received)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-03-26 02:35:09 +05:30
|
|
|
self.attr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
|
|
|
|
[DdTargets.ATTRIBUTE.target()],
|
|
|
|
ACTION_COPY)
|
|
|
|
self.attr_list.drag_source_set(BUTTON1_MASK,
|
|
|
|
[DdTargets.ATTRIBUTE.target()],
|
|
|
|
ACTION_COPY)
|
2002-11-15 09:19:39 +05:30
|
|
|
self.attr_list.connect('drag_data_get', self.at_drag_data_get)
|
2003-01-10 10:51:32 +05:30
|
|
|
self.attr_list.connect('drag_data_received',self.at_drag_data_received)
|
2003-01-08 11:11:35 +05:30
|
|
|
self.attr_list.connect('drag_begin', self.at_drag_begin)
|
2002-11-15 09:19:39 +05:30
|
|
|
|
2005-03-26 02:35:09 +05:30
|
|
|
self.addr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
|
|
|
|
[DdTargets.ADDRESS.target()],
|
|
|
|
ACTION_COPY)
|
|
|
|
self.addr_list.drag_source_set(BUTTON1_MASK,
|
|
|
|
[DdTargets.ADDRESS.target()],
|
|
|
|
ACTION_COPY)
|
2002-11-15 09:19:39 +05:30
|
|
|
self.addr_list.connect('drag_data_get', self.ad_drag_data_get)
|
2003-01-10 10:51:32 +05:30
|
|
|
self.addr_list.connect('drag_data_received',self.ad_drag_data_received)
|
2003-01-13 09:29:10 +05:30
|
|
|
self.addr_list.connect('drag_begin', self.ad_drag_begin)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-01-02 10:01:52 +05:30
|
|
|
self.top.signal_autoconnect({
|
|
|
|
"destroy_passed_object" : self.on_cancel_edit,
|
|
|
|
"on_up_clicked" : self.on_up_clicked,
|
|
|
|
"on_down_clicked" : self.on_down_clicked,
|
|
|
|
"on_add_address_clicked" : self.on_add_addr_clicked,
|
|
|
|
"on_add_aka_clicked" : self.on_add_aka_clicked,
|
|
|
|
"on_add_attr_clicked" : self.on_add_attr_clicked,
|
|
|
|
"on_add_url_clicked" : self.on_add_url_clicked,
|
2005-04-19 09:50:17 +05:30
|
|
|
# "on_addphoto_clicked" : self.gallery.on_add_media_clicked,
|
|
|
|
# "on_selectphoto_clicked" : self.gallery.on_select_media_clicked,
|
2003-01-02 10:01:52 +05:30
|
|
|
"on_aka_delete_clicked" : self.on_aka_delete_clicked,
|
|
|
|
"on_aka_update_clicked" : self.on_aka_update_clicked,
|
|
|
|
"on_apply_person_clicked" : self.on_apply_person_clicked,
|
|
|
|
"on_edit_birth_clicked" : self.on_edit_birth_clicked,
|
|
|
|
"on_edit_death_clicked" : self.on_edit_death_clicked,
|
|
|
|
"on_delete_address_clicked" : self.on_delete_addr_clicked,
|
|
|
|
"on_delete_attr_clicked" : self.on_delete_attr_clicked,
|
|
|
|
"on_delete_event" : self.on_delete_event,
|
|
|
|
"on_delete_url_clicked" : self.on_delete_url_clicked,
|
2005-04-19 09:50:17 +05:30
|
|
|
# "on_deletephoto_clicked" : self.gallery.on_delete_media_clicked,
|
|
|
|
# "on_edit_properties_clicked": self.gallery.popup_change_description,
|
|
|
|
# "on_editphoto_clicked" : self.gallery.on_edit_media_clicked,
|
2003-01-02 10:01:52 +05:30
|
|
|
"on_editperson_switch_page" : self.on_switch_page,
|
|
|
|
"on_event_add_clicked" : self.on_event_add_clicked,
|
|
|
|
"on_event_delete_clicked" : self.on_event_delete_clicked,
|
|
|
|
"on_event_update_clicked" : self.on_event_update_clicked,
|
2004-09-29 07:36:46 +05:30
|
|
|
"on_edit_name_clicked" : self.on_edit_name_clicked,
|
2003-01-02 10:01:52 +05:30
|
|
|
"on_ldsbap_note_clicked" : self.on_ldsbap_note_clicked,
|
|
|
|
"on_ldsendow_note_clicked" : self.on_ldsendow_note_clicked,
|
|
|
|
"on_ldsseal_note_clicked" : self.on_ldsseal_note_clicked,
|
|
|
|
"on_ldsbap_src_clicked" : self.on_ldsbap_source_clicked,
|
|
|
|
"on_ldsendow_src_clicked" : self.on_ldsendow_source_clicked,
|
|
|
|
"on_ldsseal_src_clicked" : self.on_ldsseal_source_clicked,
|
|
|
|
"on_update_address_clicked" : self.on_update_addr_clicked,
|
|
|
|
"on_update_attr_clicked" : self.on_update_attr_clicked,
|
|
|
|
"on_update_url_clicked" : self.on_update_url_clicked,
|
|
|
|
"on_web_go_clicked" : self.on_web_go_clicked,
|
2003-06-24 19:46:47 +05:30
|
|
|
"on_gender_activate" : self.on_gender_activate,
|
2004-10-01 00:02:56 +05:30
|
|
|
"on_given_focus_out" : self.on_given_focus_out_event,
|
2003-11-18 09:56:06 +05:30
|
|
|
"on_help_person_clicked" : self.on_help_clicked,
|
2003-01-02 10:01:52 +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
|
|
|
|
2005-02-20 03:41:51 +05:30
|
|
|
self.complete.set_active(self.person.get_complete_flag())
|
|
|
|
self.private.set_active(self.person.get_privacy())
|
2003-12-03 09:19:39 +05:30
|
|
|
|
2004-11-29 08:54:02 +05:30
|
|
|
self.eventbox.connect('button-press-event',self.image_button_press)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.redraw_event_list()
|
|
|
|
self.redraw_attr_list()
|
2005-02-17 10:16:13 +05:30
|
|
|
self.redraw_addr_list()
|
2002-10-20 19:55:16 +05:30
|
|
|
self.redraw_name_list()
|
|
|
|
self.redraw_url_list()
|
2003-03-26 10:02:14 +05:30
|
|
|
self.get_widget("notebook").set_current_page(0)
|
2005-04-19 09:50:17 +05:30
|
|
|
self.surname.grab_focus()
|
2004-02-19 19:10:09 +05:30
|
|
|
self.add_itself_to_winsmenu()
|
2005-02-17 04:19:54 +05:30
|
|
|
|
2005-04-19 09:50:17 +05:30
|
|
|
for i in ["ok", "add_aka", "aka_delete", "event_add", "event_del",
|
|
|
|
"attr_add", "attr_del", "addr_add",
|
2005-02-17 10:16:13 +05:30
|
|
|
"addr_del", "media_add", "media_sel", "media_del",
|
|
|
|
"add_url", "delete_url", "add_src", "del_src" ]:
|
|
|
|
self.get_widget(i).set_sensitive(not self.db.readonly)
|
2005-02-17 04:19:54 +05:30
|
|
|
|
2003-03-21 09:55:55 +05:30
|
|
|
self.window.show()
|
2003-03-14 11:16:02 +05:30
|
|
|
|
2004-11-29 08:54:02 +05:30
|
|
|
def image_button_press(self,obj,event):
|
|
|
|
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
|
|
|
|
|
|
|
media_list = self.person.get_media_list()
|
|
|
|
if media_list:
|
|
|
|
ph = media_list[0]
|
|
|
|
object_handle = ph.get_reference_handle()
|
|
|
|
obj = self.db.get_object_from_handle(object_handle)
|
2005-02-16 11:11:33 +05:30
|
|
|
ImageSelect.LocalMediaProperties(ph,obj.get_path(),
|
|
|
|
self,self.window)
|
|
|
|
|
2004-11-29 08:54:02 +05:30
|
|
|
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
|
|
|
media_list = self.person.get_media_list()
|
|
|
|
if media_list:
|
|
|
|
ph = media_list[0]
|
|
|
|
self.show_popup(ph,event)
|
|
|
|
|
|
|
|
def show_popup(self, photo, event):
|
|
|
|
"""Look for right-clicks on a picture and create a popup
|
|
|
|
menu of the available actions."""
|
|
|
|
|
|
|
|
menu = gtk.Menu()
|
|
|
|
menu.set_title(_("Media Object"))
|
|
|
|
obj = self.db.get_object_from_handle(photo.get_reference_handle())
|
|
|
|
mtype = obj.get_mime_type()
|
|
|
|
progname = GrampsMime.get_application(mtype)
|
|
|
|
|
|
|
|
if progname and len(progname) > 1:
|
|
|
|
Utils.add_menuitem(menu,_("Open in %s") % progname[1],
|
|
|
|
photo,self.popup_view_photo)
|
|
|
|
if mtype[0:5] == "image":
|
|
|
|
Utils.add_menuitem(menu,_("Edit with the GIMP"),
|
|
|
|
photo,self.popup_edit_photo)
|
|
|
|
Utils.add_menuitem(menu,_("Edit Object Properties"),photo,
|
|
|
|
self.popup_change_description)
|
|
|
|
menu.popup(None,None,None,event.button,event.time)
|
|
|
|
|
|
|
|
def popup_view_photo(self, obj):
|
|
|
|
"""Open this picture in a picture viewer"""
|
|
|
|
media_list = self.person.get_media_list()
|
|
|
|
if media_list:
|
|
|
|
ph = media_list[0]
|
|
|
|
object_handle = ph.get_reference_handle()
|
|
|
|
Utils.view_photo(self.db.get_object_from_handle(object_handle))
|
|
|
|
|
|
|
|
def popup_edit_photo(self, obj):
|
|
|
|
"""Open this picture in a picture editor"""
|
|
|
|
media_list = self.person.get_media_list()
|
|
|
|
if media_list:
|
|
|
|
ph = media_list[0]
|
|
|
|
object_handle = ph.get_reference_handle()
|
|
|
|
if os.fork() == 0:
|
|
|
|
obj = self.db.get_object_from_handle(object_handle)
|
|
|
|
os.execvp(const.editor,[const.editor, obj.get_path()])
|
|
|
|
|
|
|
|
def popup_change_description(self,obj):
|
|
|
|
media_list = self.person.get_media_list()
|
|
|
|
if media_list:
|
|
|
|
ph = media_list[0]
|
|
|
|
object_handle = ph.get_reference_handle()
|
|
|
|
obj = self.db.get_object_from_handle(object_handle)
|
|
|
|
ImageSelect.LocalMediaProperties(ph,obj.get_path(),self,self.window)
|
|
|
|
|
2004-02-20 00:45:27 +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-20 06:22:24 +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-20 00:45:27 +05:30
|
|
|
|
2004-08-04 10:23:29 +05:30
|
|
|
def close(self):
|
2004-06-23 10:24:33 +05:30
|
|
|
event_list = []
|
|
|
|
for col in self.event_list.get_columns():
|
|
|
|
event_list.append(self.event_trans.find_key(col.get_title()))
|
2005-02-17 04:19:54 +05:30
|
|
|
if not self.db.readonly:
|
|
|
|
self.db.metadata['event_order'] = event_list
|
2004-06-23 10:24:33 +05:30
|
|
|
|
2005-04-19 09:50:17 +05:30
|
|
|
#self.gallery.close()
|
2004-02-20 06:22:24 +05:30
|
|
|
self.close_child_windows()
|
|
|
|
self.remove_itself_from_winsmenu()
|
|
|
|
self.window.destroy()
|
2004-02-20 00:45:27 +05:30
|
|
|
|
2004-02-19 19:10:09 +05:30
|
|
|
def add_itself_to_winsmenu(self):
|
2004-08-24 09:18:15 +05:30
|
|
|
self.parent.child_windows[self.orig_handle] = self
|
2005-01-01 09:57:15 +05:30
|
|
|
win_menu_label = self.name_display.display(self.person)
|
2004-02-20 00:45:27 +05:30
|
|
|
if not win_menu_label.strip():
|
2004-02-20 02:04:58 +05:30
|
|
|
win_menu_label = _("New Person")
|
2004-02-20 00:45:27 +05:30
|
|
|
self.win_menu_item = gtk.MenuItem(win_menu_label)
|
2004-02-20 06:22:24 +05:30
|
|
|
self.win_menu_item.set_submenu(gtk.Menu())
|
2004-02-20 00:45:27 +05:30
|
|
|
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-20 06:22:24 +05:30
|
|
|
self.menu_item = gtk.MenuItem(_('Edit Person'))
|
2004-02-19 19:10:09 +05:30
|
|
|
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-19 19:10:09 +05:30
|
|
|
|
|
|
|
def remove_itself_from_winsmenu(self):
|
2004-08-24 09:18:15 +05:30
|
|
|
del self.parent.child_windows[self.orig_handle]
|
2004-02-19 19:10:09 +05:30
|
|
|
self.menu_item.destroy()
|
2004-02-25 08:50:53 +05:30
|
|
|
self.winsmenu.destroy()
|
2004-02-20 06:22:24 +05:30
|
|
|
self.win_menu_item.destroy()
|
2004-02-19 19:10:09 +05:30
|
|
|
|
|
|
|
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
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def build_columns(self,tree,list):
|
|
|
|
cnum = 0
|
|
|
|
for name in list:
|
2005-04-19 09:50:17 +05:30
|
|
|
if cnum == 0:
|
|
|
|
renderer = gtk.CellRendererCombo()
|
|
|
|
else:
|
|
|
|
renderer = gtk.CellRendererText()
|
2002-10-20 19:55:16 +05:30
|
|
|
column = gtk.TreeViewColumn(name[0],renderer,text=cnum)
|
|
|
|
column.set_min_width(name[1])
|
|
|
|
cnum = cnum + 1
|
|
|
|
tree.append_column(column)
|
|
|
|
|
2004-08-11 09:12:38 +05:30
|
|
|
def lds_field(self,lds_ord,combo,date,place):
|
2005-02-23 10:00:08 +05:30
|
|
|
build_combo(combo,_temple_names)
|
|
|
|
temple_code = const.lds_temple_to_abrev.get(lds_ord.get_temple(),"")
|
|
|
|
index = _temple_names.index(temple_code)
|
|
|
|
combo.set_active(index)
|
2004-08-11 09:12:38 +05:30
|
|
|
if not lds_ord.is_empty():
|
|
|
|
stat = lds_ord.get_status()
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
stat = 0
|
2005-03-19 23:51:57 +05:30
|
|
|
date.set_text(lds_ord.get_date())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-05-02 09:40:33 +05:30
|
|
|
build_dropdown(place,self.place_list)
|
2004-08-11 09:12:38 +05:30
|
|
|
if lds_ord and lds_ord.get_place_handle():
|
2005-02-27 11:21:59 +05:30
|
|
|
handle = lds_ord.get_place_handle()
|
|
|
|
lds_ord_place = self.db.get_place_from_handle(handle)
|
2004-08-11 09:12:38 +05:30
|
|
|
place.set_text(lds_ord_place.get_title())
|
2002-10-20 19:55:16 +05:30
|
|
|
return stat
|
|
|
|
|
|
|
|
def draw_lds(self):
|
|
|
|
"""Draws the LDS window. This window is not always drawn, and in
|
|
|
|
may cases is hidden."""
|
|
|
|
|
|
|
|
self.ldsbap_date = self.get_widget("ldsbapdate")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.ldsbap_date.set_editable(not self.db.readonly)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.ldsbap_temple = self.get_widget("ldsbaptemple")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.ldsbap_temple.set_sensitive(not self.db.readonly)
|
|
|
|
self.ldsbapplace = self.get_widget("lds_bap_place")
|
|
|
|
self.ldsbapplace.set_editable(not self.db.readonly)
|
2005-03-19 23:51:57 +05:30
|
|
|
self.ldsbap_date_led = self.get_widget("ldsbap_stat")
|
|
|
|
self.ldsbap_date_led.set_sensitive(not self.db.readonly)
|
|
|
|
self.ldsbap_date_check = DateEdit.DateEdit(
|
|
|
|
self.lds_baptism.get_date_object(), self.ldsbap_date,
|
|
|
|
self.ldsbap_date_led, self.window)
|
2005-02-18 10:19:59 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.ldsend_date = self.get_widget("endowdate")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.ldsend_date.set_editable(not self.db.readonly)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.ldsend_temple = self.get_widget("endowtemple")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.ldsend_temple.set_sensitive(not self.db.readonly)
|
|
|
|
self.ldsendowplace = self.get_widget("lds_end_place")
|
|
|
|
self.ldsendowplace.set_editable(not self.db.readonly)
|
|
|
|
self.ldsendowstat = self.get_widget("endowstat")
|
|
|
|
self.ldsendowstat.set_sensitive(not self.db.readonly)
|
2005-03-19 23:51:57 +05:30
|
|
|
self.ldsend_date_led = self.get_widget("endow_stat")
|
|
|
|
self.ldsend_date_led.set_sensitive(not self.db.readonly)
|
|
|
|
self.ldsend_date_check = DateEdit.DateEdit(
|
|
|
|
self.lds_endowment.get_date_object(), self.ldsend_date,
|
|
|
|
self.ldsend_date_led, self.window)
|
2005-02-18 10:19:59 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.ldsseal_date = self.get_widget("sealdate")
|
|
|
|
self.ldsseal_temple = self.get_widget("sealtemple")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.ldssealplace = self.get_widget("lds_seal_place")
|
|
|
|
self.ldsseal_date.set_editable(not self.db.readonly)
|
|
|
|
self.ldsseal_temple.set_sensitive(not self.db.readonly)
|
|
|
|
self.ldssealplace.set_editable(not self.db.readonly)
|
2005-03-19 23:51:57 +05:30
|
|
|
self.ldsseal_date_led = self.get_widget("seal_stat")
|
|
|
|
self.ldsseal_date_led.set_sensitive(not self.db.readonly)
|
|
|
|
self.ldsseal_date_check = DateEdit.DateEdit(
|
|
|
|
self.lds_sealing.get_date_object(), self.ldsseal_date,
|
|
|
|
self.ldsseal_date_led, self.window)
|
2005-02-18 10:19:59 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.ldsseal_fam = self.get_widget("sealparents")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.ldsseal_fam.set_sensitive(not self.db.readonly)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.ldsbapstat = self.get_widget("ldsbapstat")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.ldsbapstat.set_sensitive(not self.db.readonly)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.ldssealstat = self.get_widget("sealstat")
|
2005-02-18 10:19:59 +05:30
|
|
|
self.ldssealstat.set_sensitive(not self.db.readonly)
|
|
|
|
|
2005-02-27 11:21:59 +05:30
|
|
|
self.bstat = self.lds_field(
|
|
|
|
self.lds_baptism, self.ldsbap_temple,
|
|
|
|
self.ldsbap_date, self.ldsbapplace)
|
|
|
|
|
|
|
|
self.estat = self.lds_field(
|
|
|
|
self.lds_endowment, self.ldsend_temple,
|
|
|
|
self.ldsend_date, self.ldsendowplace)
|
|
|
|
|
|
|
|
self.seal_stat = self.lds_field(
|
|
|
|
self.lds_sealing, self.ldsseal_temple,
|
|
|
|
self.ldsseal_date, self.ldssealplace)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
if self.lds_sealing:
|
2004-07-28 07:59:07 +05:30
|
|
|
self.ldsfam = self.lds_sealing.get_family_handle()
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
self.ldsfam = None
|
|
|
|
|
2005-01-07 10:04:02 +05:30
|
|
|
cell = gtk.CellRendererText()
|
|
|
|
self.ldsseal_fam.pack_start(cell,True)
|
|
|
|
self.ldsseal_fam.add_attribute(cell,'text',0)
|
|
|
|
|
|
|
|
store = gtk.ListStore(str)
|
|
|
|
store.append(row=[_("None")])
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
index = 0
|
|
|
|
hist = 0
|
2005-01-07 10:04:02 +05:30
|
|
|
self.lds_fam_list = [None]
|
2004-07-28 07:59:07 +05:30
|
|
|
flist = [self.person.get_main_parents_family_handle()]
|
|
|
|
for (fam,mrel,frel) in self.person.get_parent_family_handle_list():
|
2004-03-23 05:29:37 +05:30
|
|
|
if fam not in flist:
|
|
|
|
flist.append(fam)
|
2005-01-07 10:04:02 +05:30
|
|
|
|
2004-02-21 12:10:44 +05:30
|
|
|
for fam_id in flist:
|
2005-01-07 10:04:02 +05:30
|
|
|
index += 1
|
2005-03-14 03:40:40 +05:30
|
|
|
family = self.db.get_family_from_handle(fam_id)
|
|
|
|
if family == None:
|
2002-10-20 19:55:16 +05:30
|
|
|
continue
|
2005-03-14 03:40:40 +05:30
|
|
|
name = Utils.family_name(family,self.db)
|
2005-01-07 10:04:02 +05:30
|
|
|
store.append(row=[name])
|
|
|
|
self.lds_fam_list.append(fam_id)
|
|
|
|
if fam_id == self.ldsfam:
|
2002-10-20 19:55:16 +05:30
|
|
|
hist = index
|
2005-01-07 10:04:02 +05:30
|
|
|
self.ldsseal_fam.set_model(store)
|
|
|
|
self.ldsseal_fam.set_active(hist)
|
|
|
|
self.ldsseal_fam.connect("changed",self.menu_changed)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.build_bap_menu()
|
|
|
|
self.build_seal_menu()
|
|
|
|
self.build_endow_menu()
|
|
|
|
|
2003-06-24 19:46:47 +05:30
|
|
|
def on_gender_activate (self, button):
|
2004-09-20 08:42:51 +05:30
|
|
|
self.should_guess_gender = False
|
2003-06-24 19:46:47 +05:30
|
|
|
|
2004-10-01 00:02:56 +05:30
|
|
|
def on_given_focus_out_event (self, entry, event):
|
2003-06-24 19:46:47 +05:30
|
|
|
if not self.should_guess_gender:
|
|
|
|
return
|
|
|
|
|
2003-11-17 06:11:32 +05:30
|
|
|
def build_menu(self,list,task,opt_menu,type):
|
2005-01-07 10:04:02 +05:30
|
|
|
cell = gtk.CellRendererText()
|
|
|
|
opt_menu.pack_start(cell,True)
|
|
|
|
opt_menu.add_attribute(cell,'text',0)
|
|
|
|
|
|
|
|
store = gtk.ListStore(str)
|
2002-10-20 19:55:16 +05:30
|
|
|
for val in list:
|
2005-01-07 10:04:02 +05:30
|
|
|
store.append(row=[val])
|
|
|
|
opt_menu.set_model(store)
|
|
|
|
opt_menu.connect('changed',task)
|
|
|
|
opt_menu.set_active(type)
|
2005-02-23 10:00:08 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def build_bap_menu(self):
|
2003-11-17 06:11:32 +05:30
|
|
|
self.build_menu(const.lds_baptism,self.set_lds_bap,self.ldsbapstat,
|
|
|
|
self.bstat)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def build_endow_menu(self):
|
2003-11-17 06:11:32 +05:30
|
|
|
self.build_menu(const.lds_baptism,self.set_lds_endow,self.ldsendowstat,
|
|
|
|
self.estat)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def build_seal_menu(self):
|
2003-11-17 06:11:32 +05:30
|
|
|
self.build_menu(const.lds_csealing,self.set_lds_seal,self.ldssealstat,
|
|
|
|
self.seal_stat)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def set_lds_bap(self,obj):
|
2005-01-07 10:04:02 +05:30
|
|
|
self.lds_baptism.set_status(obj.get_active())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def set_lds_endow(self,obj):
|
2005-01-07 10:04:02 +05:30
|
|
|
self.lds_endowment.set_status(obj.get_active())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def set_lds_seal(self,obj):
|
2005-01-07 10:04:02 +05:30
|
|
|
self.lds_sealing.set_status(obj.get_active())
|
2005-04-01 19:52:26 +05:30
|
|
|
|
|
|
|
def name_drag_data_get(self,widget, context, sel_data, info, time):
|
|
|
|
name = self.ntree.get_selected_objects()
|
|
|
|
|
|
|
|
bits_per = 8; # we're going to pass a string
|
|
|
|
pickled = pickle.dumps(name[0]);
|
|
|
|
data = str((DdTargets.NAME.drag_type,self.person.get_handle(),pickled));
|
|
|
|
sel_data.set(sel_data.target, bits_per, data)
|
|
|
|
|
|
|
|
def name_drag_begin(self, context, a):
|
|
|
|
return
|
|
|
|
icon = self.ntree.get_icon()
|
|
|
|
t = self.ntree.tree
|
|
|
|
(x,y) = icon.get_size()
|
|
|
|
mask = gtk.gdk.Pixmap(self.window.window,x,y,1)
|
|
|
|
mask.draw_rectangle(t.get_style().white_gc, True, 0,0,x,y)
|
|
|
|
t.drag_source_set_icon(t.get_colormap(),icon,mask)
|
|
|
|
|
|
|
|
def name_drag_data_received(self,widget,context,x,y,sel_data,info,time):
|
|
|
|
row = self.ntree.get_row_at(x,y)
|
|
|
|
|
|
|
|
if sel_data and sel_data.data:
|
|
|
|
exec 'data = %s' % sel_data.data
|
|
|
|
exec 'mytype = "%s"' % data[0]
|
|
|
|
exec 'person = "%s"' % data[1]
|
|
|
|
if mytype != DdTargets.NAME.drag_type:
|
|
|
|
return
|
|
|
|
elif person == self.person.get_handle():
|
|
|
|
self.move_element(self.nlist,self.ntree.get_selected_row(),row)
|
|
|
|
else:
|
|
|
|
foo = pickle.loads(data[2]);
|
|
|
|
for src in foo.get_source_references():
|
|
|
|
base_handle = src.get_base_handle()
|
|
|
|
newbase = self.db.get_source_from_handle(base_handle)
|
|
|
|
src.set_base_handle(newbase.get_handle())
|
|
|
|
|
|
|
|
self.nlist.insert(row,foo)
|
|
|
|
|
|
|
|
self.lists_changed = True
|
|
|
|
self.redraw_name_list()
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def ev_drag_data_received(self,widget,context,x,y,sel_data,info,time):
|
2003-01-06 10:44:49 +05:30
|
|
|
row = self.etree.get_row_at(x,y)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
if sel_data and sel_data.data:
|
|
|
|
exec 'data = %s' % sel_data.data
|
|
|
|
exec 'mytype = "%s"' % data[0]
|
|
|
|
exec 'person = "%s"' % data[1]
|
2005-03-26 02:35:09 +05:30
|
|
|
if mytype != DdTargets.EVENT.drag_type:
|
2002-10-20 19:55:16 +05:30
|
|
|
return
|
2004-07-28 07:59:07 +05:30
|
|
|
elif person == self.person.get_handle():
|
2003-01-06 10:44:49 +05:30
|
|
|
self.move_element(self.elist,self.etree.get_selected_row(),row)
|
|
|
|
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-18 17:46:41 +05:30
|
|
|
src.set_base_handle(newbase.get_handle())
|
2004-07-28 07:59:07 +05:30
|
|
|
place = foo.get_place_handle()
|
2003-01-06 10:44:49 +05:30
|
|
|
if place:
|
2004-07-28 07:59:07 +05:30
|
|
|
foo.set_place_handle(place.get_handle())
|
2005-03-16 14:21:53 +05:30
|
|
|
self.elist.insert(row,foo.get_handle())
|
2003-01-06 10:44:49 +05:30
|
|
|
|
2004-09-20 08:42:51 +05:30
|
|
|
self.lists_changed = True
|
2002-10-20 19:55:16 +05:30
|
|
|
self.redraw_event_list()
|
|
|
|
|
2003-01-06 10:44:49 +05:30
|
|
|
def move_element(self,list,src,dest):
|
|
|
|
if src == -1:
|
|
|
|
return
|
|
|
|
obj = list[src]
|
|
|
|
list.remove(obj)
|
|
|
|
list.insert(dest,obj)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def ev_drag_data_get(self,widget, context, sel_data, info, time):
|
2003-01-06 10:44:49 +05:30
|
|
|
ev = self.etree.get_selected_objects()
|
2003-01-02 10:01:52 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
bits_per = 8; # we're going to pass a string
|
2003-01-06 10:44:49 +05:30
|
|
|
pickled = pickle.dumps(ev[0]);
|
2005-03-26 02:35:09 +05:30
|
|
|
data = str((DdTargets.EVENT.drag_type,self.person.get_handle(),pickled));
|
2002-10-20 19:55:16 +05:30
|
|
|
sel_data.set(sel_data.target, bits_per, data)
|
|
|
|
|
2003-01-06 10:44:49 +05:30
|
|
|
def ev_drag_begin(self, context, a):
|
|
|
|
return
|
|
|
|
icon = self.etree.get_icon()
|
|
|
|
t = self.etree.tree
|
|
|
|
(x,y) = icon.get_size()
|
|
|
|
mask = gtk.gdk.Pixmap(self.window.window,x,y,1)
|
2005-02-24 05:55:34 +05:30
|
|
|
mask.draw_rectangle(t.get_style().white_gc, True, 0,0,x,y)
|
2003-01-06 10:44:49 +05:30
|
|
|
t.drag_source_set_icon(t.get_colormap(),icon,mask)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def url_drag_data_received(self,widget,context,x,y,sel_data,info,time):
|
2003-01-06 10:44:49 +05:30
|
|
|
row = self.wtree.get_row_at(x,y)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
if sel_data and sel_data.data:
|
|
|
|
exec 'data = %s' % sel_data.data
|
|
|
|
exec 'mytype = "%s"' % data[0]
|
|
|
|
exec 'person = "%s"' % data[1]
|
2005-03-26 02:35:09 +05:30
|
|
|
if mytype != DdTargets.URL.drag_type:
|
2002-10-20 19:55:16 +05:30
|
|
|
return
|
2004-07-28 07:59:07 +05:30
|
|
|
elif person == self.person.get_handle():
|
2003-01-06 10:44:49 +05:30
|
|
|
self.move_element(self.ulist,self.wtree.get_selected_row(),row)
|
|
|
|
else:
|
|
|
|
foo = pickle.loads(data[2]);
|
|
|
|
self.ulist.append(foo)
|
2004-09-20 08:42:51 +05:30
|
|
|
self.lists_changed = True
|
2002-10-20 19:55:16 +05:30
|
|
|
self.redraw_url_list()
|
|
|
|
|
2003-01-08 11:11:35 +05:30
|
|
|
def url_drag_begin(self, context, a):
|
|
|
|
return
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def url_drag_data_get(self,widget, context, sel_data, info, time):
|
2003-01-06 10:44:49 +05:30
|
|
|
ev = self.wtree.get_selected_objects()
|
2003-03-14 11:16:02 +05:30
|
|
|
|
|
|
|
if len(ev):
|
|
|
|
bits_per = 8; # we're going to pass a string
|
|
|
|
pickled = pickle.dumps(ev[0]);
|
2005-03-26 02:35:09 +05:30
|
|
|
data = str((DdTargets.URL.drag_type,self.person.get_handle(),pickled));
|
2003-03-14 11:16:02 +05:30
|
|
|
sel_data.set(sel_data.target, bits_per, data)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def at_drag_data_received(self,widget,context,x,y,sel_data,info,time):
|
2003-01-06 10:44:49 +05:30
|
|
|
row = self.atree.get_row_at(x,y)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
if sel_data and sel_data.data:
|
|
|
|
exec 'data = %s' % sel_data.data
|
|
|
|
exec 'mytype = "%s"' % data[0]
|
|
|
|
exec 'person = "%s"' % data[1]
|
2005-03-26 02:35:09 +05:30
|
|
|
if mytype != DdTargets.ATTRIBUTE.drag_type:
|
2002-10-20 19:55:16 +05:30
|
|
|
return
|
2004-07-28 07:59:07 +05:30
|
|
|
elif person == self.person.get_handle():
|
2003-01-06 10:44:49 +05:30
|
|
|
self.move_element(self.alist,self.atree.get_selected_row(),row)
|
|
|
|
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-18 17:46:41 +05:30
|
|
|
src.set_base_handle(newbase.get_handle())
|
2003-01-06 10:44:49 +05:30
|
|
|
self.alist.append(foo)
|
2004-09-20 08:42:51 +05:30
|
|
|
self.lists_changed = True
|
2002-10-20 19:55:16 +05:30
|
|
|
self.redraw_attr_list()
|
|
|
|
|
2003-01-08 11:11:35 +05:30
|
|
|
def at_drag_begin(self, context, a):
|
|
|
|
return
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def at_drag_data_get(self,widget, context, sel_data, info, time):
|
2003-01-06 10:44:49 +05:30
|
|
|
ev = self.atree.get_selected_objects()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-03-14 11:16:02 +05:30
|
|
|
if len(ev):
|
|
|
|
bits_per = 8; # we're going to pass a string
|
|
|
|
pickled = pickle.dumps(ev[0]);
|
2005-03-26 02:35:09 +05:30
|
|
|
data = str((DdTargets.ATTRIBUTE.drag_type,
|
|
|
|
self.person.get_handle(),pickled));
|
2003-03-14 11:16:02 +05:30
|
|
|
sel_data.set(sel_data.target, bits_per, data)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def ad_drag_data_received(self,widget,context,x,y,sel_data,info,time):
|
2003-01-06 10:44:49 +05:30
|
|
|
row = self.ptree.get_row_at(x,y)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
if sel_data and sel_data.data:
|
|
|
|
exec 'data = %s' % sel_data.data
|
|
|
|
exec 'mytype = "%s"' % data[0]
|
|
|
|
exec 'person = "%s"' % data[1]
|
2005-03-26 02:35:09 +05:30
|
|
|
if mytype != DdTargets.ADDRESS.drag_type:
|
2002-10-20 19:55:16 +05:30
|
|
|
return
|
2004-07-28 07:59:07 +05:30
|
|
|
elif person == self.person.get_handle():
|
2003-01-06 10:44:49 +05:30
|
|
|
self.move_element(self.plist,self.ptree.get_selected_row(),row)
|
|
|
|
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-18 17:46:41 +05:30
|
|
|
src.set_base_handle(newbase.get_handle())
|
2003-01-08 11:11:35 +05:30
|
|
|
self.plist.insert(row,foo)
|
|
|
|
|
2004-09-20 08:42:51 +05:30
|
|
|
self.lists_changed = True
|
2002-10-20 19:55:16 +05:30
|
|
|
self.redraw_addr_list()
|
|
|
|
|
|
|
|
def ad_drag_data_get(self,widget, context, sel_data, info, time):
|
2003-01-06 10:44:49 +05:30
|
|
|
ev = self.ptree.get_selected_objects()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-03-14 11:16:02 +05:30
|
|
|
if len(ev):
|
|
|
|
bits_per = 8; # we're going to pass a string
|
|
|
|
pickled = pickle.dumps(ev[0]);
|
2005-03-26 02:35:09 +05:30
|
|
|
data = str((DdTargets.ADDRESS.drag_type,
|
|
|
|
self.person.get_handle(),pickled));
|
2003-03-14 11:16:02 +05:30
|
|
|
sel_data.set(sel_data.target, bits_per, data)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-01-08 11:11:35 +05:30
|
|
|
def ad_drag_begin(self, context, a):
|
|
|
|
return
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def menu_changed(self,obj):
|
2005-01-07 10:04:02 +05:30
|
|
|
self.ldsfam = self.lds_fam_list[obj.get_active()]
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def get_widget(self,str):
|
|
|
|
"""returns the widget related to the passed string"""
|
|
|
|
return self.top.get_widget(str)
|
|
|
|
|
|
|
|
def redraw_name_list(self):
|
|
|
|
"""redraws the name list"""
|
2002-11-21 10:11:40 +05:30
|
|
|
self.ntree.clear()
|
2003-06-11 08:56:02 +05:30
|
|
|
self.nmap = {}
|
2002-11-21 10:11:40 +05:30
|
|
|
for name in self.nlist:
|
2005-04-24 09:09:07 +05:30
|
|
|
has_note = name.get_note()
|
|
|
|
has_source = len(name.get_source_references())> 0
|
2005-04-23 21:23:30 +05:30
|
|
|
node = self.ntree.add([
|
|
|
|
name.get_surname(),name.get_surname_prefix(),
|
|
|
|
name.get_first_name(), name.get_suffix(),
|
2005-04-24 09:09:07 +05:30
|
|
|
_(name.get_type()),has_source,has_note],name)
|
2004-08-11 09:12:38 +05:30
|
|
|
self.nmap[str(name)] = node
|
2003-11-11 06:08:24 +05:30
|
|
|
if self.nlist:
|
2002-12-14 10:37:09 +05:30
|
|
|
self.ntree.select_row(0)
|
2005-04-23 21:23:30 +05:30
|
|
|
Utils.bold_label(self.names_label)
|
|
|
|
else:
|
|
|
|
Utils.unbold_label(self.names_label)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def redraw_url_list(self):
|
|
|
|
"""redraws the url list, disabling the go button if no url
|
|
|
|
is selected"""
|
2002-11-21 10:11:40 +05:30
|
|
|
self.wtree.clear()
|
2003-06-11 08:56:02 +05:30
|
|
|
self.wmap = {}
|
2002-11-21 10:11:40 +05:30
|
|
|
for url in self.ulist:
|
2004-08-11 09:12:38 +05:30
|
|
|
node = self.wtree.add([url.get_path(),url.get_description()],url)
|
|
|
|
self.wmap[str(url)] = node
|
2003-06-11 08:56:02 +05:30
|
|
|
|
2002-11-21 10:11:40 +05:30
|
|
|
if len(self.ulist) > 0:
|
2004-09-20 08:42:51 +05:30
|
|
|
self.web_go.set_sensitive(False)
|
2002-12-14 10:37:09 +05:30
|
|
|
self.wtree.select_row(0)
|
2005-04-23 21:23:30 +05:30
|
|
|
Utils.bold_label(self.inet_label)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-09-20 08:42:51 +05:30
|
|
|
self.web_go.set_sensitive(False)
|
2005-04-23 21:23:30 +05:30
|
|
|
Utils.unbold_label(self.inet_label)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def redraw_addr_list(self):
|
2002-11-21 10:11:40 +05:30
|
|
|
"""Redraws the address list"""
|
|
|
|
self.ptree.clear()
|
2003-06-11 08:56:02 +05:30
|
|
|
self.pmap = {}
|
2002-11-21 10:11:40 +05:30
|
|
|
for addr in self.plist:
|
2005-04-24 09:09:07 +05:30
|
|
|
has_note = addr.get_note()
|
|
|
|
has_source = len(addr.get_source_references())> 0
|
2004-02-14 11:10:30 +05:30
|
|
|
location = "%s %s %s %s" % (addr.get_street(),addr.get_city(),
|
|
|
|
addr.get_state(),addr.get_country())
|
2005-04-24 09:09:07 +05:30
|
|
|
node = self.ptree.add([addr.get_date(),addr.get_street(),
|
|
|
|
addr.get_city(),addr_get_state(),
|
|
|
|
addr_get_country(),has_source,has_note],
|
|
|
|
addr)
|
2004-08-11 09:12:38 +05:30
|
|
|
self.pmap[str(addr)] = node
|
2002-12-14 10:37:09 +05:30
|
|
|
if self.plist:
|
|
|
|
self.ptree.select_row(0)
|
2005-04-23 21:23:30 +05:30
|
|
|
Utils.bold_label(self.addr_label)
|
|
|
|
else:
|
|
|
|
Utils.unbold_label(self.addr_label)
|
2002-11-21 10:11:40 +05:30
|
|
|
|
|
|
|
def redraw_attr_list(self):
|
|
|
|
"""redraws the attribute list for the person"""
|
|
|
|
self.atree.clear()
|
2003-06-11 08:24:57 +05:30
|
|
|
self.amap = {}
|
2002-11-21 10:11:40 +05:30
|
|
|
for attr in self.alist:
|
2005-04-24 09:09:07 +05:30
|
|
|
has_note = attr.get_note()
|
|
|
|
has_source = len(attr.get_source_references())> 0
|
|
|
|
node = self.atree.add([
|
|
|
|
const.display_pattr(attr.get_type()), attr.get_value(),
|
|
|
|
has_source, has_note,
|
|
|
|
],attr)
|
2004-08-11 09:12:38 +05:30
|
|
|
self.amap[str(attr)] = node
|
2002-12-14 10:37:09 +05:30
|
|
|
if self.alist:
|
|
|
|
self.atree.select_row(0)
|
2005-04-23 21:23:30 +05:30
|
|
|
Utils.bold_label(self.attr_label)
|
|
|
|
else:
|
|
|
|
Utils.unbold_label(self.attr_label)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-06-11 08:56:02 +05:30
|
|
|
def name_edit_callback(self,name):
|
|
|
|
self.redraw_name_list()
|
|
|
|
self.ntree.select_iter(self.nmap[str(name)])
|
|
|
|
|
|
|
|
def addr_edit_callback(self,addr):
|
|
|
|
self.redraw_addr_list()
|
|
|
|
self.ptree.select_iter(self.pmap[str(addr)])
|
|
|
|
|
|
|
|
def url_edit_callback(self,url):
|
|
|
|
self.redraw_url_list()
|
|
|
|
self.wtree.select_iter(self.wmap[str(url)])
|
|
|
|
|
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
|
|
|
|
|
|
|
|
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_event_list(self):
|
|
|
|
"""redraw_event_list - Update both the birth and death place combo
|
|
|
|
boxes for any changes that occurred in the 'Event Edit' window.
|
|
|
|
Make sure not to allow the editing of a birth event to change
|
|
|
|
any values in the death event, and vice versa. Since updating a
|
|
|
|
combo list resets its present value, this code will have to save
|
|
|
|
and restore the value for the event *not* being edited."""
|
2002-11-21 10:11:40 +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-14 11:10:30 +05:30
|
|
|
pname = place_title(self.db,event)
|
2005-04-23 21:23:30 +05:30
|
|
|
has_note = event.get_note()
|
|
|
|
has_source = len(event.get_source_references())> 0
|
|
|
|
data = [const.display_pevent(event.get_name()),
|
|
|
|
event.get_description(), event.get_date(),
|
|
|
|
pname, has_source, has_note]
|
|
|
|
node = self.etree.add(data, event)
|
2004-08-11 09:12:38 +05:30
|
|
|
self.emap[str(event)] = node
|
2005-04-23 21:23:30 +05:30
|
|
|
node = self.etree.add(["","","","",False,False],None)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-01-02 10:46:25 +05:30
|
|
|
def strip_id(self,text):
|
|
|
|
index = text.rfind('[')
|
|
|
|
if (index > 0):
|
|
|
|
text = text[:index]
|
|
|
|
text = text.rstrip()
|
|
|
|
return text
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def on_add_addr_clicked(self,obj):
|
|
|
|
"""Invokes the address editor to add a new address"""
|
|
|
|
import AddrEdit
|
2005-04-01 11:03:22 +05:30
|
|
|
AddrEdit.AddressEditor(self,None,self.addr_edit_callback,self.window)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_add_aka_clicked(self,obj):
|
|
|
|
"""Invokes the name editor to add a new name"""
|
|
|
|
import NameEdit
|
2005-04-01 11:03:22 +05:30
|
|
|
NameEdit.NameEditor(self, None, self.name_edit_callback, self.window)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_add_url_clicked(self,obj):
|
|
|
|
"""Invokes the url editor to add a new name"""
|
|
|
|
import UrlEdit
|
2005-01-01 09:57:15 +05:30
|
|
|
pname = self.name_display.display(self.person)
|
* src/SourceView.py (button_press,on_add_clicked,on_delete_clicked,
on_edit_clicked): Pass parent window to the child dialog.
* src/Sources.py (add_src_clicked): Likewise.
* src/EditSource.py (__init__): Add optional parent_window argument.
Make dialog modal and transient for its parent.
* src/gramps.glade (sourceEditor dialog): Delete unneeded handlers
for buttons.
* src/QuestionDialog.py (SaveDialog,QuestionDialog,OptionDialog,
ErrorDialog,WarningDialog,MissingMediaDialog): Set transient status
if parent is given.
* src/EventEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/Witness.py: Make WittnessEditor dialog modal and transient for
its parent. Call SelectPerson with itself as a parent.
* src/SelectPerson.py (__init__): Make dialog transient for its parent.
* src/imagesel.glade: Define proper responses and delete unneeded handlers
for buttons. Make gtkFileEntry modal.
* src/dialog.glade (all dialogs): Define proper responses for buttons.
* src/EditPerson.py (on_add_aka_clicked, on_aka_update_clicked):
Call NameEdit with itself as a parent; (on_add_attr_clicked,
on_update_attr_clicked): Call AttributeEditor with itself as a parent;
(on_add_addr_clicked,on_update_addr_clicked): Call AddressEditor with
itself as a parent; (on_add_url_clicked,on_update_url_clicked): Call
UrlEditor with itself as a parent; (on_name_note_clicked,
on_ldsbap_note_clicked,on_ldsendow_note_clicked,
on_ldsseal_note_clicked): Call NoteEditor with itself as a parent.
* src/NameEdit.py (__init__): Make dialog modal and transient for
its parent.
* src/AttrEdit.py (__init__): Likewise.
* src/AddrEdit.py (__init__): Likewise.
* src/UrlEdit.py (__init__): Likewise.
* src/NoteEdit.py (__init__): Likewise.
svn: r2131
2003-09-15 09:41:30 +05:30
|
|
|
UrlEdit.UrlEditor(self,pname,None,self.url_edit_callback,self.window)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_add_attr_clicked(self,obj):
|
|
|
|
"""Brings up the AttributeEditor for a new attribute"""
|
|
|
|
import AttrEdit
|
2005-01-01 09:57:15 +05:30
|
|
|
pname = self.name_display.display(self.person)
|
2003-06-11 08:24:57 +05:30
|
|
|
AttrEdit.AttributeEditor(self,None,pname,const.personalAttributes,
|
2005-04-01 11:03:22 +05:30
|
|
|
self.attr_edit_callback,self.window)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_up_clicked(self,obj):
|
|
|
|
sel = obj.get_selection()
|
2004-08-11 09:12:38 +05:30
|
|
|
store,node = sel.get_selected()
|
|
|
|
if node:
|
|
|
|
row = store.get_path(node)
|
2002-10-20 19:55:16 +05:30
|
|
|
sel.select_path((row[0]-1))
|
|
|
|
|
|
|
|
def on_down_clicked(self,obj):
|
|
|
|
sel = obj.get_selection()
|
2004-08-11 09:12:38 +05:30
|
|
|
store,node = sel.get_selected()
|
|
|
|
if node:
|
|
|
|
row = store.get_path(node)
|
2002-10-20 19:55:16 +05:30
|
|
|
sel.select_path((row[0]+1))
|
|
|
|
|
|
|
|
def on_event_add_clicked(self,obj):
|
|
|
|
"""Brings up the EventEditor for a new event"""
|
|
|
|
import EventEdit
|
2005-01-01 09:57:15 +05:30
|
|
|
pname = self.name_display.display(self.person)
|
2005-02-27 11:21:59 +05:30
|
|
|
EventEdit.EventEditor(
|
|
|
|
self,pname,const.personalEvents,
|
|
|
|
const.personal_events,None,None,0,
|
|
|
|
self.event_edit_callback,
|
2005-04-01 11:03:22 +05:30
|
|
|
noedit=self.db.readonly)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_edit_birth_clicked(self,obj):
|
|
|
|
"""Brings up the EventEditor for the birth record, event
|
|
|
|
name cannot be changed"""
|
2005-04-19 09:50:17 +05:30
|
|
|
pass
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_edit_death_clicked(self,obj):
|
|
|
|
"""Brings up the EventEditor for the death record, event
|
|
|
|
name cannot be changed"""
|
2005-04-19 09:50:17 +05:30
|
|
|
pass
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_aka_delete_clicked(self,obj):
|
|
|
|
"""Deletes the selected name from the name list"""
|
2004-08-11 09:12:38 +05:30
|
|
|
store,node = self.ntree.get_selected()
|
|
|
|
if node:
|
|
|
|
self.nlist.remove(self.ntree.get_object(node))
|
2004-09-20 08:42:51 +05:30
|
|
|
self.lists_changed = True
|
2002-10-20 19:55:16 +05:30
|
|
|
self.redraw_name_list()
|
|
|
|
|
|
|
|
def on_delete_url_clicked(self,obj):
|
|
|
|
"""Deletes the selected URL from the URL list"""
|
2004-08-11 09:12:38 +05:30
|
|
|
store,node = self.wtree.get_selected()
|
|
|
|
if node:
|
|
|
|
self.ulist.remove(self.wtree.get_object(node))
|
2004-09-20 08:42:51 +05:30
|
|
|
self.lists_changed = True
|
2002-10-20 19:55:16 +05:30
|
|
|
self.redraw_url_list()
|
|
|
|
|
|
|
|
def on_delete_attr_clicked(self,obj):
|
|
|
|
"""Deletes the selected attribute from the attribute list"""
|
2004-08-11 09:12:38 +05:30
|
|
|
store,node = self.atree.get_selected()
|
|
|
|
if node:
|
|
|
|
self.alist.remove(self.atree.get_object(node))
|
2004-09-20 08:42:51 +05:30
|
|
|
self.lists_changed = True
|
2002-10-20 19:55:16 +05:30
|
|
|
self.redraw_attr_list()
|
|
|
|
|
|
|
|
def on_delete_addr_clicked(self,obj):
|
|
|
|
"""Deletes the selected address from the address list"""
|
2004-08-11 09:12:38 +05:30
|
|
|
store,node = self.ptree.get_selected()
|
|
|
|
if node:
|
|
|
|
self.plist.remove(self.ptree.get_object(node))
|
2004-09-20 08:42:51 +05:30
|
|
|
self.lists_changed = True
|
2002-10-20 19:55:16 +05:30
|
|
|
self.redraw_addr_list()
|
|
|
|
|
|
|
|
def on_web_go_clicked(self,obj):
|
|
|
|
"""Attempts to display the selected URL in a web browser"""
|
|
|
|
text = obj.get()
|
|
|
|
if text:
|
2003-03-03 10:02:53 +05:30
|
|
|
gnome.url_show(text)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_cancel_edit(self,obj):
|
|
|
|
"""If the data has changed, give the user a chance to cancel
|
|
|
|
the close window"""
|
2004-11-11 09:58:40 +05:30
|
|
|
|
2005-01-06 22:58:31 +05:30
|
|
|
if self.did_data_change() and not GrampsKeys.get_dont_ask():
|
2004-02-14 11:10:30 +05:30
|
|
|
n = "<i>%s</i>" % self.person.get_primary_name().get_regular_name()
|
2003-05-24 09:10:58 +05:30
|
|
|
SaveDialog(_('Save changes to %s?') % n,
|
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:
|
2004-08-04 10:23:29 +05:30
|
|
|
self.close()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-02-24 10:21:57 +05:30
|
|
|
def save(self):
|
|
|
|
self.on_apply_person_clicked(None)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def on_delete_event(self,obj,b):
|
|
|
|
"""If the data has changed, give the user a chance to cancel
|
|
|
|
the close window"""
|
2005-01-06 22:58:31 +05:30
|
|
|
if self.did_data_change() and not GrampsKeys.get_dont_ask():
|
2004-02-14 11:10:30 +05:30
|
|
|
n = "<i>%s</i>" % self.person.get_primary_name().get_regular_name()
|
2003-05-24 09:10:58 +05:30
|
|
|
SaveDialog(_('Save Changes to %s?') % n,
|
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)
|
2004-09-20 08:42:51 +05:30
|
|
|
return True
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-08-04 10:23:29 +05:30
|
|
|
self.close()
|
2004-09-20 08:42:51 +05:30
|
|
|
return False
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def cancel_callback(self):
|
|
|
|
"""If the user answered yes to abandoning changes, close the window"""
|
2004-08-04 10:23:29 +05:30
|
|
|
self.close()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def did_data_change(self):
|
|
|
|
"""Check to see if any of the data has changed from the
|
2004-03-09 10:42:14 +05:30
|
|
|
orig record"""
|
2003-09-21 01:26:27 +05:30
|
|
|
|
2004-05-02 09:40:33 +05:30
|
|
|
surname = unicode(self.surname.get_text())
|
2003-12-17 10:53:16 +05:30
|
|
|
|
2004-08-04 10:23:29 +05:30
|
|
|
ntype = unicode(self.ntype_field.child.get_text())
|
2003-12-17 10:53:16 +05:30
|
|
|
suffix = unicode(self.suffix.get_text())
|
|
|
|
prefix = unicode(self.prefix.get_text())
|
|
|
|
given = unicode(self.given.get_text())
|
|
|
|
title = unicode(self.title.get_text())
|
2005-02-27 11:21:59 +05:30
|
|
|
|
|
|
|
start = self.notes_buffer.get_start_iter()
|
|
|
|
end = self.notes_buffer.get_end_iter()
|
|
|
|
text = unicode(self.notes_buffer.get_text(start, end, False))
|
2003-12-16 06:07:47 +05:30
|
|
|
format = self.preform.get_active()
|
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
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-09-20 08:42:51 +05:30
|
|
|
changed = False
|
2004-02-14 11:10:30 +05:30
|
|
|
name = self.person.get_primary_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-19 10:11:59 +05:30
|
|
|
if self.complete.get_active() != self.person.get_complete_flag():
|
|
|
|
changed = True
|
2005-02-20 03:41:51 +05:30
|
|
|
if self.private.get_active() != self.person.get_privacy():
|
|
|
|
changed = True
|
2005-02-19 10:11:59 +05:30
|
|
|
|
|
|
|
if self.person.get_gramps_id() != idval:
|
|
|
|
changed = True
|
|
|
|
if suffix != name.get_suffix():
|
|
|
|
changed = True
|
|
|
|
if self.use_patronymic:
|
|
|
|
if prefix != name.get_patronymic():
|
|
|
|
changed = True
|
|
|
|
elif prefix != name.get_surname_prefix():
|
|
|
|
changed = True
|
|
|
|
if surname.upper() != name.get_surname().upper():
|
|
|
|
changed = True
|
|
|
|
if ntype != const.NameTypesMap.find_value(name.get_type()):
|
|
|
|
changed = True
|
|
|
|
if given != name.get_first_name():
|
|
|
|
changed = True
|
|
|
|
if title != name.get_title():
|
|
|
|
changed = True
|
|
|
|
if self.pname.get_note() != name.get_note():
|
|
|
|
changed = True
|
|
|
|
if not self.lds_not_loaded and self.check_lds():
|
|
|
|
changed = True
|
|
|
|
|
2005-04-19 09:50:17 +05:30
|
|
|
(female,male,unknown) = _select_gender[self.gender.get_active()]
|
|
|
|
|
2005-02-19 10:11:59 +05:30
|
|
|
if male and self.person.get_gender() != RelLib.Person.MALE:
|
|
|
|
changed = True
|
|
|
|
elif female and self.person.get_gender() != RelLib.Person.FEMALE:
|
|
|
|
changed = True
|
|
|
|
elif unknown and self.person.get_gender() != RelLib.Person.UNKNOWN:
|
|
|
|
changed = True
|
|
|
|
if text != self.person.get_note():
|
|
|
|
changed = True
|
|
|
|
if format != self.person.get_note_format():
|
|
|
|
changed = True
|
|
|
|
|
|
|
|
if not self.lds_not_loaded:
|
|
|
|
if not self.lds_baptism.are_equal(self.person.get_lds_baptism()):
|
|
|
|
changed= True
|
|
|
|
|
|
|
|
if not self.lds_endowment.are_equal(self.person.get_lds_endowment()):
|
|
|
|
changed = True
|
|
|
|
|
|
|
|
if not self.lds_sealing.are_equal(self.person.get_lds_sealing()):
|
|
|
|
changed = True
|
|
|
|
|
|
|
|
return changed
|
|
|
|
|
|
|
|
def check_lds(self):
|
|
|
|
self.lds_baptism.set_date(unicode(self.ldsbap_date.get_text()))
|
2005-02-23 10:00:08 +05:30
|
|
|
temple = _temple_names[self.ldsbap_temple.get_active()]
|
2005-02-19 10:11:59 +05:30
|
|
|
if const.lds_temple_codes.has_key(temple):
|
|
|
|
self.lds_baptism.set_temple(const.lds_temple_codes[temple])
|
|
|
|
else:
|
|
|
|
self.lds_baptism.set_temple("")
|
|
|
|
self.lds_baptism.set_place_handle(self.get_place(self.ldsbapplace,1))
|
|
|
|
|
|
|
|
self.lds_endowment.set_date(unicode(self.ldsend_date.get_text()))
|
2005-02-23 10:00:08 +05:30
|
|
|
temple = _temple_names[self.ldsend_temple.get_active()]
|
2005-02-19 10:11:59 +05:30
|
|
|
if const.lds_temple_codes.has_key(temple):
|
|
|
|
self.lds_endowment.set_temple(const.lds_temple_codes[temple])
|
|
|
|
else:
|
|
|
|
self.lds_endowment.set_temple("")
|
|
|
|
self.lds_endowment.set_place_handle(self.get_place(self.ldsendowplace,1))
|
|
|
|
|
|
|
|
self.lds_sealing.set_date(unicode(self.ldsseal_date.get_text()))
|
2005-02-23 10:00:08 +05:30
|
|
|
temple = _temple_names[self.ldsseal_temple.get_active()]
|
2005-02-19 10:11:59 +05:30
|
|
|
if const.lds_temple_codes.has_key(temple):
|
|
|
|
self.lds_sealing.set_temple(const.lds_temple_codes[temple])
|
|
|
|
else:
|
|
|
|
self.lds_sealing.set_temple("")
|
|
|
|
self.lds_sealing.set_family_handle(self.ldsfam)
|
|
|
|
self.lds_sealing.set_place_handle(self.get_place(self.ldssealplace,1))
|
|
|
|
|
|
|
|
def on_event_delete_clicked(self,obj):
|
|
|
|
"""Delete the selected event"""
|
|
|
|
if Utils.delete_selected(obj,self.elist):
|
|
|
|
self.lists_changed = True
|
|
|
|
self.redraw_event_list()
|
|
|
|
|
|
|
|
def update_birth_death(self):
|
2005-04-19 09:50:17 +05:30
|
|
|
pass
|
2005-02-19 10:11:59 +05:30
|
|
|
|
|
|
|
def on_update_attr_clicked(self,obj):
|
|
|
|
import AttrEdit
|
|
|
|
store,node = self.atree.get_selected()
|
|
|
|
if node:
|
|
|
|
attr = self.atree.get_object(node)
|
|
|
|
pname = self.name_display.display(self.person)
|
|
|
|
AttrEdit.AttributeEditor(self,attr,pname,const.personalAttributes,
|
2005-04-02 11:42:46 +05:30
|
|
|
self.attr_edit_callback,self.window)
|
2005-02-19 10:11:59 +05:30
|
|
|
|
|
|
|
def on_update_addr_clicked(self,obj):
|
|
|
|
import AddrEdit
|
|
|
|
store,node = self.ptree.get_selected()
|
|
|
|
if node:
|
2005-02-27 11:21:59 +05:30
|
|
|
AddrEdit.AddressEditor(
|
2005-03-08 08:44:25 +05:30
|
|
|
self, self.ptree.get_object(node), self.addr_edit_callback,
|
2005-04-02 11:42:46 +05:30
|
|
|
self.window)
|
2005-02-19 10:11:59 +05:30
|
|
|
|
|
|
|
def on_update_url_clicked(self,obj):
|
|
|
|
import UrlEdit
|
|
|
|
store,node = self.wtree.get_selected()
|
|
|
|
if node:
|
|
|
|
pname = self.name_display.display(self.person)
|
|
|
|
url = self.wtree.get_object(node)
|
|
|
|
UrlEdit.UrlEditor(self,pname,url,self.url_edit_callback,self.window)
|
|
|
|
|
|
|
|
def on_event_update_clicked(self,obj):
|
|
|
|
import EventEdit
|
|
|
|
|
|
|
|
store,node = self.etree.get_selected()
|
|
|
|
if not node:
|
|
|
|
return
|
|
|
|
pname = self.name_display.display(self.person)
|
|
|
|
event = self.etree.get_object(node)
|
2005-02-27 11:21:59 +05:30
|
|
|
EventEdit.EventEditor(
|
|
|
|
self,pname,const.personalEvents,
|
|
|
|
const.personal_events,event,None,0,
|
2005-04-02 11:03:06 +05:30
|
|
|
self.event_edit_callback,noedit=self.db.readonly)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_event_select_row(self,obj):
|
2005-04-19 09:50:17 +05:30
|
|
|
store,iter = obj.get_selected()
|
|
|
|
if iter:
|
|
|
|
self.event_delete_btn.set_sensitive(True)
|
|
|
|
self.event_edit_btn.set_sensitive(True)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-04-19 09:50:17 +05:30
|
|
|
self.event_delete_btn.set_sensitive(True)
|
|
|
|
self.event_edit_btn.set_sensitive(True)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_addr_select_row(self,obj):
|
2004-08-11 09:12:38 +05:30
|
|
|
store,node = self.ptree.get_selected()
|
|
|
|
if node:
|
2005-04-19 09:50:17 +05:30
|
|
|
self.addr_delete_btn.set_sensitive(True)
|
|
|
|
self.addr_edit_btn.set_sensitive(True)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-04-19 09:50:17 +05:30
|
|
|
self.addr_delete_btn.set_sensitive(False)
|
|
|
|
self.addr_edit_btn.set_sensitive(False)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_name_select_row(self,obj):
|
2004-08-11 09:12:38 +05:30
|
|
|
store,node = self.ntree.get_selected()
|
|
|
|
if node:
|
2005-04-19 09:50:17 +05:30
|
|
|
self.name_delete_btn.set_sensitive(True)
|
|
|
|
self.name_edit_btn.set_sensitive(True)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-04-19 09:50:17 +05:30
|
|
|
self.name_delete_btn.set_sensitive(False)
|
|
|
|
self.name_edit_btn.set_sensitive(False)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_web_select_row(self,obj):
|
2004-08-11 09:12:38 +05:30
|
|
|
store,node = self.wtree.get_selected()
|
|
|
|
if node:
|
2005-04-19 09:50:17 +05:30
|
|
|
self.web_go.set_sensitive(True)
|
|
|
|
self.web_delete_btn.set_sensitive(True)
|
|
|
|
self.web_edit_btn.set_sensitive(True)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-04-19 09:50:17 +05:30
|
|
|
self.web_go.set_sensitive(False)
|
|
|
|
self.web_delete_btn.set_sensitive(False)
|
|
|
|
self.web_edit_btn.set_sensitive(False)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_attr_select_row(self,obj):
|
2004-08-11 09:12:38 +05:30
|
|
|
store,node = self.atree.get_selected()
|
|
|
|
if node:
|
2005-04-19 09:50:17 +05:30
|
|
|
self.attr_delete_btn.set_sensitive(True)
|
|
|
|
self.attr_edit_btn.set_sensitive(True)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-04-19 09:50:17 +05:30
|
|
|
self.attr_delete_btn.set_sensitive(False)
|
|
|
|
self.attr_edit_btn.set_sensitive(False)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def aka_double_click(self,obj,event):
|
2002-11-21 10:11:40 +05:30
|
|
|
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.on_aka_update_clicked(obj)
|
2002-11-21 10:11:40 +05:30
|
|
|
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
2002-10-20 19:55:16 +05:30
|
|
|
menu = gtk.Menu()
|
|
|
|
item = gtk.TearoffMenuItem()
|
|
|
|
item.show()
|
|
|
|
menu.append(item)
|
2005-02-20 06:32:15 +05:30
|
|
|
if not self.db.readonly:
|
|
|
|
msg = _("Make the selected name the preferred name")
|
|
|
|
Utils.add_menuitem(menu,msg,None,self.change_name)
|
2003-10-20 08:17:03 +05:30
|
|
|
menu.popup(None,None,None,event.button,event.time)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_aka_update_clicked(self,obj):
|
|
|
|
import NameEdit
|
2004-08-11 09:12:38 +05:30
|
|
|
store,node = self.ntree.get_selected()
|
|
|
|
if node:
|
2005-02-27 11:21:59 +05:30
|
|
|
NameEdit.NameEditor(self, self.ntree.get_object(node),
|
2005-04-02 11:42:46 +05:30
|
|
|
self.name_edit_callback, self.window)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def load_photo(self,photo):
|
|
|
|
"""loads, scales, and displays the person's main photo"""
|
|
|
|
self.load_obj = photo
|
|
|
|
if photo == None:
|
2004-11-29 08:54:02 +05:30
|
|
|
self.person_photo.hide()
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
try:
|
2002-11-15 09:19:39 +05:30
|
|
|
i = pixbuf_new_from_file(photo)
|
2002-10-20 19:55:16 +05:30
|
|
|
ratio = float(max(i.get_height(),i.get_width()))
|
2005-04-19 09:50:17 +05:30
|
|
|
scale = float(100.0)/ratio
|
2002-10-20 19:55:16 +05:30
|
|
|
x = int(scale*(i.get_width()))
|
|
|
|
y = int(scale*(i.get_height()))
|
2002-11-15 09:19:39 +05:30
|
|
|
i = i.scale_simple(x,y,INTERP_BILINEAR)
|
2004-11-29 08:54:02 +05:30
|
|
|
self.person_photo.set_from_pixbuf(i)
|
|
|
|
self.person_photo.show()
|
2002-10-20 19:55:16 +05:30
|
|
|
except:
|
2004-11-29 08:54:02 +05:30
|
|
|
self.person_photo.hide()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def update_lists(self):
|
|
|
|
"""Updates the person's lists if anything has changed"""
|
|
|
|
if self.lists_changed:
|
2004-02-14 11:10:30 +05:30
|
|
|
self.person.set_event_list(self.elist)
|
|
|
|
self.person.set_alternate_names(self.nlist)
|
|
|
|
self.person.set_url_list(self.ulist)
|
|
|
|
self.person.set_attribute_list(self.alist)
|
|
|
|
self.person.set_address_list(self.plist)
|
2004-07-28 07:59:07 +05:30
|
|
|
self.person.set_birth_handle(self.birth.get_handle())
|
|
|
|
self.person.set_death_handle(self.death.get_handle())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_apply_person_clicked(self,obj):
|
2004-03-30 10:20:24 +05:30
|
|
|
|
2005-04-23 21:23:30 +05:30
|
|
|
if self.gender.get_active() == RelLib.Person.UNKNOWN:
|
2005-04-04 06:41:50 +05:30
|
|
|
dialog = QuestionDialog2(
|
|
|
|
_("Unknown gender specified"),
|
|
|
|
_("The gender of the person is currently unknown. "
|
|
|
|
"Usually, this is a mistake. You may choose to "
|
|
|
|
"either continue saving, or returning to the "
|
|
|
|
"Edit Person dialog to fix the problem."),
|
|
|
|
_("Continue saving"), _("Return to window"),
|
|
|
|
self.window)
|
|
|
|
if not dialog.run():
|
|
|
|
return
|
|
|
|
|
2004-12-03 07:19:09 +05:30
|
|
|
self.window.hide()
|
2004-08-13 10:04:07 +05:30
|
|
|
trans = self.db.transaction_begin()
|
2004-09-20 08:42:51 +05:30
|
|
|
|
2004-05-02 09:40:33 +05:30
|
|
|
surname = unicode(self.surname.get_text())
|
2003-12-17 10:53:16 +05:30
|
|
|
suffix = unicode(self.suffix.get_text())
|
|
|
|
prefix = unicode(self.prefix.get_text())
|
2004-08-04 10:23:29 +05:30
|
|
|
ntype = unicode(self.ntype_field.child.get_text())
|
2003-12-17 10:53:16 +05:30
|
|
|
given = unicode(self.given.get_text())
|
|
|
|
title = unicode(self.title.get_text())
|
|
|
|
idval = unicode(self.gid.get_text())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
name = self.pname
|
|
|
|
|
2004-06-27 08:40:06 +05:30
|
|
|
if idval != self.person.get_gramps_id():
|
2004-08-07 10:46:57 +05:30
|
|
|
person = self.db.get_person_from_gramps_id(idval)
|
2004-07-09 10:01:43 +05:30
|
|
|
if not person:
|
2004-06-27 08:40:06 +05:30
|
|
|
self.person.set_gramps_id(idval)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-01-01 09:57:15 +05:30
|
|
|
n = self.name_display.display(person)
|
2002-10-20 19:55:16 +05:30
|
|
|
msg1 = _("GRAMPS ID value was not changed.")
|
2003-02-27 05:59:37 +05:30
|
|
|
msg2 = _("You have attempted to change the GRAMPS ID to a value "
|
|
|
|
"of %(grampsid)s. This value is already used by %(person)s.") % {
|
2002-10-20 19:55:16 +05:30
|
|
|
'grampsid' : idval,
|
|
|
|
'person' : n }
|
2003-02-27 05:59:37 +05:30
|
|
|
WarningDialog(msg1,msg2)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if suffix != name.get_suffix():
|
|
|
|
name.set_suffix(suffix)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-10-09 07:05:58 +05:30
|
|
|
if self.use_patronymic:
|
|
|
|
if prefix != name.get_patronymic():
|
|
|
|
name.set_patronymic(prefix)
|
|
|
|
else:
|
|
|
|
if prefix != name.get_surname_prefix():
|
|
|
|
name.set_surname_prefix(prefix)
|
2002-12-04 10:28:07 +05:30
|
|
|
|
2004-01-21 05:00:15 +05:30
|
|
|
if const.NameTypesMap.has_value(ntype):
|
|
|
|
ntype = const.NameTypesMap.find_key(ntype)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
ntype = "Birth Name"
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if ntype != name.get_type():
|
|
|
|
name.set_type(ntype)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if surname != name.get_surname():
|
|
|
|
name.set_surname(surname)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if given != name.get_first_name():
|
|
|
|
name.set_first_name(given)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if title != name.get_title():
|
|
|
|
name.set_title(title)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
name.set_source_reference_list(self.pname.get_source_references())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-10-09 07:05:58 +05:30
|
|
|
if name != self.person.get_primary_name():
|
2004-02-14 11:10:30 +05:30
|
|
|
self.person.set_primary_name(name)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-06-13 20:38:07 +05:30
|
|
|
self.pdmap.clear()
|
2004-08-13 10:04:07 +05:30
|
|
|
for key in self.db.get_place_handles():
|
|
|
|
p = self.db.get_place_from_handle(key).get_display_info()
|
2003-06-13 20:38:07 +05:30
|
|
|
self.pdmap[p[0]] = key
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-03-14 03:40:40 +05:30
|
|
|
if not self.orig_birth.are_equal(self.birth):
|
|
|
|
if self.orig_birth.is_empty():
|
|
|
|
self.db.add_event(self.birth,trans)
|
|
|
|
self.person.set_birth_handle(self.birth.get_handle())
|
2004-03-30 10:20:24 +05:30
|
|
|
self.db.commit_event(self.birth,trans)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
# Update each of the families child lists to reflect any
|
|
|
|
# change in ordering due to the new birth date
|
2004-07-28 07:59:07 +05:30
|
|
|
family = self.person.get_main_parents_family_handle()
|
2002-10-20 19:55:16 +05:30
|
|
|
if (family):
|
2004-08-11 09:12:38 +05:30
|
|
|
f = self.db.find_family_from_handle(family,trans)
|
2004-07-28 07:59:07 +05:30
|
|
|
new_order = self.reorder_child_list(self.person,f.get_child_handle_list())
|
|
|
|
f.set_child_handle_list(new_order)
|
|
|
|
for (family, rel1, rel2) in self.person.get_parent_family_handle_list():
|
2004-08-11 09:12:38 +05:30
|
|
|
f = self.db.find_family_from_handle(family,trans)
|
2004-07-28 07:59:07 +05:30
|
|
|
new_order = self.reorder_child_list(self.person,f.get_child_handle_list())
|
|
|
|
f.set_child_handle_list(new_order)
|
2005-04-23 21:23:30 +05:30
|
|
|
|
2004-09-20 08:42:51 +05:30
|
|
|
error = False
|
2005-04-19 09:50:17 +05:30
|
|
|
(female,male,unknown) = _select_gender[self.gender.get_active()]
|
2005-02-01 09:16:29 +05:30
|
|
|
if male and self.person.get_gender() != RelLib.Person.MALE:
|
|
|
|
self.person.set_gender(RelLib.Person.MALE)
|
2004-07-28 07:59:07 +05:30
|
|
|
for temp_family in self.person.get_family_handle_list():
|
|
|
|
if self.person == temp_family.get_mother_handle():
|
|
|
|
if temp_family.get_father_handle() != None:
|
2004-09-20 08:42:51 +05:30
|
|
|
error = True
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
temp_family.set_mother_handle(None)
|
|
|
|
temp_family.set_father_handle(self.person)
|
2005-02-01 09:16:29 +05:30
|
|
|
elif female and self.person.get_gender() != RelLib.Person.FEMALE:
|
|
|
|
self.person.set_gender(RelLib.Person.FEMALE)
|
2004-07-28 07:59:07 +05:30
|
|
|
for temp_family in self.person.get_family_handle_list():
|
|
|
|
if self.person == temp_family.get_father_handle():
|
|
|
|
if temp_family.get_mother_handle() != None:
|
2004-09-20 08:42:51 +05:30
|
|
|
error = True
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
temp_family.set_father_handle(None)
|
|
|
|
temp_family.set_mother_handle(self.person)
|
2005-02-01 09:16:29 +05:30
|
|
|
elif unknown and self.person.get_gender() != RelLib.Person.UNKNOWN:
|
|
|
|
self.person.set_gender(RelLib.Person.UNKNOWN)
|
2004-07-28 07:59:07 +05:30
|
|
|
for temp_family in self.person.get_family_handle_list():
|
|
|
|
if self.person == temp_family.get_father_handle():
|
|
|
|
if temp_family.get_mother_handle() != None:
|
2004-09-20 08:42:51 +05:30
|
|
|
error = True
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
temp_family.set_father_handle(None)
|
|
|
|
temp_family.set_mother_handle(self.person)
|
|
|
|
if self.person == temp_family.get_mother_handle():
|
|
|
|
if temp_family.get_father_handle() != None:
|
2004-09-20 08:42:51 +05:30
|
|
|
error = True
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
temp_family.set_mother_handle(None)
|
|
|
|
temp_family.set_father_handle(self.person)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-10-04 02:34:54 +05:30
|
|
|
if error:
|
2003-02-24 10:21:57 +05:30
|
|
|
msg2 = _("Problem changing the gender")
|
2002-10-20 19:55:16 +05:30
|
|
|
msg = _("Changing the gender caused problems "
|
|
|
|
"with marriage information.\nPlease check "
|
|
|
|
"the person's marriages.")
|
2002-10-21 06:48:07 +05:30
|
|
|
ErrorDialog(msg)
|
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))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if text != self.person.get_note():
|
|
|
|
self.person.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.person.get_note_format():
|
|
|
|
self.person.set_note_format(format)
|
2003-12-10 19:51:48 +05:30
|
|
|
|
2005-02-20 03:41:51 +05:30
|
|
|
self.person.set_complete_flag(self.complete.get_active())
|
|
|
|
self.person.set_privacy(self.private.get_active())
|
2003-12-03 09:19:39 +05:30
|
|
|
|
2004-10-04 02:34:54 +05:30
|
|
|
if not self.lds_not_loaded:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.check_lds()
|
2004-08-11 09:12:38 +05:30
|
|
|
lds_ord = RelLib.LdsOrd(self.person.get_lds_baptism())
|
|
|
|
if not self.lds_baptism.are_equal(lds_ord):
|
2004-02-14 11:10:30 +05:30
|
|
|
self.person.set_lds_baptism(self.lds_baptism)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-08-11 09:12:38 +05:30
|
|
|
lds_ord = RelLib.LdsOrd(self.person.get_lds_endowment())
|
|
|
|
if not self.lds_endowment.are_equal(lds_ord):
|
2004-02-14 11:10:30 +05:30
|
|
|
self.person.set_lds_endowment(self.lds_endowment)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-08-11 09:12:38 +05:30
|
|
|
lds_ord = RelLib.LdsOrd(self.person.get_lds_sealing())
|
|
|
|
if not self.lds_sealing.are_equal(lds_ord):
|
2004-02-14 11:10:30 +05:30
|
|
|
self.person.set_lds_sealing(self.lds_sealing)
|
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.person.set_source_reference_list(self.srcreflist)
|
2004-09-20 08:42:51 +05:30
|
|
|
self.update_lists()
|
2003-10-29 10:34:43 +05:30
|
|
|
|
2004-09-29 08:49:01 +05:30
|
|
|
if not self.person.get_handle():
|
2004-08-29 01:19:34 +05:30
|
|
|
self.db.add_person(self.person, trans)
|
|
|
|
else:
|
2004-09-29 08:49:01 +05:30
|
|
|
if not self.person.get_gramps_id():
|
|
|
|
self.person.set_gramps_id(self.db.find_next_person_gramps_id())
|
2004-08-29 01:19:34 +05:30
|
|
|
self.db.commit_person(self.person, trans)
|
2004-05-19 11:43:36 +05:30
|
|
|
n = self.person.get_primary_name().get_regular_name()
|
2004-08-13 10:04:07 +05:30
|
|
|
self.db.transaction_commit(trans,_("Edit Person (%s)") % n)
|
2004-08-21 09:06:00 +05:30
|
|
|
if self.callback:
|
2005-02-27 11:21:59 +05:30
|
|
|
self.callback(self,self.retval)
|
2004-08-04 10:23:29 +05:30
|
|
|
self.close()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def get_place(self,field,makenew=0):
|
2004-08-24 09:18:15 +05:30
|
|
|
text = unicode(field.get_text().strip())
|
2002-10-20 19:55:16 +05:30
|
|
|
if text:
|
2003-06-13 20:38:07 +05:30
|
|
|
if self.pdmap.has_key(text):
|
2004-02-14 11:10:30 +05:30
|
|
|
return self.pdmap[text]
|
2002-10-20 19:55:16 +05:30
|
|
|
elif makenew:
|
2003-01-10 10:51:32 +05:30
|
|
|
place = RelLib.Place()
|
2002-10-20 19:55:16 +05:30
|
|
|
place.set_title(text)
|
2004-08-13 10:04:07 +05:30
|
|
|
trans = self.db.transaction_begin()
|
2004-06-27 23:38:19 +05:30
|
|
|
self.db.add_place(place,trans)
|
2005-02-27 11:21:59 +05:30
|
|
|
self.retval |= const.UPDATE_PLACE
|
2004-08-13 10:04:07 +05:30
|
|
|
self.db.transaction_commit(trans,_('Add Place (%s)' % text))
|
2004-07-28 07:59:07 +05:30
|
|
|
self.pdmap[text] = place.get_handle()
|
2002-10-20 19:55:16 +05:30
|
|
|
self.add_places.append(place)
|
2004-07-28 07:59:07 +05:30
|
|
|
return place.get_handle()
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-01-19 08:54:33 +05:30
|
|
|
return u""
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-01-19 08:54:33 +05:30
|
|
|
return u""
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-09-29 07:36:46 +05:30
|
|
|
def on_edit_name_clicked(self,obj):
|
|
|
|
import NameEdit
|
2004-10-01 00:02:56 +05:30
|
|
|
|
|
|
|
ntype = unicode(self.ntype_field.child.get_text())
|
|
|
|
self.pname.set_type(const.NameTypesMap.find_value(ntype))
|
|
|
|
self.pname.set_suffix(unicode(self.suffix.get_text()))
|
2004-10-04 09:58:58 +05:30
|
|
|
self.pname.set_surname(unicode(self.surname.get_text()))
|
2004-10-09 07:05:58 +05:30
|
|
|
if self.use_patronymic:
|
|
|
|
self.pname.set_patronymic(unicode(self.prefix.get_text()))
|
|
|
|
else:
|
|
|
|
self.pname.set_surname_prefix(unicode(self.prefix.get_text()))
|
2004-10-01 00:02:56 +05:30
|
|
|
self.pname.set_first_name(unicode(self.given.get_text()))
|
|
|
|
self.pname.set_title(unicode(self.title.get_text()))
|
|
|
|
|
2005-04-02 05:41:21 +05:30
|
|
|
NameEdit.NameEditor(self, self.pname, self.update_name, self.window)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-09-29 07:36:46 +05:30
|
|
|
def update_name(self,name):
|
|
|
|
self.write_primary_name()
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def on_ldsbap_source_clicked(self,obj):
|
2004-02-14 11:10:30 +05:30
|
|
|
Sources.SourceSelector(self.lds_baptism.get_source_references(),
|
2003-10-30 09:47:05 +05:30
|
|
|
self,self.update_ldsbap_list)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def update_ldsbap_list(self,list):
|
2004-02-14 11:10:30 +05:30
|
|
|
self.lds_baptism.set_source_reference_list(list)
|
2004-09-20 08:42:51 +05:30
|
|
|
self.lists_changed = True
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_ldsbap_note_clicked(self,obj):
|
|
|
|
import NoteEdit
|
2005-02-18 10:19:59 +05:30
|
|
|
NoteEdit.NoteEditor(self.lds_baptism,self,self.window,
|
|
|
|
readonly=self.db.readonly)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_ldsendow_source_clicked(self,obj):
|
2004-02-14 11:10:30 +05:30
|
|
|
Sources.SourceSelector(self.lds_endowment.get_source_references(),
|
2003-10-30 09:47:05 +05:30
|
|
|
self,self.set_ldsendow_list)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def set_ldsendow_list(self,list):
|
2004-02-14 11:10:30 +05:30
|
|
|
self.lds_endowment.set_source_reference_list(list)
|
2004-09-20 08:42:51 +05:30
|
|
|
self.lists_changed = True
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_ldsendow_note_clicked(self,obj):
|
|
|
|
import NoteEdit
|
2005-02-18 10:19:59 +05:30
|
|
|
NoteEdit.NoteEditor(self.lds_endowment,self,self.window,
|
|
|
|
readonly=self.db.readonly)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_ldsseal_source_clicked(self,obj):
|
2004-02-14 11:10:30 +05:30
|
|
|
Sources.SourceSelector(self.lds_sealing.get_source_references(),
|
2003-10-30 09:47:05 +05:30
|
|
|
self,self.lds_seal_list)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def lds_seal_list(self,list):
|
2004-02-14 11:10:30 +05:30
|
|
|
self.lds_sealing.set_source_reference_list(list)
|
2004-09-20 08:42:51 +05:30
|
|
|
self.lists_changed = True
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_ldsseal_note_clicked(self,obj):
|
|
|
|
import NoteEdit
|
2005-02-18 10:19:59 +05:30
|
|
|
NoteEdit.NoteEditor(self.lds_sealing,self,self.window,
|
|
|
|
readonly=self.db.readonly)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def load_person_image(self):
|
2004-02-21 11:41:59 +05:30
|
|
|
media_list = self.person.get_media_list()
|
|
|
|
if media_list:
|
|
|
|
ph = media_list[0]
|
2004-07-28 07:59:07 +05:30
|
|
|
object_handle = ph.get_reference_handle()
|
2004-08-11 09:12:38 +05:30
|
|
|
obj = self.db.get_object_from_handle(object_handle)
|
|
|
|
if self.load_obj != obj.get_path():
|
|
|
|
if obj.get_mime_type()[0:5] == "image":
|
|
|
|
self.load_photo(obj.get_path())
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
self.load_photo(None)
|
|
|
|
else:
|
|
|
|
self.load_photo(None)
|
|
|
|
|
|
|
|
def update_birth_info(self):
|
2005-04-19 09:50:17 +05:30
|
|
|
pass
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def update_death_info(self):
|
2005-04-19 09:50:17 +05:30
|
|
|
pass
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def on_switch_page(self,obj,a,page):
|
|
|
|
if page == 0:
|
|
|
|
self.load_person_image()
|
|
|
|
self.redraw_event_list()
|
2005-04-23 21:23:30 +05:30
|
|
|
elif page == 6 and self.not_loaded:
|
2004-09-20 08:42:51 +05:30
|
|
|
self.not_loaded = False
|
2005-04-23 21:23:30 +05:30
|
|
|
elif page == 8 and self.lds_not_loaded:
|
2004-09-20 08:42:51 +05:30
|
|
|
self.lds_not_loaded = False
|
2002-10-20 19:55:16 +05:30
|
|
|
self.draw_lds()
|
2004-08-20 17:41:56 +05:30
|
|
|
note_buf = self.notes_buffer
|
|
|
|
text = unicode(note_buf.get_text(note_buf.get_start_iter(),
|
2005-02-24 05:55:34 +05:30
|
|
|
note_buf.get_end_iter(),False))
|
2005-04-23 21:23:30 +05:30
|
|
|
if text:
|
|
|
|
Utils.bold_label(self.notes_label)
|
|
|
|
else:
|
|
|
|
Utils.unbold_label(self.notes_label)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-10-04 02:34:54 +05:30
|
|
|
if not self.lds_not_loaded:
|
2003-11-14 03:14:09 +05:30
|
|
|
self.check_lds()
|
2005-04-23 21:23:30 +05:30
|
|
|
if self.lds_baptism.is_empty() \
|
|
|
|
and self.lds_endowment.is_empty() \
|
|
|
|
and self.lds_sealing.is_empty():
|
|
|
|
Utils.unbold_label(self.lds_tab)
|
|
|
|
else:
|
|
|
|
Utils.bold_label(self.lds_tab)
|
2003-11-14 03:14:09 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def change_name(self,obj):
|
2003-06-14 06:28:38 +05:30
|
|
|
sel_objs = self.ntree.get_selected_objects()
|
|
|
|
if sel_objs:
|
2002-10-20 19:55:16 +05:30
|
|
|
old = self.pname
|
2003-06-14 06:28:38 +05:30
|
|
|
new = sel_objs[0]
|
2002-10-20 19:55:16 +05:30
|
|
|
self.nlist.remove(new)
|
|
|
|
self.nlist.append(old)
|
|
|
|
self.redraw_name_list()
|
2003-01-10 10:51:32 +05:30
|
|
|
self.pname = RelLib.Name(new)
|
2004-09-20 08:42:51 +05:30
|
|
|
self.lists_changed = True
|
2002-10-20 19:55:16 +05:30
|
|
|
self.write_primary_name()
|
|
|
|
|
|
|
|
def write_primary_name(self):
|
|
|
|
# initial values
|
2005-01-01 09:57:15 +05:30
|
|
|
name = '<span size="larger" weight="bold">%s</span>' % self.name_display.display(self.person)
|
2005-04-19 09:50:17 +05:30
|
|
|
# self.get_widget("activepersonTitle").set_text(name)
|
|
|
|
# self.get_widget("activepersonTitle").set_use_markup(True)
|
2004-02-14 11:10:30 +05:30
|
|
|
self.suffix.set_text(self.pname.get_suffix())
|
2004-10-09 07:05:58 +05:30
|
|
|
if self.use_patronymic:
|
|
|
|
self.prefix.set_text(self.pname.get_patronymic())
|
|
|
|
else:
|
|
|
|
self.prefix.set_text(self.pname.get_surname_prefix())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-05-02 09:40:33 +05:30
|
|
|
self.surname.set_text(self.pname.get_surname())
|
2004-02-14 11:10:30 +05:30
|
|
|
self.given.set_text(self.pname.get_first_name())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-08-04 10:23:29 +05:30
|
|
|
self.ntype_field.child.set_text(_(self.pname.get_type()))
|
2004-02-14 11:10:30 +05:30
|
|
|
self.title.set_text(self.pname.get_title())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-15 07:27:07 +05:30
|
|
|
def birth_dates_in_order(self,list):
|
|
|
|
"""Check any *valid* birthdates in the list to insure that they are in
|
|
|
|
numerically increasing order."""
|
2004-09-20 08:42:51 +05:30
|
|
|
inorder = True
|
2004-09-23 07:55:07 +05:30
|
|
|
prev_date = 0
|
2004-02-15 07:27:07 +05:30
|
|
|
for i in range(len(list)):
|
2004-07-28 07:59:07 +05:30
|
|
|
child_handle = list[i]
|
2004-08-07 10:46:57 +05:30
|
|
|
child = self.db.get_person_from_handle(child_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
if child.get_birth_handle():
|
* 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(child.get_birth_handle())
|
2004-09-23 07:55:07 +05:30
|
|
|
child_date = event.get_date_object().get_sort_value()
|
2004-02-19 10:37:46 +05:30
|
|
|
else:
|
2004-02-15 07:27:07 +05:30
|
|
|
continue
|
2004-02-20 06:22:24 +05:30
|
|
|
if (prev_date <= child_date): # <= allows for twins
|
2004-02-15 07:27:07 +05:30
|
|
|
prev_date = child_date
|
|
|
|
else:
|
2004-09-20 08:42:51 +05:30
|
|
|
inorder = False
|
2004-02-15 07:27:07 +05:30
|
|
|
return inorder
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-15 07:27:07 +05:30
|
|
|
def reorder_child_list(self, person, list):
|
|
|
|
"""Reorder the child list to put the specified person in his/her
|
|
|
|
correct birth order. Only check *valid* birthdates. Move the person
|
|
|
|
as short a distance as possible."""
|
2004-06-29 09:21:49 +05:30
|
|
|
|
2004-02-15 07:27:07 +05:30
|
|
|
if (self.birth_dates_in_order(list)):
|
|
|
|
return(list)
|
|
|
|
|
|
|
|
# Build the person's date string once
|
2004-07-28 07:59:07 +05:30
|
|
|
event_handle = person.get_birth_handle()
|
|
|
|
if event_handle:
|
* 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-09-23 07:55:07 +05:30
|
|
|
person_bday = event.get_date_object().get_sort_value()
|
2004-02-19 10:37:46 +05:30
|
|
|
else:
|
2004-09-23 07:55:07 +05:30
|
|
|
person_bday = 0
|
2004-02-15 07:27:07 +05:30
|
|
|
|
|
|
|
# First, see if the person needs to be moved forward in the list
|
2004-06-29 09:21:49 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
index = list.index(person.get_handle())
|
2004-02-15 07:27:07 +05:30
|
|
|
target = index
|
|
|
|
for i in range(index-1, -1, -1):
|
2004-08-07 10:46:57 +05:30
|
|
|
other = self.db.get_person_from_handle(list[i])
|
2004-07-28 07:59:07 +05:30
|
|
|
event_handle = other.get_birth_handle()
|
|
|
|
if event_handle:
|
* 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-09-23 07:55:07 +05:30
|
|
|
other_bday = event.get_date_object().get_sort_value()
|
|
|
|
if other_bday == 0:
|
2004-02-19 10:37:46 +05:30
|
|
|
continue;
|
2004-09-23 07:55:07 +05:30
|
|
|
if person_bday < other_bday:
|
2004-02-19 10:37:46 +05:30
|
|
|
target = i
|
|
|
|
else:
|
|
|
|
continue
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-15 07:27:07 +05:30
|
|
|
# Now try moving to a later position in the list
|
|
|
|
if (target == index):
|
|
|
|
for i in range(index, len(list)):
|
2004-08-07 10:46:57 +05:30
|
|
|
other = self.db.get_person_from_handle(list[i])
|
2004-07-28 07:59:07 +05:30
|
|
|
event_handle = other.get_birth_handle()
|
|
|
|
if event_handle:
|
* 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-09-23 07:55:07 +05:30
|
|
|
other_bday = event.get_date_object().get_sort_value()
|
|
|
|
if other_bday == "99999999":
|
2004-02-19 10:37:46 +05:30
|
|
|
continue;
|
2004-09-23 07:55:07 +05:30
|
|
|
if person_bday > other_bday:
|
2004-02-19 10:37:46 +05:30
|
|
|
target = i
|
|
|
|
else:
|
|
|
|
continue
|
2004-02-15 07:27:07 +05:30
|
|
|
|
|
|
|
# Actually need to move? Do it now.
|
|
|
|
if (target != index):
|
2004-07-28 07:59:07 +05:30
|
|
|
list.remove(person.get_handle())
|
|
|
|
list.insert(target,person.get_handle())
|
2004-02-15 07:27:07 +05:30
|
|
|
return list
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-04-27 04:47:51 +05:30
|
|
|
def short(val,size=60):
|
|
|
|
if len(val) > size:
|
|
|
|
return "%s..." % val[0:size]
|
|
|
|
else:
|
|
|
|
return val
|
2004-02-14 11:10:30 +05:30
|
|
|
|
|
|
|
def place_title(db,event):
|
2004-07-28 07:59:07 +05:30
|
|
|
pid = event.get_place_handle()
|
2004-02-14 11:10:30 +05:30
|
|
|
if pid:
|
2004-08-07 10:46:57 +05:30
|
|
|
return db.get_place_from_handle(pid).get_title()
|
2004-02-14 11:10:30 +05:30
|
|
|
else:
|
|
|
|
return u''
|
2004-05-02 09:40:33 +05:30
|
|
|
|
|
|
|
def build_dropdown(entry,strings):
|
2005-02-23 10:00:08 +05:30
|
|
|
store = gtk.ListStore(str)
|
2004-05-02 09:40:33 +05:30
|
|
|
for value in strings:
|
2004-08-11 09:12:38 +05:30
|
|
|
node = store.append()
|
2005-02-23 10:00:08 +05:30
|
|
|
store.set(node,0,unicode(value))
|
2004-05-02 09:40:33 +05:30
|
|
|
completion = gtk.EntryCompletion()
|
|
|
|
completion.set_text_column(0)
|
|
|
|
completion.set_model(store)
|
|
|
|
entry.set_completion(completion)
|
2005-02-23 10:00:08 +05:30
|
|
|
|
|
|
|
def build_combo(entry,strings):
|
|
|
|
cell = gtk.CellRendererText()
|
|
|
|
entry.pack_start(cell,True)
|
|
|
|
entry.add_attribute(cell,'text',0)
|
|
|
|
store = gtk.ListStore(str)
|
|
|
|
for value in strings:
|
|
|
|
node = store.append()
|
|
|
|
store.set(node,0,unicode(value))
|
|
|
|
entry.set_model(store)
|