2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2005-03-09 03:32:49 +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-11-18 09:56:06 +05:30
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
"""
|
|
|
|
The AddSpouse module provides the AddSpouse class that allows the user to
|
|
|
|
add a new spouse to the active person.
|
|
|
|
"""
|
|
|
|
|
|
|
|
__author__ = "Donald N. Allingham"
|
|
|
|
__version__ = "$Revision$"
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# internationalization
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2003-08-17 07:44:33 +05:30
|
|
|
from gettext import gettext as _
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GTK/Gnome modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import gtk.glade
|
2003-11-18 09:56:06 +05:30
|
|
|
import gnome
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import RelLib
|
|
|
|
import const
|
|
|
|
import Utils
|
2004-03-22 10:11:35 +05:30
|
|
|
import PeopleModel
|
2004-02-26 10:21:57 +05:30
|
|
|
import Date
|
2004-05-14 04:15:51 +05:30
|
|
|
import Marriage
|
2005-01-01 09:57:15 +05:30
|
|
|
import NameDisplay
|
2005-03-10 10:27:22 +05:30
|
|
|
from QuestionDialog import ErrorDialog
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# AddSpouse
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class AddSpouse:
|
|
|
|
"""
|
|
|
|
Displays the AddSpouse dialog, allowing the user to create a new
|
|
|
|
family with the passed person as one spouse, and another person to
|
|
|
|
be selected.
|
|
|
|
"""
|
2004-02-21 12:10:44 +05:30
|
|
|
def __init__(self,parent,db,person,update,addperson,family=None):
|
2002-10-20 19:55:16 +05:30
|
|
|
"""
|
|
|
|
Displays the AddSpouse dialog box.
|
|
|
|
|
|
|
|
db - database to which to add the new family
|
|
|
|
person - the current person, will be one of the parents
|
|
|
|
update - function that updates the family display
|
|
|
|
addperson - function that adds a person to the person view
|
|
|
|
"""
|
2004-02-21 12:10:44 +05:30
|
|
|
self.parent = parent
|
2002-10-20 19:55:16 +05:30
|
|
|
self.db = db
|
|
|
|
self.update = update
|
|
|
|
self.person = person
|
2004-03-22 10:11:35 +05:30
|
|
|
self.gender = self.person.get_gender()
|
2002-10-20 19:55:16 +05:30
|
|
|
self.addperson = addperson
|
2002-11-28 11:22:02 +05:30
|
|
|
self.active_family = family
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-03-22 10:11:35 +05:30
|
|
|
self.filter_func = self.likely_filter
|
|
|
|
|
|
|
|
# determine the gender of the people to be loaded into
|
|
|
|
# the potential spouse list. If Partners is selected, use
|
|
|
|
# the same gender as the current person.
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
birth_handle = self.person.get_birth_handle()
|
|
|
|
death_handle = self.person.get_death_handle()
|
2004-03-22 10:11:35 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
if 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
|
|
|
self.bday = self.db.get_event_from_handle(birth_handle).get_date_object()
|
2004-03-22 10:11:35 +05:30
|
|
|
else:
|
|
|
|
self.bday = Date.Date()
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
if death_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
|
|
|
self.dday = self.db.get_event_from_handle(death_handle).get_date_object()
|
2004-03-22 10:11:35 +05:30
|
|
|
else:
|
|
|
|
self.dday = Date.Date()
|
|
|
|
|
2003-08-17 07:44:33 +05:30
|
|
|
self.glade = gtk.glade.XML(const.gladeFile, "spouseDialog","gramps")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-03-22 10:11:35 +05:30
|
|
|
self.relation_def = self.glade.get_widget("reldef")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.rel_combo = self.glade.get_widget("rel_combo")
|
|
|
|
self.spouse_list = self.glade.get_widget("spouse_list")
|
2003-05-22 11:47:43 +05:30
|
|
|
self.showall = self.glade.get_widget('showall')
|
2002-11-25 10:00:36 +05:30
|
|
|
|
2004-03-22 10:11:35 +05:30
|
|
|
self.set_gender()
|
|
|
|
|
|
|
|
self.renderer = gtk.CellRendererText()
|
|
|
|
|
2004-06-27 23:38:19 +05:30
|
|
|
self.slist = PeopleModel.PeopleModel(self.db)
|
2004-03-22 10:11:35 +05:30
|
|
|
self.spouse_list.set_model(self.slist)
|
|
|
|
self.selection = self.spouse_list.get_selection()
|
|
|
|
self.selection.connect('changed',self.select_row)
|
|
|
|
self.add_columns(self.spouse_list)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.ok = self.glade.get_widget('spouse_ok')
|
|
|
|
self.ok.set_sensitive(0)
|
2005-01-01 09:57:15 +05:30
|
|
|
|
|
|
|
name = NameDisplay.displayer.display(person)
|
|
|
|
title = _("Choose Spouse/Partner of %s") % name
|
2003-03-06 11:42:51 +05:30
|
|
|
|
|
|
|
Utils.set_titles(self.glade.get_widget('spouseDialog'),
|
|
|
|
self.glade.get_widget('title'),title,
|
|
|
|
_('Choose Spouse/Partner'))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-03-22 10:11:35 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.glade.signal_autoconnect({
|
|
|
|
"on_select_spouse_clicked" : self.select_spouse_clicked,
|
2003-11-18 09:56:06 +05:30
|
|
|
"on_spouse_help_clicked" : self.on_spouse_help_clicked,
|
2003-05-22 11:47:43 +05:30
|
|
|
"on_show_toggled" : self.on_show_toggled,
|
2002-10-20 19:55:16 +05:30
|
|
|
"on_new_spouse_clicked" : self.new_spouse_clicked,
|
|
|
|
"destroy_passed_object" : Utils.destroy_passed_object
|
|
|
|
})
|
|
|
|
|
2004-12-25 00:16:34 +05:30
|
|
|
self.rel_combo.set_active(RelLib.Family.MARRIED)
|
2004-03-22 10:11:35 +05:30
|
|
|
self.update_data()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-03-22 10:11:35 +05:30
|
|
|
def add_columns(self,tree):
|
|
|
|
column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0)
|
2005-02-24 05:55:34 +05:30
|
|
|
column.set_resizable(True)
|
|
|
|
#column.set_clickable(True)
|
2004-03-22 10:11:35 +05:30
|
|
|
column.set_min_width(225)
|
|
|
|
tree.append_column(column)
|
|
|
|
column = gtk.TreeViewColumn(_('ID'), self.renderer,text=1)
|
2005-02-24 05:55:34 +05:30
|
|
|
column.set_resizable(True)
|
|
|
|
#column.set_clickable(True)
|
2004-03-22 10:11:35 +05:30
|
|
|
column.set_min_width(75)
|
|
|
|
tree.append_column(column)
|
|
|
|
column = gtk.TreeViewColumn(_('Birth date'), self.renderer,text=3)
|
2005-02-24 05:55:34 +05:30
|
|
|
#column.set_resizable(True)
|
|
|
|
column.set_clickable(True)
|
2004-03-22 10:11:35 +05:30
|
|
|
tree.append_column(column)
|
|
|
|
|
2003-11-18 09:56:06 +05:30
|
|
|
def on_spouse_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-quick')
|
2003-11-18 09:56:06 +05:30
|
|
|
|
2004-03-22 10:11:35 +05:30
|
|
|
def get_selected_ids(self):
|
|
|
|
mlist = []
|
|
|
|
self.selection.selected_foreach(self.select_function,mlist)
|
|
|
|
return mlist
|
|
|
|
|
|
|
|
def select_function(self,store,path,iter,id_list):
|
2004-06-27 08:40:06 +05:30
|
|
|
id_list.append(store.get_value(iter,PeopleModel.COLUMN_INT_ID))
|
2004-03-22 10:11:35 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def select_row(self,obj):
|
|
|
|
"""
|
2003-05-22 11:47:43 +05:30
|
|
|
Called with a row has be unselected. Used to enable the OK button
|
2002-10-20 19:55:16 +05:30
|
|
|
when a row has been selected.
|
|
|
|
"""
|
2004-03-22 10:11:35 +05:30
|
|
|
idlist = self.get_selected_ids()
|
|
|
|
if idlist and idlist[0]:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.ok.set_sensitive(1)
|
|
|
|
else:
|
|
|
|
self.ok.set_sensitive(0)
|
|
|
|
|
|
|
|
def new_spouse_clicked(self,obj):
|
|
|
|
"""
|
|
|
|
Called when the spouse to be added does not exist, and needs
|
|
|
|
to be created and added to the database
|
|
|
|
"""
|
2003-06-07 22:18:10 +05:30
|
|
|
import EditPerson
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-08-04 10:23:29 +05:30
|
|
|
relation = self.rel_combo.get_active()
|
2004-12-25 00:16:34 +05:30
|
|
|
if relation == RelLib.Family.CIVIL_UNION:
|
2005-02-01 09:16:29 +05:30
|
|
|
if self.person.get_gender() == RelLib.Person.MALE:
|
|
|
|
gen = RelLib.Person.MALE
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-02-01 09:16:29 +05:30
|
|
|
gen = RelLib.Person.FEMALE
|
|
|
|
elif self.person.get_gender() == RelLib.Person.MALE:
|
|
|
|
gen = RelLib.Person.FEMALE
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-02-01 09:16:29 +05:30
|
|
|
gen = RelLib.Person.MALE
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-06-07 22:18:10 +05:30
|
|
|
person = RelLib.Person()
|
2004-02-14 11:10:30 +05:30
|
|
|
person.set_gender(gen)
|
2004-02-21 12:10:44 +05:30
|
|
|
EditPerson.EditPerson(self.parent,person,self.db,self.update_list)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-03-22 10:11:35 +05:30
|
|
|
def update_list(self,epo,change):
|
2002-10-20 19:55:16 +05:30
|
|
|
"""
|
|
|
|
Updates the potential spouse list after a person has been added
|
|
|
|
to database. Called by the QuickAdd class when the dialog has
|
|
|
|
been closed.
|
|
|
|
"""
|
2003-07-03 09:02:46 +05:30
|
|
|
person = epo.person
|
2004-08-13 10:04:07 +05:30
|
|
|
trans = self.db.transaction_begin()
|
2004-08-11 09:12:38 +05:30
|
|
|
handle = self.db.add_person(person,trans)
|
2004-06-30 09:36:10 +05:30
|
|
|
|
2005-01-01 09:57:15 +05:30
|
|
|
n = NameDisplay.displayer.display(person)
|
2004-08-13 10:04:07 +05:30
|
|
|
self.db.transaction_commit(trans,_('Add Person (%s)' % n))
|
2002-10-20 19:55:16 +05:30
|
|
|
self.addperson(person)
|
2004-08-11 09:12:38 +05:30
|
|
|
self.update_data(handle)
|
2004-06-30 09:36:10 +05:30
|
|
|
|
|
|
|
self.slist = PeopleModel.PeopleModel(self.db)
|
|
|
|
self.slist.rebuild_data()
|
|
|
|
self.spouse_list.set_model(self.slist)
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
path = self.slist.on_get_path(person.get_handle())
|
2004-06-30 09:36:10 +05:30
|
|
|
top_path = self.slist.on_get_path(person.get_primary_name().get_surname())
|
|
|
|
self.spouse_list.expand_row(top_path,0)
|
|
|
|
self.selection.select_path(path)
|
|
|
|
#self.spouse_list.scroll_to_cell(path,None,1,0.5,0)
|
2004-03-22 10:11:35 +05:30
|
|
|
#self.slist.center_selected()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def select_spouse_clicked(self,obj):
|
|
|
|
"""
|
|
|
|
Called when the spouse to be added already exists and has been
|
|
|
|
selected from the list.
|
|
|
|
"""
|
|
|
|
|
2004-03-22 10:11:35 +05:30
|
|
|
idlist = self.get_selected_ids()
|
|
|
|
if not idlist or not idlist[0]:
|
2002-10-20 19:55:16 +05:30
|
|
|
return
|
|
|
|
|
2004-08-07 10:46:57 +05:30
|
|
|
spouse = self.db.get_person_from_handle(idlist[0])
|
2004-07-28 07:59:07 +05:30
|
|
|
spouse_id = spouse.get_handle()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
# don't do anything if the marriage already exists
|
2004-07-28 07:59:07 +05:30
|
|
|
for f in self.person.get_family_handle_list():
|
2004-08-20 03:05:16 +05:30
|
|
|
fam = self.db.get_family_from_handle(f)
|
2005-03-10 10:27:22 +05:30
|
|
|
if fam:
|
|
|
|
if spouse_id in \
|
|
|
|
(fam.get_mother_handle(),fam.get_father_handle()):
|
|
|
|
ErrorDialog(_("Error adding a spouse"),
|
|
|
|
_("The spouse is already present in this family"))
|
|
|
|
Utils.destroy_passed_object(obj)
|
|
|
|
return
|
|
|
|
if spouse_id in fam.get_child_handle_list():
|
|
|
|
ErrorDialog(_("Error adding a spouse"),
|
|
|
|
_("A person cannot be linked as his/her own parent"))
|
|
|
|
Utils.destroy_passed_object(obj)
|
|
|
|
return
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
trans = self.db.transaction_begin()
|
2004-03-30 10:20:24 +05:30
|
|
|
|
2002-11-28 11:22:02 +05:30
|
|
|
if not self.active_family:
|
2004-08-13 10:04:07 +05:30
|
|
|
self.active_family = RelLib.Family()
|
2004-08-20 09:06:32 +05:30
|
|
|
self.db.add_family(self.active_family,trans)
|
2004-07-28 07:59:07 +05:30
|
|
|
self.person.add_family_handle(self.active_family.get_handle())
|
2004-03-30 10:20:24 +05:30
|
|
|
self.db.commit_person(self.person,trans)
|
2004-07-12 05:23:02 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
spouse.add_family_handle(self.active_family.get_handle())
|
2004-03-30 10:20:24 +05:30
|
|
|
self.db.commit_person(spouse,trans)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-01 09:16:29 +05:30
|
|
|
if self.person.get_gender() == RelLib.Person.MALE:
|
2004-07-28 07:59:07 +05:30
|
|
|
self.active_family.set_mother_handle(spouse.get_handle())
|
|
|
|
self.active_family.set_father_handle(self.person.get_handle())
|
2005-03-09 03:32:49 +05:30
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
self.active_family.set_father_handle(spouse.get_handle())
|
|
|
|
self.active_family.set_mother_handle(self.person.get_handle())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-08-04 10:23:29 +05:30
|
|
|
rtype = self.rel_combo.get_active()
|
2004-03-30 10:20:24 +05:30
|
|
|
self.active_family.set_relationship(rtype)
|
|
|
|
self.db.commit_family(self.active_family,trans)
|
2004-08-13 10:04:07 +05:30
|
|
|
self.db.transaction_commit(trans,_("Add Spouse"))
|
2004-07-12 05:23:02 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
Utils.destroy_passed_object(obj)
|
2002-11-28 11:22:02 +05:30
|
|
|
self.update(self.active_family)
|
2004-04-17 00:45:02 +05:30
|
|
|
m = Marriage.Marriage(self.parent, self.active_family,
|
|
|
|
self.parent.db, self.parent.new_after_edit,
|
2005-03-09 03:32:49 +05:30
|
|
|
self.parent.family_view.load_family,
|
|
|
|
self.parent.source_view.build_tree)
|
2004-04-17 00:45:02 +05:30
|
|
|
m.on_add_clicked()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def relation_type_changed(self,obj):
|
|
|
|
self.update_data()
|
|
|
|
|
2004-03-22 10:11:35 +05:30
|
|
|
def all_filter(self, person):
|
|
|
|
return person.get_gender() != self.sgender
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-03-22 10:11:35 +05:30
|
|
|
def likely_filter(self, person):
|
|
|
|
if person.get_gender() == self.sgender:
|
|
|
|
return 0
|
2004-02-26 10:21:57 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
pd_id = person.get_death_handle()
|
|
|
|
pb_id = person.get_birth_handle()
|
2004-03-22 10:11:35 +05:30
|
|
|
|
|
|
|
if pd_id:
|
* 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
|
|
|
pdday = self.db.get_event_from_handle(pd_id).get_date_object()
|
2004-02-26 10:21:57 +05:30
|
|
|
else:
|
2004-03-22 10:11:35 +05:30
|
|
|
pdday = Date.Date()
|
2003-05-22 11:47:43 +05:30
|
|
|
|
2004-03-22 10:11:35 +05:30
|
|
|
if pb_id:
|
* 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
|
|
|
pbday = self.db.get_event_from_handle(pb_id).get_date_object()
|
2004-03-22 10:11:35 +05:30
|
|
|
else:
|
|
|
|
pbday = Date.Date()
|
|
|
|
|
|
|
|
if self.bday.get_year_valid():
|
|
|
|
if pbday.get_year_valid():
|
|
|
|
# reject if person birthdate differs more than
|
|
|
|
# 100 years from spouse birthdate
|
|
|
|
if abs(pbday.get_year() - self.bday.get_year()) > 100:
|
|
|
|
return 0
|
|
|
|
|
|
|
|
if pdday.get_year_valid():
|
|
|
|
# reject if person birthdate is after the spouse deathdate
|
2004-09-21 07:40:23 +05:30
|
|
|
if self.bday.get_year() + 10 > pdday.get_high_year():
|
2004-03-22 10:11:35 +05:30
|
|
|
return 0
|
|
|
|
|
|
|
|
# reject if person birthdate is more than 100 years
|
|
|
|
# before the spouse deathdate
|
2004-09-21 07:40:23 +05:30
|
|
|
if self.bday.get_high_year() + 100 < pdday.get_year():
|
2004-03-22 10:11:35 +05:30
|
|
|
return 0
|
|
|
|
|
|
|
|
if self.dday.get_year_valid():
|
|
|
|
if pbday.get_year_valid():
|
|
|
|
# reject if person deathdate was prior to
|
|
|
|
# the spouse birthdate
|
2004-09-21 07:40:23 +05:30
|
|
|
if self.dday.get_high_year() < pbday.get_year() + 10:
|
2004-03-22 10:11:35 +05:30
|
|
|
return 0
|
|
|
|
|
|
|
|
if pdday.get_year_valid():
|
|
|
|
# reject if person deathdate differs more than
|
|
|
|
# 100 years from spouse deathdate
|
|
|
|
if abs(pdday.get_year() - self.dday.get_year()) > 100:
|
|
|
|
return 0
|
|
|
|
return 1
|
|
|
|
|
|
|
|
def set_gender(self):
|
2004-12-25 00:16:34 +05:30
|
|
|
if self.rel_combo.get_active() == RelLib.Family.CIVIL_UNION:
|
2005-02-01 09:16:29 +05:30
|
|
|
if self.gender == RelLib.Person.MALE:
|
|
|
|
self.sgender = RelLib.Person.FEMALE
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-02-01 09:16:29 +05:30
|
|
|
self.sgender = RelLib.Person.MALE
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-02-01 09:16:29 +05:30
|
|
|
if self.gender == RelLib.Person.MALE:
|
|
|
|
self.sgender = RelLib.Person.MALE
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-02-01 09:16:29 +05:30
|
|
|
self.sgender = RelLib.Person.FEMALE
|
2004-03-22 10:11:35 +05:30
|
|
|
|
|
|
|
def update_data(self,person = None):
|
|
|
|
"""
|
|
|
|
Called whenever the relationship type changes. Rebuilds the
|
|
|
|
the potential spouse list.
|
|
|
|
"""
|
|
|
|
|
2004-06-27 23:38:19 +05:30
|
|
|
self.slist = PeopleModel.PeopleModel(self.db)
|
2004-03-22 10:11:35 +05:30
|
|
|
self.spouse_list.set_model(self.slist)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-05-22 11:47:43 +05:30
|
|
|
def on_show_toggled(self,obj):
|
2004-03-22 10:11:35 +05:30
|
|
|
if self.filter_func == self.likely_filter:
|
|
|
|
self.filter_func = self.all_filter
|
|
|
|
else:
|
|
|
|
self.filter_func = self.likely_filter
|
2003-05-22 11:47:43 +05:30
|
|
|
self.update_data()
|