2003-08-15 04:03:30 +05:30
|
|
|
|
# -*- coding: utf-8 -*-
|
2002-10-20 19:55:16 +05:30
|
|
|
|
#
|
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
|
#
|
2005-02-16 19:19:32 +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-20 10:29:36 +05:30
|
|
|
|
|
2003-10-13 09:53:34 +05:30
|
|
|
|
# $Id$
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2005-02-16 19:19:32 +05:30
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
# Python modules
|
|
|
|
|
#
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
from gettext import gettext as _
|
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
# GTK/Gnome modules
|
|
|
|
|
#
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
import gtk
|
|
|
|
|
import gtk.glade
|
2003-01-10 10:51:32 +05:30
|
|
|
|
from gtk.gdk import ACTION_COPY, BUTTON1_MASK
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
# gramps modules
|
|
|
|
|
#
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
import const
|
|
|
|
|
import Utils
|
2005-01-06 22:58:31 +05:30
|
|
|
|
import GrampsKeys
|
2002-10-20 19:55:16 +05:30
|
|
|
|
import AddSpouse
|
2002-11-03 02:49:58 +05:30
|
|
|
|
import SelectChild
|
2002-10-20 19:55:16 +05:30
|
|
|
|
import DisplayTrace
|
|
|
|
|
import Marriage
|
|
|
|
|
import ChooseParents
|
2003-06-15 09:43:16 +05:30
|
|
|
|
import RelLib
|
|
|
|
|
import EditPerson
|
2004-09-25 10:42:15 +05:30
|
|
|
|
import DateHandler
|
2004-11-19 01:51:06 +05:30
|
|
|
|
import DisplayModels
|
2005-01-01 09:57:15 +05:30
|
|
|
|
import NameDisplay
|
2003-01-10 10:51:32 +05:30
|
|
|
|
|
|
|
|
|
from QuestionDialog import QuestionDialog,WarningDialog
|
|
|
|
|
|
2005-03-26 02:35:09 +05:30
|
|
|
|
from DdTargets import DdTargets
|
|
|
|
|
|
2005-02-16 19:19:32 +05:30
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
# Constants
|
|
|
|
|
#
|
|
|
|
|
#-------------------------------------------------------------------------
|
2003-05-24 09:10:58 +05:30
|
|
|
|
_BORN = _('b.')
|
|
|
|
|
_DIED = _('d.')
|
|
|
|
|
|
2004-11-19 06:44:37 +05:30
|
|
|
|
|
2004-11-19 01:51:06 +05:30
|
|
|
|
column_names = [
|
|
|
|
|
(_('#'),0) ,
|
|
|
|
|
(_('ID'),1) ,
|
|
|
|
|
(_('Name'),9),
|
|
|
|
|
(_('Gender'),3),
|
|
|
|
|
(_('Birth Date'),10),
|
|
|
|
|
(_('Death Date'),11),
|
|
|
|
|
(_('Birth Place'),6),
|
|
|
|
|
(_('Death Place'),7),
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
_HANDLE_COL = 8
|
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
# FamilyView
|
|
|
|
|
#
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
class FamilyView:
|
|
|
|
|
|
|
|
|
|
def __init__(self,parent):
|
|
|
|
|
self.parent = parent
|
|
|
|
|
self.top = parent.gtop
|
2003-08-26 09:15:41 +05:30
|
|
|
|
self.family = None
|
2003-08-28 07:20:29 +05:30
|
|
|
|
self.cadded = [ 0, 0 ]
|
2004-11-19 06:44:37 +05:30
|
|
|
|
self.in_drag = False
|
2003-08-26 09:15:41 +05:30
|
|
|
|
self.init_interface()
|
2005-04-01 11:03:22 +05:30
|
|
|
|
self.change_db()
|
|
|
|
|
|
|
|
|
|
def change_db(self):
|
2005-04-02 01:34:12 +05:30
|
|
|
|
self.parent.db.connect('family-add', self.update_callback)
|
|
|
|
|
self.parent.db.connect('family-update', self.update_callback)
|
|
|
|
|
self.parent.db.connect('family-delete', self.update_callback)
|
|
|
|
|
self.parent.db.connect('family-rebuild', self.load_family)
|
|
|
|
|
|
|
|
|
|
self.parent.db.connect('person-add', self.update_callback)
|
|
|
|
|
self.parent.db.connect('person-update', self.update_callback)
|
|
|
|
|
self.parent.db.connect('person-delete', self.update_callback)
|
|
|
|
|
self.parent.db.connect('person-rebuild', self.load_family)
|
2005-04-01 11:03:22 +05:30
|
|
|
|
|
|
|
|
|
def update_callback(self,handle):
|
|
|
|
|
self.load_family()
|
2003-08-26 09:15:41 +05:30
|
|
|
|
|
|
|
|
|
def set_widgets(self,val):
|
2003-10-17 09:54:36 +05:30
|
|
|
|
already_init = self.cadded[val]
|
2004-11-19 01:51:06 +05:30
|
|
|
|
|
|
|
|
|
self.columns = []
|
2003-08-26 09:15:41 +05:30
|
|
|
|
if (val):
|
|
|
|
|
self.ap_data = self.top.get_widget('ap_data2')
|
|
|
|
|
self.swap_btn = self.top.get_widget('swap_btn2')
|
|
|
|
|
self.ap_parents = self.top.get_widget('ap_parents2')
|
|
|
|
|
self.add_spouse_btn = self.top.get_widget('add_spouse2')
|
|
|
|
|
self.sp_parents = self.top.get_widget('sp_parents2')
|
|
|
|
|
self.spouse_list = self.top.get_widget('sp_list2')
|
|
|
|
|
self.select_spouse_btn = self.top.get_widget('select_spouse2')
|
|
|
|
|
self.remove_spouse_btn = self.top.get_widget('remove_spouse2')
|
|
|
|
|
self.child_list = self.top.get_widget('chlist2')
|
2003-11-20 10:29:36 +05:30
|
|
|
|
self.ap_swap_arrow = "Right"
|
|
|
|
|
self.sp_swap_arrow = "Left"
|
|
|
|
|
self.ap_par_arrow = "Down"
|
|
|
|
|
self.sp_par_arrow = "Down"
|
|
|
|
|
self.child_arrow = "Up"
|
2003-10-17 09:54:36 +05:30
|
|
|
|
if not already_init:
|
2004-03-30 10:20:24 +05:30
|
|
|
|
self.top.get_widget('add_parents2').connect('clicked',
|
|
|
|
|
self.add_parents_clicked)
|
|
|
|
|
self.top.get_widget('del_parents2').connect('clicked',
|
|
|
|
|
self.del_parents_clicked)
|
|
|
|
|
self.top.get_widget('add_spparents2').connect('clicked',
|
|
|
|
|
self.add_sp_parents)
|
|
|
|
|
self.top.get_widget('del_spparents2').connect('clicked',
|
|
|
|
|
self.del_sp_parents)
|
|
|
|
|
self.top.get_widget('fam_back2').connect('clicked',
|
|
|
|
|
self.child_back)
|
|
|
|
|
self.top.get_widget('del_child_btn2').connect('clicked',
|
|
|
|
|
self.remove_child_clicked)
|
|
|
|
|
self.top.get_widget('add_child_btn2').connect('clicked',
|
|
|
|
|
self.add_child_clicked)
|
|
|
|
|
self.top.get_widget('select_child2').connect('clicked',
|
|
|
|
|
self.select_child_clicked)
|
|
|
|
|
self.top.get_widget('ap_parents_btn2').connect('clicked',
|
|
|
|
|
self.ap_parents_clicked)
|
|
|
|
|
self.top.get_widget('sp_parents_btn2').connect('clicked',
|
|
|
|
|
self.sp_parents_clicked)
|
2004-11-19 06:44:37 +05:30
|
|
|
|
|
2003-09-03 10:27:36 +05:30
|
|
|
|
self.parent.views.get_nth_page(2).show_all()
|
|
|
|
|
if self.parent.views.get_current_page() == 1:
|
|
|
|
|
self.parent.views.set_current_page(2)
|
|
|
|
|
self.parent.views.get_nth_page(1).hide()
|
2003-08-26 09:15:41 +05:30
|
|
|
|
else:
|
|
|
|
|
self.ap_data = self.top.get_widget('ap_data')
|
|
|
|
|
self.swap_btn = self.top.get_widget('swap_spouse_btn')
|
|
|
|
|
self.ap_parents = self.top.get_widget('ap_parents')
|
|
|
|
|
self.add_spouse_btn = self.top.get_widget('add_spouse')
|
|
|
|
|
self.sp_parents = self.top.get_widget('sp_parents')
|
|
|
|
|
self.spouse_list = self.top.get_widget('sp_list')
|
|
|
|
|
self.select_spouse_btn = self.top.get_widget('select_spouse')
|
|
|
|
|
self.remove_spouse_btn = self.top.get_widget('remove_spouse')
|
|
|
|
|
self.child_list = self.top.get_widget('chlist')
|
2003-11-20 10:29:36 +05:30
|
|
|
|
self.ap_swap_arrow = "Down"
|
|
|
|
|
self.sp_swap_arrow = "Up"
|
|
|
|
|
self.ap_par_arrow = "Right"
|
|
|
|
|
self.sp_par_arrow = "Right"
|
|
|
|
|
self.child_arrow = "Left"
|
2003-10-17 09:54:36 +05:30
|
|
|
|
if not already_init:
|
2004-03-30 10:20:24 +05:30
|
|
|
|
self.top.get_widget('add_parents').connect('clicked',
|
|
|
|
|
self.add_parents_clicked)
|
|
|
|
|
self.top.get_widget('del_parents').connect('clicked',
|
|
|
|
|
self.del_parents_clicked)
|
|
|
|
|
self.top.get_widget('add_spparents').connect('clicked',
|
|
|
|
|
self.add_sp_parents)
|
|
|
|
|
self.top.get_widget('del_spparents').connect('clicked',
|
|
|
|
|
self.del_sp_parents)
|
|
|
|
|
self.top.get_widget('fam_back').connect('clicked',
|
|
|
|
|
self.child_back)
|
|
|
|
|
self.top.get_widget('del_child_btn').connect('clicked',
|
|
|
|
|
self.remove_child_clicked)
|
|
|
|
|
self.top.get_widget('add_child_btn').connect('clicked',
|
|
|
|
|
self.add_child_clicked)
|
|
|
|
|
self.top.get_widget('select_child').connect('clicked',
|
|
|
|
|
self.select_child_clicked)
|
|
|
|
|
self.top.get_widget('ap_parents_btn').connect('clicked',
|
|
|
|
|
self.ap_parents_clicked)
|
|
|
|
|
self.top.get_widget('sp_parents_btn').connect('clicked',
|
|
|
|
|
self.sp_parents_clicked)
|
2005-02-17 04:19:54 +05:30
|
|
|
|
|
2003-09-03 10:27:36 +05:30
|
|
|
|
self.parent.views.get_nth_page(1).show_all()
|
|
|
|
|
if self.parent.views.get_current_page() == 2:
|
|
|
|
|
self.parent.views.set_current_page(1)
|
|
|
|
|
self.parent.views.get_nth_page(2).hide()
|
2003-08-26 09:15:41 +05:30
|
|
|
|
|
2004-11-19 06:44:37 +05:30
|
|
|
|
self.spouse_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
|
2005-03-26 02:35:09 +05:30
|
|
|
|
[DdTargets.SPOUSE.target()],
|
|
|
|
|
ACTION_COPY)
|
2004-11-19 06:44:37 +05:30
|
|
|
|
self.spouse_list.drag_source_set(BUTTON1_MASK,
|
2005-03-26 02:35:09 +05:30
|
|
|
|
[DdTargets.SPOUSE.target()],
|
|
|
|
|
ACTION_COPY)
|
2004-11-19 06:44:37 +05:30
|
|
|
|
self.spouse_list.connect('drag_data_get',
|
|
|
|
|
self.sp_drag_data_get)
|
|
|
|
|
self.spouse_list.connect('drag_data_received',
|
|
|
|
|
self.sp_drag_data_received)
|
|
|
|
|
|
2003-08-26 09:15:41 +05:30
|
|
|
|
def init_interface(self):
|
2005-01-06 22:58:31 +05:30
|
|
|
|
fv = GrampsKeys.get_family_view()
|
2003-08-28 07:20:29 +05:30
|
|
|
|
self.set_widgets(fv)
|
|
|
|
|
|
|
|
|
|
already_init = self.cadded[fv]
|
2003-08-26 09:15:41 +05:30
|
|
|
|
|
2004-11-25 23:40:06 +05:30
|
|
|
|
self.ap_model = gtk.ListStore(str)
|
2003-02-24 10:21:57 +05:30
|
|
|
|
self.ap_data.set_model(self.ap_model)
|
2003-08-28 07:20:29 +05:30
|
|
|
|
if not already_init:
|
|
|
|
|
column = gtk.TreeViewColumn('',gtk.CellRendererText(),text=0)
|
|
|
|
|
self.ap_data.append_column(column)
|
2003-11-20 10:29:36 +05:30
|
|
|
|
self.ap_data.connect('button-press-event',self.ap_button_press)
|
|
|
|
|
self.ap_data.connect('key-press-event',self.ap_key_press)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2004-11-25 23:40:06 +05:30
|
|
|
|
self.ap_parents_model = gtk.ListStore(str)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.ap_parents.set_model(self.ap_parents_model)
|
|
|
|
|
self.ap_selection = self.ap_parents.get_selection()
|
2003-08-28 07:20:29 +05:30
|
|
|
|
if not already_init:
|
|
|
|
|
column = gtk.TreeViewColumn('',gtk.CellRendererText(),text=0)
|
|
|
|
|
self.ap_parents.append_column(column)
|
2003-11-20 10:29:36 +05:30
|
|
|
|
self.ap_parents.connect('button-press-event',self.ap_par_button_press)
|
|
|
|
|
self.ap_parents.connect('key-press-event',self.ap_par_key_press)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2004-11-25 23:40:06 +05:30
|
|
|
|
self.sp_parents_model = gtk.ListStore(str)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.sp_parents.set_model(self.sp_parents_model)
|
|
|
|
|
self.sp_selection = self.sp_parents.get_selection()
|
2003-08-28 07:20:29 +05:30
|
|
|
|
if not already_init:
|
|
|
|
|
column = gtk.TreeViewColumn('',gtk.CellRendererText(),text=0)
|
|
|
|
|
self.sp_parents.append_column(column)
|
2003-11-20 10:29:36 +05:30
|
|
|
|
self.sp_parents.connect('button-press-event',self.sp_par_button_press)
|
|
|
|
|
self.sp_parents.connect('key-press-event',self.sp_par_key_press)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2004-11-25 23:40:06 +05:30
|
|
|
|
self.spouse_model = gtk.ListStore(str,str)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.spouse_list.set_model(self.spouse_model)
|
|
|
|
|
self.spouse_selection = self.spouse_list.get_selection()
|
2003-09-03 10:27:36 +05:30
|
|
|
|
if not already_init:
|
|
|
|
|
self.spouse_selection.connect('changed',self.spouse_changed)
|
2003-11-20 10:29:36 +05:30
|
|
|
|
self.spouse_list.connect('button-press-event',self.sp_button_press)
|
|
|
|
|
self.spouse_list.connect('key-press-event',self.sp_key_press)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2003-08-28 07:20:29 +05:30
|
|
|
|
if not already_init:
|
|
|
|
|
column = gtk.TreeViewColumn('',gtk.CellRendererText(),text=0)
|
|
|
|
|
self.spouse_list.append_column(column)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.selected_spouse = None
|
|
|
|
|
|
2005-03-10 07:08:08 +05:30
|
|
|
|
self.child_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
|
2005-04-06 14:58:54 +05:30
|
|
|
|
[DdTargets.CHILD.target(),
|
|
|
|
|
DdTargets.PERSON_LINK.target()],
|
2005-03-26 02:35:09 +05:30
|
|
|
|
ACTION_COPY)
|
|
|
|
|
self.child_list.drag_source_set(BUTTON1_MASK,
|
2005-04-06 14:58:54 +05:30
|
|
|
|
[DdTargets.CHILD.target(),
|
|
|
|
|
DdTargets.PERSON_LINK.target()],
|
2005-03-26 02:35:09 +05:30
|
|
|
|
ACTION_COPY)
|
2003-01-10 10:51:32 +05:30
|
|
|
|
self.child_list.connect('drag_data_get', self.drag_data_get)
|
|
|
|
|
self.child_list.connect('drag_data_received',self.drag_data_received)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2003-09-03 10:27:36 +05:30
|
|
|
|
if not already_init:
|
2004-06-27 08:40:06 +05:30
|
|
|
|
self.child_list.connect('button-press-event',
|
|
|
|
|
self.on_child_list_button_press)
|
2003-11-20 10:29:36 +05:30
|
|
|
|
self.child_list.connect('key-press-event',self.child_key_press)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2003-09-03 10:27:36 +05:30
|
|
|
|
self.swap_btn.connect('clicked',self.spouse_swap)
|
|
|
|
|
self.remove_spouse_btn.connect('clicked',self.remove_spouse)
|
|
|
|
|
self.add_spouse_btn.connect('clicked',self.add_spouse)
|
|
|
|
|
self.select_spouse_btn.connect('clicked',self.select_spouse)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2004-11-19 01:51:06 +05:30
|
|
|
|
if not already_init:
|
|
|
|
|
self.build_columns()
|
|
|
|
|
|
|
|
|
|
self.child_model = DisplayModels.ChildModel([],self.parent.db)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.child_list.set_model(self.child_model)
|
2004-11-19 01:51:06 +05:30
|
|
|
|
#self.child_list.set_search_column(2)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.child_selection = self.child_list.get_selection()
|
|
|
|
|
|
2003-08-28 07:20:29 +05:30
|
|
|
|
self.cadded[fv] = 1
|
2004-11-19 01:51:06 +05:30
|
|
|
|
|
|
|
|
|
def build_columns(self):
|
|
|
|
|
for column in self.columns:
|
|
|
|
|
self.child_list.remove_column(column)
|
|
|
|
|
self.columns = []
|
|
|
|
|
|
|
|
|
|
for pair in self.parent.db.get_child_column_order():
|
|
|
|
|
if not pair[0]:
|
|
|
|
|
continue
|
|
|
|
|
name = column_names[pair[1]][0]
|
|
|
|
|
column = gtk.TreeViewColumn(name, gtk.CellRendererText(),
|
|
|
|
|
text=pair[1])
|
2005-02-24 05:55:34 +05:30
|
|
|
|
column.set_resizable(True)
|
2004-11-19 01:51:06 +05:30
|
|
|
|
column.set_min_width(40)
|
|
|
|
|
column.set_sort_column_id(column_names[pair[1]][1])
|
|
|
|
|
self.columns.append(column)
|
|
|
|
|
self.child_list.append_column(column)
|
2003-08-28 07:20:29 +05:30
|
|
|
|
|
2003-11-20 10:29:36 +05:30
|
|
|
|
def ap_button_press(self,obj,event):
|
2003-02-24 10:21:57 +05:30
|
|
|
|
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
|
|
|
|
self.parent.load_person(self.person)
|
2005-04-04 09:29:42 +05:30
|
|
|
|
elif (event.type == gtk.gdk.BUTTON_PRESS and event.button == 3
|
|
|
|
|
and self.person):
|
2003-10-20 08:17:03 +05:30
|
|
|
|
self.build_ap_menu(event)
|
2003-08-25 05:12:42 +05:30
|
|
|
|
|
2003-11-20 10:29:36 +05:30
|
|
|
|
def ap_key_press(self,obj,event):
|
|
|
|
|
if event.keyval == gtk.gdk.keyval_from_name("Return") \
|
|
|
|
|
and not event.state:
|
|
|
|
|
self.parent.load_person(self.person)
|
|
|
|
|
elif event.keyval == gtk.gdk.keyval_from_name(self.ap_swap_arrow) \
|
|
|
|
|
and event.state == gtk.gdk.CONTROL_MASK:
|
|
|
|
|
self.spouse_swap(obj)
|
|
|
|
|
|
|
|
|
|
def sp_key_press(self,obj,event):
|
|
|
|
|
if event.keyval == gtk.gdk.keyval_from_name("Return") and not event.state:
|
|
|
|
|
if self.selected_spouse:
|
|
|
|
|
self.edit_marriage_callback(obj)
|
|
|
|
|
elif event.keyval == gtk.gdk.keyval_from_name("Return") \
|
|
|
|
|
and event.state == gtk.gdk.SHIFT_MASK:
|
|
|
|
|
self.edit_spouse_callback(obj)
|
|
|
|
|
elif event.keyval == gtk.gdk.keyval_from_name(self.sp_swap_arrow) \
|
|
|
|
|
and event.state == gtk.gdk.CONTROL_MASK:
|
|
|
|
|
self.spouse_swap(obj)
|
|
|
|
|
elif event.keyval == gtk.gdk.keyval_from_name("Delete") and not event.state:
|
2004-05-14 04:15:51 +05:30
|
|
|
|
self.remove_spouse(obj)
|
2003-11-20 10:29:36 +05:30
|
|
|
|
elif event.keyval == gtk.gdk.keyval_from_name("Insert") and not event.state:
|
|
|
|
|
self.select_spouse(obj)
|
|
|
|
|
elif event.keyval == gtk.gdk.keyval_from_name("Insert") \
|
2003-12-01 09:52:15 +05:30
|
|
|
|
and event.state == gtk.gdk.SHIFT_MASK:
|
2003-11-20 10:29:36 +05:30
|
|
|
|
self.add_spouse(obj)
|
|
|
|
|
|
|
|
|
|
def ap_par_key_press(self,obj,event):
|
|
|
|
|
if self.person == None:
|
|
|
|
|
return
|
|
|
|
|
if event.keyval == gtk.gdk.keyval_from_name("Return") and not event.state:
|
|
|
|
|
self.edit_ap_relationships(obj)
|
|
|
|
|
elif event.keyval == gtk.gdk.keyval_from_name(self.ap_par_arrow) \
|
|
|
|
|
and event.state == gtk.gdk.CONTROL_MASK:
|
|
|
|
|
self.ap_parents_clicked(obj)
|
|
|
|
|
elif event.keyval == gtk.gdk.keyval_from_name("Delete") and not event.state:
|
|
|
|
|
self.del_parents_clicked(obj)
|
|
|
|
|
elif event.keyval == gtk.gdk.keyval_from_name("Insert") and not event.state:
|
|
|
|
|
self.add_parents_clicked(obj)
|
|
|
|
|
|
|
|
|
|
def sp_par_key_press(self,obj,event):
|
|
|
|
|
if self.person == None:
|
|
|
|
|
return
|
|
|
|
|
if event.keyval == gtk.gdk.keyval_from_name("Return") and not event.state:
|
|
|
|
|
self.edit_sp_relationships(obj)
|
|
|
|
|
elif event.keyval == gtk.gdk.keyval_from_name(self.sp_par_arrow) \
|
|
|
|
|
and event.state == gtk.gdk.CONTROL_MASK:
|
|
|
|
|
self.sp_parents_clicked(obj)
|
|
|
|
|
elif event.keyval == gtk.gdk.keyval_from_name("Delete") and not event.state:
|
|
|
|
|
self.del_sp_parents(obj)
|
|
|
|
|
elif event.keyval == gtk.gdk.keyval_from_name("Insert") and not event.state:
|
|
|
|
|
self.add_sp_parents(obj)
|
|
|
|
|
|
|
|
|
|
def child_key_press(self,obj,event):
|
2004-10-06 09:12:54 +05:30
|
|
|
|
model, node = self.child_selection.get_selected()
|
|
|
|
|
if not node:
|
2003-11-20 10:29:36 +05:30
|
|
|
|
return
|
2004-11-19 01:51:06 +05:30
|
|
|
|
handle = self.child_model.get_value(node,_HANDLE_COL)
|
2003-11-20 10:29:36 +05:30
|
|
|
|
if event.keyval == gtk.gdk.keyval_from_name("Return") and not event.state:
|
2004-10-06 09:12:54 +05:30
|
|
|
|
self.child_rel_by_id(handle)
|
2003-11-20 10:29:36 +05:30
|
|
|
|
elif event.keyval == gtk.gdk.keyval_from_name("Return") \
|
|
|
|
|
and event.state == gtk.gdk.SHIFT_MASK:
|
|
|
|
|
self.edit_child_callback(obj)
|
|
|
|
|
elif event.keyval == gtk.gdk.keyval_from_name(self.child_arrow) \
|
|
|
|
|
and event.state == gtk.gdk.CONTROL_MASK:
|
|
|
|
|
self.child_back(obj)
|
|
|
|
|
elif event.keyval == gtk.gdk.keyval_from_name("Delete") and not event.state:
|
|
|
|
|
self.remove_child_clicked(obj)
|
|
|
|
|
elif event.keyval == gtk.gdk.keyval_from_name("Insert") and not event.state:
|
|
|
|
|
self.select_child_clicked(obj)
|
|
|
|
|
elif event.keyval == gtk.gdk.keyval_from_name("Insert") \
|
2003-12-01 09:52:15 +05:30
|
|
|
|
and event.state == gtk.gdk.SHIFT_MASK:
|
2003-11-20 10:29:36 +05:30
|
|
|
|
self.add_child_clicked(obj)
|
|
|
|
|
|
2003-10-20 08:17:03 +05:30
|
|
|
|
def build_ap_menu(self,event):
|
2003-08-25 05:12:42 +05:30
|
|
|
|
"""Builds the menu with navigation for the active person box"""
|
|
|
|
|
|
|
|
|
|
back_sensitivity = self.parent.hindex > 0
|
|
|
|
|
fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history)
|
|
|
|
|
entries = [
|
2005-02-20 06:32:15 +05:30
|
|
|
|
(gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity,False),
|
|
|
|
|
(gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity,False),
|
2004-01-20 21:36:17 +05:30
|
|
|
|
#FIXME: revert to stock item when German gtk translation is fixed
|
2005-03-10 05:58:57 +05:30
|
|
|
|
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
|
2005-02-20 06:32:15 +05:30
|
|
|
|
(_("Home"),self.parent.on_home_clicked,1,False),
|
|
|
|
|
(_("Add Bookmark"),self.parent.on_add_bookmark_activate,1,True),
|
2003-08-25 05:12:42 +05:30
|
|
|
|
]
|
2003-08-25 09:24:08 +05:30
|
|
|
|
menu = gtk.Menu()
|
|
|
|
|
menu.set_title(_('People Menu'))
|
2005-02-20 06:32:15 +05:30
|
|
|
|
for stock_id,callback,sensitivity,ro in entries:
|
|
|
|
|
if ro and self.parent.db.readonly:
|
|
|
|
|
continue
|
2003-08-25 09:24:08 +05:30
|
|
|
|
item = gtk.ImageMenuItem(stock_id)
|
2004-01-20 21:36:17 +05:30
|
|
|
|
#FIXME: remove when German gtk translation is fixed
|
2005-03-10 05:58:57 +05:30
|
|
|
|
if stock_id == _("Home"):
|
|
|
|
|
im = gtk.image_new_from_stock(gtk.STOCK_HOME,gtk.ICON_SIZE_MENU)
|
|
|
|
|
im.show()
|
|
|
|
|
item.set_image(im)
|
2003-08-25 09:24:08 +05:30
|
|
|
|
if callback:
|
|
|
|
|
item.connect("activate",callback)
|
|
|
|
|
item.set_sensitive(sensitivity)
|
|
|
|
|
item.show()
|
|
|
|
|
menu.append(item)
|
2003-10-20 08:17:03 +05:30
|
|
|
|
menu.popup(None,None,None,event.button,event.time)
|
2003-08-25 05:12:42 +05:30
|
|
|
|
|
2003-10-20 08:17:03 +05:30
|
|
|
|
def build_nav_menu(self,event):
|
2003-08-25 09:24:08 +05:30
|
|
|
|
"""Builds the menu with navigation (no bookmark)"""
|
|
|
|
|
|
|
|
|
|
back_sensitivity = self.parent.hindex > 0
|
|
|
|
|
fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history)
|
|
|
|
|
entries = [
|
2003-08-29 08:38:02 +05:30
|
|
|
|
(gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity),
|
|
|
|
|
(gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity),
|
2004-01-20 21:36:17 +05:30
|
|
|
|
#FIXME: revert to stock item when German gtk translation is fixed
|
2005-03-10 05:58:57 +05:30
|
|
|
|
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
|
2004-01-20 21:36:17 +05:30
|
|
|
|
(_("Home"),self.parent.on_home_clicked,1),
|
2003-08-25 09:24:08 +05:30
|
|
|
|
]
|
2003-08-25 05:12:42 +05:30
|
|
|
|
menu = gtk.Menu()
|
|
|
|
|
menu.set_title(_('People Menu'))
|
|
|
|
|
for stock_id,callback,sensitivity in entries:
|
|
|
|
|
item = gtk.ImageMenuItem(stock_id)
|
2004-01-20 21:36:17 +05:30
|
|
|
|
#FIXME: remove when German gtk translation is fixed
|
2005-03-10 05:58:57 +05:30
|
|
|
|
if stock_id == _("Home"):
|
|
|
|
|
im = gtk.image_new_from_stock(gtk.STOCK_HOME,gtk.ICON_SIZE_MENU)
|
|
|
|
|
im.show()
|
|
|
|
|
item.set_image(im)
|
2003-08-25 05:12:42 +05:30
|
|
|
|
if callback:
|
|
|
|
|
item.connect("activate",callback)
|
|
|
|
|
item.set_sensitive(sensitivity)
|
|
|
|
|
item.show()
|
|
|
|
|
menu.append(item)
|
2003-10-20 08:17:03 +05:30
|
|
|
|
menu.popup(None,None,None,event.button,event.time)
|
2003-02-24 10:21:57 +05:30
|
|
|
|
|
2003-10-20 08:17:03 +05:30
|
|
|
|
def build_parents_nosel_menu(self,event):
|
2003-08-30 06:46:40 +05:30
|
|
|
|
"""Builds the menu with navigation and Add parents"""
|
|
|
|
|
|
|
|
|
|
back_sensitivity = self.parent.hindex > 0
|
|
|
|
|
fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history)
|
|
|
|
|
entries = [
|
2005-02-20 06:32:15 +05:30
|
|
|
|
(gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity,False),
|
|
|
|
|
(gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity,False),
|
|
|
|
|
(gtk.STOCK_HOME,self.parent.on_home_clicked,1,False),
|
|
|
|
|
(None,None,0,True),
|
|
|
|
|
(_("Add parents"),self.add_parents_clicked,1,True),
|
2003-08-30 06:46:40 +05:30
|
|
|
|
]
|
2005-02-20 06:32:15 +05:30
|
|
|
|
|
2003-08-30 06:46:40 +05:30
|
|
|
|
menu = gtk.Menu()
|
|
|
|
|
menu.set_title(_('People Menu'))
|
2005-02-20 06:32:15 +05:30
|
|
|
|
|
|
|
|
|
for (stock_id,callback,sensitivity,ro) in entries:
|
|
|
|
|
if self.parent.db.readonly and ro:
|
|
|
|
|
continue
|
2003-08-30 06:46:40 +05:30
|
|
|
|
item = gtk.ImageMenuItem(stock_id)
|
2004-01-20 21:36:17 +05:30
|
|
|
|
#FIXME: remove when German gtk translation is fixed
|
2005-03-10 05:58:57 +05:30
|
|
|
|
if stock_id == _("Home"):
|
|
|
|
|
im = gtk.image_new_from_stock(gtk.STOCK_HOME,gtk.ICON_SIZE_MENU)
|
|
|
|
|
im.show()
|
|
|
|
|
item.set_image(im)
|
2003-08-30 06:46:40 +05:30
|
|
|
|
if callback:
|
|
|
|
|
item.connect("activate",callback)
|
|
|
|
|
item.set_sensitive(sensitivity)
|
|
|
|
|
item.show()
|
|
|
|
|
menu.append(item)
|
2003-10-20 08:17:03 +05:30
|
|
|
|
menu.popup(None,None,None,event.button,event.time)
|
2003-08-30 06:46:40 +05:30
|
|
|
|
|
2003-10-20 08:17:03 +05:30
|
|
|
|
def build_sp_parents_nosel_menu(self,event):
|
2003-08-30 06:46:40 +05:30
|
|
|
|
"""Builds the menu with navigation and Add parents"""
|
|
|
|
|
|
|
|
|
|
back_sensitivity = self.parent.hindex > 0
|
|
|
|
|
fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history)
|
|
|
|
|
entries = [
|
2005-02-20 06:32:15 +05:30
|
|
|
|
(gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity,False),
|
|
|
|
|
(gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity,False),
|
|
|
|
|
(gtk.STOCK_HOME,self.parent.on_home_clicked,1,False),
|
|
|
|
|
(None,None,0,True),
|
|
|
|
|
(_("Add parents"),self.add_sp_parents,1,True),
|
2003-08-30 06:46:40 +05:30
|
|
|
|
]
|
|
|
|
|
menu = gtk.Menu()
|
|
|
|
|
menu.set_title(_('People Menu'))
|
2005-02-20 06:32:15 +05:30
|
|
|
|
for stock_id,callback,sensitivity,ro in entries:
|
|
|
|
|
if ro and self.parent.db.readonly:
|
|
|
|
|
continue
|
2003-08-30 06:46:40 +05:30
|
|
|
|
item = gtk.ImageMenuItem(stock_id)
|
|
|
|
|
if callback:
|
|
|
|
|
item.connect("activate",callback)
|
|
|
|
|
item.set_sensitive(sensitivity)
|
|
|
|
|
item.show()
|
|
|
|
|
menu.append(item)
|
2003-10-20 08:17:03 +05:30
|
|
|
|
menu.popup(None,None,None,event.button,event.time)
|
2003-08-30 06:46:40 +05:30
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
def on_child_list_button_press(self,obj,event):
|
2004-10-06 09:12:54 +05:30
|
|
|
|
model, node = self.child_selection.get_selected()
|
|
|
|
|
if not node:
|
2003-08-25 09:24:08 +05:30
|
|
|
|
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
2003-10-20 08:17:03 +05:30
|
|
|
|
self.build_nav_menu(event)
|
2003-06-17 09:45:58 +05:30
|
|
|
|
return
|
2004-11-19 01:51:06 +05:30
|
|
|
|
handle = self.child_model.get_value(node,_HANDLE_COL)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
2004-10-06 09:12:54 +05:30
|
|
|
|
self.child_rel_by_id(handle)
|
2003-12-01 09:52:15 +05:30
|
|
|
|
elif event.state == gtk.gdk.SHIFT_MASK and \
|
|
|
|
|
event.type == gtk.gdk.BUTTON_PRESS and \
|
|
|
|
|
event.button == 1:
|
|
|
|
|
self.edit_child_callback(obj)
|
2003-06-17 09:45:58 +05:30
|
|
|
|
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
2004-10-06 09:12:54 +05:30
|
|
|
|
self.build_child_menu(handle,event)
|
2003-08-01 09:08:51 +05:30
|
|
|
|
|
2004-10-06 09:12:54 +05:30
|
|
|
|
def build_child_menu(self,handle,event):
|
2003-08-01 09:08:51 +05:30
|
|
|
|
"""Builds the menu that allows editing operations on the child list"""
|
2003-08-25 05:12:42 +05:30
|
|
|
|
|
|
|
|
|
menu = gtk.Menu()
|
|
|
|
|
menu.set_title(_('Child Menu'))
|
|
|
|
|
|
|
|
|
|
back_sensitivity = self.parent.hindex > 0
|
|
|
|
|
fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history)
|
|
|
|
|
nav_entries = [
|
2003-08-29 08:38:02 +05:30
|
|
|
|
(gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity),
|
|
|
|
|
(gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity),
|
2004-01-20 21:36:17 +05:30
|
|
|
|
#FIXME: revert to stock item when German gtk translation is fixed
|
2005-03-10 05:58:57 +05:30
|
|
|
|
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
|
2004-01-20 21:36:17 +05:30
|
|
|
|
(_("Home"),self.parent.on_home_clicked,1),
|
2003-08-25 05:12:42 +05:30
|
|
|
|
(None,None,0),
|
|
|
|
|
]
|
|
|
|
|
for stock_id,callback,sensitivity in nav_entries:
|
|
|
|
|
item = gtk.ImageMenuItem(stock_id)
|
2004-01-20 21:36:17 +05:30
|
|
|
|
#FIXME: remove when German gtk translation is fixed
|
2005-03-10 05:58:57 +05:30
|
|
|
|
if stock_id == _("Home"):
|
|
|
|
|
im = gtk.image_new_from_stock(gtk.STOCK_HOME,gtk.ICON_SIZE_MENU)
|
|
|
|
|
im.show()
|
|
|
|
|
item.set_image(im)
|
2003-08-25 05:12:42 +05:30
|
|
|
|
if callback:
|
|
|
|
|
item.connect("activate",callback)
|
|
|
|
|
item.set_sensitive(sensitivity)
|
|
|
|
|
item.show()
|
|
|
|
|
menu.append(item)
|
|
|
|
|
|
2003-08-01 09:08:51 +05:30
|
|
|
|
entries = [
|
2003-08-30 06:46:40 +05:30
|
|
|
|
(_("Make the selected child an active person"), self.child_back),
|
2003-08-01 09:08:51 +05:30
|
|
|
|
(_("Edit the child/parent relationships"), self.child_rel),
|
|
|
|
|
(_("Edit the selected child"),self.edit_child_callback),
|
|
|
|
|
(_("Remove the selected child"),self.remove_child_clicked),
|
|
|
|
|
]
|
2005-02-20 06:32:15 +05:30
|
|
|
|
if not self.parent.db.readonly:
|
|
|
|
|
for msg,callback in entries:
|
|
|
|
|
Utils.add_menuitem(menu,msg,handle,callback)
|
2003-10-20 08:17:03 +05:30
|
|
|
|
menu.popup(None,None,None,event.button,event.time)
|
2003-08-01 09:08:51 +05:30
|
|
|
|
|
|
|
|
|
def edit_child_callback(self,obj):
|
2004-10-06 09:12:54 +05:30
|
|
|
|
model, node = self.child_selection.get_selected()
|
|
|
|
|
if not node:
|
2003-08-01 09:08:51 +05:30
|
|
|
|
return
|
2004-11-19 01:51:06 +05:30
|
|
|
|
handle = self.child_model.get_value(node,_HANDLE_COL)
|
2004-10-06 09:12:54 +05:30
|
|
|
|
child = self.parent.db.get_person_from_handle(handle)
|
2003-08-01 09:08:51 +05:30
|
|
|
|
try:
|
2004-10-06 09:12:54 +05:30
|
|
|
|
EditPerson.EditPerson(self.parent, child, self.parent.db,
|
|
|
|
|
self.spouse_after_edit)
|
2003-08-01 09:08:51 +05:30
|
|
|
|
except:
|
|
|
|
|
DisplayTrace.DisplayTrace()
|
2003-06-17 09:45:58 +05:30
|
|
|
|
|
|
|
|
|
def child_rel(self,obj):
|
2004-10-06 09:12:54 +05:30
|
|
|
|
handle = obj.get_data('o')
|
|
|
|
|
person = self.parent.db.get_person_from_handle(handle)
|
2005-04-01 11:03:22 +05:30
|
|
|
|
ChooseParents.ModifyParents(self.parent.db, person,
|
|
|
|
|
self.family.get_handle())
|
2003-06-17 09:45:58 +05:30
|
|
|
|
|
2004-10-06 09:12:54 +05:30
|
|
|
|
def child_rel_by_id(self,handle):
|
|
|
|
|
person = self.parent.db.get_person_from_handle(handle)
|
2005-04-01 11:03:22 +05:30
|
|
|
|
ChooseParents.ModifyParents(self.parent.db, person,
|
|
|
|
|
self.family.get_handle())
|
2003-11-20 10:29:36 +05:30
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
def spouse_changed(self,obj):
|
2004-11-19 06:44:37 +05:30
|
|
|
|
if self.in_drag:
|
|
|
|
|
return
|
2004-10-06 09:12:54 +05:30
|
|
|
|
model, node = obj.get_selected()
|
|
|
|
|
if not node:
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.display_marriage(None)
|
|
|
|
|
else:
|
2004-10-06 09:12:54 +05:30
|
|
|
|
row = model.get_path(node)
|
2004-08-17 22:28:34 +05:30
|
|
|
|
family_handle = self.person.get_family_handle_list()[row[0]]
|
|
|
|
|
fam = self.parent.db.get_family_from_handle(family_handle)
|
|
|
|
|
self.display_marriage(fam)
|
2004-05-24 10:02:19 +05:30
|
|
|
|
|
2003-10-20 08:17:03 +05:30
|
|
|
|
def build_spouse_menu(self,event):
|
2003-08-25 05:12:42 +05:30
|
|
|
|
|
|
|
|
|
menu = gtk.Menu()
|
|
|
|
|
menu.set_title(_('Spouse Menu'))
|
|
|
|
|
|
|
|
|
|
back_sensitivity = self.parent.hindex > 0
|
|
|
|
|
fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history)
|
|
|
|
|
nav_entries = [
|
2003-08-29 08:38:02 +05:30
|
|
|
|
(gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity),
|
|
|
|
|
(gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity),
|
2004-01-20 21:36:17 +05:30
|
|
|
|
#FIXME: revert to stock item when German gtk translation is fixed
|
2005-03-10 05:58:57 +05:30
|
|
|
|
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
|
2004-01-20 21:36:17 +05:30
|
|
|
|
(_("Home"),self.parent.on_home_clicked,1),
|
2003-08-25 05:12:42 +05:30
|
|
|
|
(None,None,0),
|
|
|
|
|
]
|
|
|
|
|
for stock_id,callback,sensitivity in nav_entries:
|
|
|
|
|
item = gtk.ImageMenuItem(stock_id)
|
2004-01-20 21:36:17 +05:30
|
|
|
|
#FIXME: remove when German gtk translation is fixed
|
2005-03-10 05:58:57 +05:30
|
|
|
|
if stock_id == _("Home"):
|
|
|
|
|
im = gtk.image_new_from_stock(gtk.STOCK_HOME,gtk.ICON_SIZE_MENU)
|
|
|
|
|
im.show()
|
|
|
|
|
item.set_image(im)
|
2003-08-25 05:12:42 +05:30
|
|
|
|
if callback:
|
|
|
|
|
item.connect("activate",callback)
|
|
|
|
|
item.set_sensitive(sensitivity)
|
|
|
|
|
item.show()
|
|
|
|
|
menu.append(item)
|
|
|
|
|
|
2003-08-01 09:08:51 +05:30
|
|
|
|
entries = [
|
2003-08-30 06:46:40 +05:30
|
|
|
|
(_("Make the selected spouse an active person"), self.spouse_swap),
|
2003-08-01 09:08:51 +05:30
|
|
|
|
(_("Edit relationship"), self.edit_marriage_callback),
|
|
|
|
|
(_("Remove the selected spouse"), self.remove_spouse),
|
|
|
|
|
(_("Edit the selected spouse"), self.edit_spouse_callback),
|
|
|
|
|
(_("Set the selected spouse as the preferred spouse"), self.set_preferred_spouse),
|
|
|
|
|
]
|
2005-02-20 06:32:15 +05:30
|
|
|
|
if not self.parent.db.readonly:
|
|
|
|
|
for msg,callback in entries:
|
|
|
|
|
Utils.add_menuitem(menu,msg,None,callback)
|
2003-10-20 08:17:03 +05:30
|
|
|
|
menu.popup(None,None,None,event.button,event.time)
|
2003-08-01 09:08:51 +05:30
|
|
|
|
|
|
|
|
|
def set_preferred_spouse(self,obj):
|
|
|
|
|
if self.selected_spouse:
|
2004-07-28 07:59:07 +05:30
|
|
|
|
self.person.set_preferred_family_handle(self.family)
|
2004-08-13 10:04:07 +05:30
|
|
|
|
trans = self.parent.db.transaction_begin()
|
2004-03-30 10:20:24 +05:30
|
|
|
|
self.parent.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.parent.db.transaction_commit(trans,_("Set Preferred Spouse (%s)") % n)
|
2003-08-01 09:08:51 +05:30
|
|
|
|
self.load_family()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2003-08-01 09:08:51 +05:30
|
|
|
|
def edit_spouse_callback(self,obj):
|
|
|
|
|
if self.selected_spouse:
|
|
|
|
|
try:
|
2004-02-26 10:21:57 +05:30
|
|
|
|
EditPerson.EditPerson(self.parent, self.selected_spouse,
|
|
|
|
|
self.parent.db, self.spouse_after_edit)
|
2003-08-01 09:08:51 +05:30
|
|
|
|
except:
|
|
|
|
|
DisplayTrace.DisplayTrace()
|
|
|
|
|
|
|
|
|
|
def edit_marriage_callback(self,obj):
|
2005-02-27 11:21:59 +05:30
|
|
|
|
Marriage.Marriage(
|
|
|
|
|
self.parent, self.family,self.parent.db, self.parent.new_after_edit,
|
|
|
|
|
self.load_family, self.parent.source_view.build_tree)
|
2003-08-01 09:08:51 +05:30
|
|
|
|
|
2003-11-20 10:29:36 +05:30
|
|
|
|
def sp_button_press(self,obj,event):
|
2003-05-18 09:48:12 +05:30
|
|
|
|
if event.state & gtk.gdk.SHIFT_MASK and \
|
2003-10-13 08:56:05 +05:30
|
|
|
|
event.type == gtk.gdk.BUTTON_PRESS and \
|
|
|
|
|
event.button == 1 and self.selected_spouse:
|
|
|
|
|
self.edit_spouse_callback(None)
|
|
|
|
|
|
2003-08-01 09:08:51 +05:30
|
|
|
|
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
|
|
|
|
if self.selected_spouse:
|
2003-10-20 08:17:03 +05:30
|
|
|
|
self.build_spouse_menu(event)
|
2003-08-25 09:24:08 +05:30
|
|
|
|
else:
|
2003-10-20 08:17:03 +05:30
|
|
|
|
self.build_nav_menu(event)
|
2003-05-18 09:48:12 +05:30
|
|
|
|
elif event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
2002-10-20 19:55:16 +05:30
|
|
|
|
if self.person:
|
|
|
|
|
try:
|
2002-11-28 11:22:02 +05:30
|
|
|
|
if self.selected_spouse:
|
2005-04-02 03:21:27 +05:30
|
|
|
|
Marriage.Marriage(self.parent,self.family,self.parent.db)
|
2002-11-28 11:22:02 +05:30
|
|
|
|
else:
|
2004-02-21 12:10:44 +05:30
|
|
|
|
AddSpouse.AddSpouse(self.parent,self.parent.db,self.person,
|
2002-11-28 11:22:02 +05:30
|
|
|
|
self.family)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
except:
|
|
|
|
|
DisplayTrace.DisplayTrace()
|
|
|
|
|
|
2003-06-15 09:43:16 +05:30
|
|
|
|
def select_spouse(self,obj):
|
2002-10-20 19:55:16 +05:30
|
|
|
|
if not self.person:
|
|
|
|
|
return
|
|
|
|
|
try:
|
2005-04-02 03:21:27 +05:30
|
|
|
|
AddSpouse.AddSpouse(self.parent, self.parent.db, self.person)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
except:
|
|
|
|
|
DisplayTrace.DisplayTrace()
|
|
|
|
|
|
2003-06-15 09:43:16 +05:30
|
|
|
|
def add_spouse(self,obj):
|
|
|
|
|
person = RelLib.Person()
|
2005-02-01 09:16:29 +05:30
|
|
|
|
if self.person.get_gender() == RelLib.Person.MALE:
|
|
|
|
|
person.set_gender(RelLib.Person.FEMALE)
|
2003-06-15 09:43:16 +05:30
|
|
|
|
else:
|
2005-02-01 09:16:29 +05:30
|
|
|
|
person.set_gender(RelLib.Person.MALE)
|
2003-06-15 09:43:16 +05:30
|
|
|
|
try:
|
2004-02-26 10:21:57 +05:30
|
|
|
|
EditPerson.EditPerson(self.parent, person, self.parent.db,
|
|
|
|
|
self.new_spouse_after_edit)
|
2003-06-15 09:43:16 +05:30
|
|
|
|
except:
|
|
|
|
|
DisplayTrace.DisplayTrace()
|
|
|
|
|
|
2004-10-07 23:18:29 +05:30
|
|
|
|
def spouse_after_edit(self,epo,val):
|
2003-10-13 08:56:05 +05:30
|
|
|
|
ap = self.parent.active_person
|
|
|
|
|
self.parent.active_person = ap
|
|
|
|
|
|
2004-10-07 23:18:29 +05:30
|
|
|
|
def new_spouse_after_edit(self,epo,val):
|
2004-02-16 02:19:34 +05:30
|
|
|
|
|
2005-04-01 11:03:22 +05:30
|
|
|
|
new_person = epo.person
|
|
|
|
|
old_person = self.person
|
2004-10-07 23:18:29 +05:30
|
|
|
|
trans = self.parent.db.transaction_begin()
|
2005-04-01 11:03:22 +05:30
|
|
|
|
fhandle = self.parent.db.create_id()
|
|
|
|
|
family = RelLib.Family()
|
|
|
|
|
family.set_handle(fhandle)
|
|
|
|
|
family.set_gramps_id(self.parent.db.find_next_family_gramps_id())
|
2003-06-15 09:43:16 +05:30
|
|
|
|
|
2005-04-01 11:03:22 +05:30
|
|
|
|
old_person.add_family_handle(fhandle)
|
|
|
|
|
new_person.add_family_handle(fhandle)
|
2004-02-26 10:21:57 +05:30
|
|
|
|
|
2005-02-01 09:16:29 +05:30
|
|
|
|
if self.person.get_gender() == RelLib.Person.MALE:
|
2005-04-01 11:03:22 +05:30
|
|
|
|
family.set_mother_handle(epo.person.get_handle())
|
|
|
|
|
family.set_father_handle(self.person.get_handle())
|
2005-03-10 05:58:57 +05:30
|
|
|
|
else:
|
2005-04-01 11:03:22 +05:30
|
|
|
|
family.set_father_handle(epo.person.get_handle())
|
|
|
|
|
family.set_mother_handle(self.person.get_handle())
|
2004-10-07 23:18:29 +05:30
|
|
|
|
|
2005-04-01 11:03:22 +05:30
|
|
|
|
self.parent.db.commit_person(new_person,trans)
|
|
|
|
|
self.parent.db.commit_person(old_person,trans)
|
|
|
|
|
self.parent.db.commit_family(family,trans)
|
2004-10-07 23:18:29 +05:30
|
|
|
|
self.parent.db.transaction_commit(trans,_("Add Spouse"))
|
2005-04-01 11:03:22 +05:30
|
|
|
|
self.family = family
|
|
|
|
|
self.person = old_person
|
|
|
|
|
m = Marriage.Marriage(self.parent,self.family,self.parent.db)
|
2005-02-27 11:21:59 +05:30
|
|
|
|
|
2004-04-17 00:45:02 +05:30
|
|
|
|
m.on_add_clicked()
|
2003-06-15 09:43:16 +05:30
|
|
|
|
|
2002-11-03 02:49:58 +05:30
|
|
|
|
def add_child_clicked(self,obj):
|
2003-06-15 09:43:16 +05:30
|
|
|
|
if not self.person:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
person = RelLib.Person()
|
2005-01-06 22:58:31 +05:30
|
|
|
|
autoname = GrampsKeys.get_lastnamegen()
|
2003-06-15 09:43:16 +05:30
|
|
|
|
|
|
|
|
|
if autoname == 0:
|
|
|
|
|
name = self.north_american(0)
|
|
|
|
|
elif autoname == 2:
|
|
|
|
|
name = self.latin_american(0)
|
|
|
|
|
elif autoname == 3:
|
|
|
|
|
name = self.icelandic(0)
|
|
|
|
|
else:
|
2003-12-02 06:59:30 +05:30
|
|
|
|
name = self.no_name(0)
|
2004-02-14 11:10:30 +05:30
|
|
|
|
person.get_primary_name().set_surname(name[1])
|
|
|
|
|
person.get_primary_name().set_surname_prefix(name[0])
|
2003-06-15 09:43:16 +05:30
|
|
|
|
|
|
|
|
|
try:
|
2004-06-29 09:21:49 +05:30
|
|
|
|
EditPerson.EditPerson(self.parent, person, self.parent.db,
|
|
|
|
|
self.new_child_after_edit)
|
2003-06-15 09:43:16 +05:30
|
|
|
|
except:
|
|
|
|
|
DisplayTrace.DisplayTrace()
|
|
|
|
|
|
2003-06-19 09:24:45 +05:30
|
|
|
|
def update_person_list(self,person):
|
2004-10-06 09:12:54 +05:30
|
|
|
|
trans = self.parent.db.transaction_begin()
|
2004-08-13 10:04:07 +05:30
|
|
|
|
|
2003-06-19 09:24:45 +05:30
|
|
|
|
if not self.family:
|
2004-08-13 10:04:07 +05:30
|
|
|
|
self.family = RelLib.Family()
|
|
|
|
|
self.parent.db.add_family(self.family,trans)
|
2004-07-28 07:59:07 +05:30
|
|
|
|
person.add_family_handle(self.family.get_handle())
|
2005-02-01 09:16:29 +05:30
|
|
|
|
if person.get_gender() == RelLib.Person.MALE:
|
2004-07-28 07:59:07 +05:30
|
|
|
|
self.family.set_father_handle(person)
|
2003-06-19 09:24:45 +05:30
|
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
|
self.family.set_mother_handle(person)
|
2003-06-19 09:24:45 +05:30
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
|
self.family.add_child_handle(person)
|
|
|
|
|
person.add_parent_family_handle(self.family.get_handle(),"Birth","Birth")
|
2004-10-06 09:12:54 +05:30
|
|
|
|
self.parent.db.commit_person(person,trans)
|
|
|
|
|
self.parent.db.commit_family(self.family,trans)
|
|
|
|
|
self.parent.db.transaction_commit(trans,_("Modify family"))
|
2003-06-19 09:24:45 +05:30
|
|
|
|
|
2004-10-07 23:18:29 +05:30
|
|
|
|
def new_child_after_edit(self,epo,value):
|
2005-04-05 06:28:37 +05:30
|
|
|
|
family = self.family
|
|
|
|
|
person = self.person
|
|
|
|
|
new_person = epo.person
|
|
|
|
|
trans = self.parent.db.transaction_begin()
|
|
|
|
|
if not family:
|
2005-03-10 09:44:03 +05:30
|
|
|
|
# Add family to active person,
|
|
|
|
|
# if it does not exist yet (child with no spouse)
|
2005-04-05 06:28:37 +05:30
|
|
|
|
family = RelLib.Family()
|
|
|
|
|
self.parent.db.add_family(family,trans)
|
|
|
|
|
person.add_family_handle(family.get_handle())
|
|
|
|
|
if person.get_gender() == RelLib.Person.MALE:
|
|
|
|
|
family.set_father_handle(person.get_handle())
|
2003-06-19 09:24:45 +05:30
|
|
|
|
else:
|
2005-04-05 06:28:37 +05:30
|
|
|
|
family.set_mother_handle(person.get_handle())
|
|
|
|
|
self.parent.db.commit_family(family,trans)
|
|
|
|
|
self.parent.db.commit_person(person,trans)
|
2003-06-19 09:24:45 +05:30
|
|
|
|
|
2005-04-05 06:28:37 +05:30
|
|
|
|
family.add_child_handle(new_person.get_handle())
|
|
|
|
|
new_person.add_parent_family_handle(family.get_handle(),
|
2005-04-01 11:03:22 +05:30
|
|
|
|
RelLib.Person.CHILD_REL_BIRTH,
|
|
|
|
|
RelLib.Person.CHILD_REL_BIRTH)
|
2005-04-05 06:28:37 +05:30
|
|
|
|
self.parent.db.commit_person(new_person,trans)
|
|
|
|
|
self.parent.db.commit_family(family,trans)
|
2004-10-07 23:18:29 +05:30
|
|
|
|
self.parent.db.transaction_commit(trans,_("Add Child to Family"))
|
2005-04-05 06:28:37 +05:30
|
|
|
|
self.display_marriage(family)
|
2003-06-15 09:43:16 +05:30
|
|
|
|
|
|
|
|
|
def select_child_clicked(self,obj):
|
2002-11-03 02:49:58 +05:30
|
|
|
|
if not self.person:
|
|
|
|
|
return
|
2003-02-10 18:41:21 +05:30
|
|
|
|
try:
|
2004-02-25 10:04:20 +05:30
|
|
|
|
SelectChild.SelectChild(self.parent, self.parent.db, self.family,
|
2005-04-04 09:29:42 +05:30
|
|
|
|
self.person, self.load_family)
|
2002-11-03 02:49:58 +05:30
|
|
|
|
except:
|
|
|
|
|
DisplayTrace.DisplayTrace()
|
|
|
|
|
|
2002-10-28 19:06:39 +05:30
|
|
|
|
def remove_child_clicked(self,obj):
|
2004-12-03 07:19:09 +05:30
|
|
|
|
if self.family == None or self.person == None:
|
2002-10-28 19:06:39 +05:30
|
|
|
|
return
|
|
|
|
|
|
2005-04-04 09:29:42 +05:30
|
|
|
|
family = self.family
|
|
|
|
|
|
2004-10-06 09:12:54 +05:30
|
|
|
|
model, node = self.child_selection.get_selected()
|
|
|
|
|
if not node:
|
2002-10-28 19:06:39 +05:30
|
|
|
|
return
|
|
|
|
|
|
2004-11-19 01:51:06 +05:30
|
|
|
|
handle = self.child_model.get_value(node,_HANDLE_COL)
|
2004-10-06 09:12:54 +05:30
|
|
|
|
child = self.parent.db.get_person_from_handle(handle)
|
2002-10-28 19:06:39 +05:30
|
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
|
trans = self.parent.db.transaction_begin()
|
2004-03-30 10:20:24 +05:30
|
|
|
|
|
2005-04-04 09:29:42 +05:30
|
|
|
|
family.remove_child_handle(child.get_handle())
|
|
|
|
|
child.remove_parent_family_handle(family.get_handle())
|
2002-10-28 19:06:39 +05:30
|
|
|
|
|
2005-04-04 09:29:42 +05:30
|
|
|
|
if len(family.get_child_handle_list()) == 0:
|
|
|
|
|
if family.get_father_handle() == None:
|
|
|
|
|
self.delete_family_from(family.get_mother_handle(),trans)
|
|
|
|
|
elif family.get_mother_handle() == None:
|
|
|
|
|
self.delete_family_from(family.get_father_handle(),trans)
|
2002-10-28 19:06:39 +05:30
|
|
|
|
|
2004-03-30 10:20:24 +05:30
|
|
|
|
self.parent.db.commit_person(child,trans)
|
2005-04-04 09:29:42 +05:30
|
|
|
|
self.parent.db.commit_family(family,trans)
|
2004-05-19 11:43:36 +05:30
|
|
|
|
n = child.get_primary_name().get_regular_name()
|
2004-08-13 10:04:07 +05:30
|
|
|
|
self.parent.db.transaction_commit(trans,_("Remove Child (%s)") % n)
|
2002-10-28 19:06:39 +05:30
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
def remove_spouse(self,obj):
|
2002-11-10 00:14:58 +05:30
|
|
|
|
if self.selected_spouse:
|
2005-01-01 09:57:15 +05:30
|
|
|
|
nap = NameDisplay.displayer.display(self.person)
|
|
|
|
|
nsp = NameDisplay.displayer.display(self.selected_spouse)
|
2003-02-24 10:21:57 +05:30
|
|
|
|
QuestionDialog(_('Remove %s as a spouse of %s?') % (nsp,nap),
|
2003-03-14 00:28:52 +05:30
|
|
|
|
_('Removing a spouse removes the relationship between '
|
2003-02-24 10:21:57 +05:30
|
|
|
|
'the spouse and the active person. It does not '
|
|
|
|
|
'remove the spouse from the database'),
|
2003-03-23 09:20:59 +05:30
|
|
|
|
_('_Remove Spouse'),
|
2002-11-10 00:14:58 +05:30
|
|
|
|
self.really_remove_spouse)
|
2004-07-28 07:59:07 +05:30
|
|
|
|
elif self.family and not self.family.get_child_handle_list():
|
2003-01-22 09:15:46 +05:30
|
|
|
|
self.really_remove_spouse()
|
2002-11-10 00:14:58 +05:30
|
|
|
|
|
|
|
|
|
def really_remove_spouse(self):
|
2002-10-20 19:55:16 +05:30
|
|
|
|
"""Delete the currently selected spouse from the family"""
|
|
|
|
|
if self.person == None:
|
|
|
|
|
return
|
2004-02-26 10:21:57 +05:30
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
|
if self.selected_spouse.get_handle() == self.family.get_father_handle():
|
|
|
|
|
self.family.set_father_handle(None)
|
2003-12-07 09:45:54 +05:30
|
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
|
self.family.set_mother_handle(None)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
|
trans = self.parent.db.transaction_begin()
|
2004-03-30 10:20:24 +05:30
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
if self.selected_spouse:
|
2004-07-28 07:59:07 +05:30
|
|
|
|
self.selected_spouse.remove_family_handle(self.family.get_handle())
|
2004-03-30 10:20:24 +05:30
|
|
|
|
self.parent.db.commit_person(self.selected_spouse,trans)
|
2004-02-26 10:21:57 +05:30
|
|
|
|
|
2004-03-30 10:20:24 +05:30
|
|
|
|
self.parent.db.commit_family(self.family,trans)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
|
if len(self.family.get_child_handle_list()) == 0:
|
2004-12-03 07:19:09 +05:30
|
|
|
|
mother_id = self.family.get_mother_handle()
|
|
|
|
|
father_id = self.family.get_father_handle()
|
|
|
|
|
|
2005-01-09 07:48:49 +05:30
|
|
|
|
for handle in [father_id, mother_id]:
|
|
|
|
|
if handle:
|
2005-02-16 19:19:32 +05:30
|
|
|
|
p = self.parent.db.get_person_from_handle(handle)
|
2004-12-03 07:19:09 +05:30
|
|
|
|
p.remove_family_handle(self.family.get_handle())
|
|
|
|
|
self.parent.db.commit_person(p,trans)
|
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
|
if len(self.person.get_family_handle_list()) > 0:
|
2004-08-11 09:12:38 +05:30
|
|
|
|
handle = self.person.get_family_handle_list()[0]
|
|
|
|
|
family = self.parent.db.find_family_from_handle(handle,trans)
|
2004-12-03 07:19:09 +05:30
|
|
|
|
|
|
|
|
|
person_id = self.person.get_handle()
|
|
|
|
|
self.person = self.parent.db.get_person_from_handle(person_id)
|
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.parent.db.transaction_commit(trans,_("Remove Spouse (%s)") % n)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
|
if len(self.person.get_family_handle_list()) <= 1:
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.spouse_selection.set_mode(gtk.SELECTION_NONE)
|
|
|
|
|
|
|
|
|
|
def spouse_swap(self,obj):
|
|
|
|
|
if self.selected_spouse:
|
2003-10-13 09:53:34 +05:30
|
|
|
|
self.parent.change_active_person(self.selected_spouse)
|
2003-06-03 08:24:56 +05:30
|
|
|
|
self.load_family(self.family)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
def ap_parents_clicked(self,obj):
|
2005-02-24 07:10:40 +05:30
|
|
|
|
self.change_families(self.person, self.ap_selection)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
def sp_parents_clicked(self,obj):
|
2005-02-24 07:10:40 +05:30
|
|
|
|
self.change_families(self.selected_spouse, self.sp_selection)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2005-02-24 07:10:40 +05:30
|
|
|
|
def change_families(self,person,select):
|
2002-10-20 19:55:16 +05:30
|
|
|
|
if not person:
|
|
|
|
|
return
|
2004-07-28 07:59:07 +05:30
|
|
|
|
plist = person.get_parent_family_handle_list()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
if len(plist) == 0:
|
|
|
|
|
return
|
|
|
|
|
if len(plist) == 1:
|
2004-07-28 07:59:07 +05:30
|
|
|
|
family_handle,m,r = plist[0]
|
2002-10-20 19:55:16 +05:30
|
|
|
|
else:
|
2005-02-24 07:10:40 +05:30
|
|
|
|
model, node = select.get_selected()
|
2004-10-06 09:12:54 +05:30
|
|
|
|
path = model.get_path(node)
|
2004-07-28 07:59:07 +05:30
|
|
|
|
family_handle,m,r = plist[path[0]]
|
2004-08-13 10:04:07 +05:30
|
|
|
|
family = self.parent.db.get_family_from_handle(family_handle)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
|
if family.get_father_handle():
|
|
|
|
|
person_handle = family.get_father_handle()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
|
person_handle = family.get_mother_handle()
|
2004-08-07 10:46:57 +05:30
|
|
|
|
person = self.parent.db.get_person_from_handle(person_handle)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.parent.change_active_person(person)
|
2004-02-26 10:21:57 +05:30
|
|
|
|
|
2005-01-01 09:57:15 +05:30
|
|
|
|
n = NameDisplay.displayer.display(person)
|
2004-08-13 10:04:07 +05:30
|
|
|
|
trans = self.parent.db.transaction_begin()
|
2004-03-30 10:20:24 +05:30
|
|
|
|
self.parent.db.commit_family(family,trans)
|
2004-08-13 10:04:07 +05:30
|
|
|
|
self.parent.db.transaction_commit(trans,_("Select Parents (%s)") % n)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.load_family(family)
|
2003-02-14 07:50:59 +05:30
|
|
|
|
|
|
|
|
|
def clear(self):
|
|
|
|
|
self.spouse_model.clear()
|
|
|
|
|
self.sp_parents_model.clear()
|
|
|
|
|
self.ap_parents_model.clear()
|
2003-02-24 10:21:57 +05:30
|
|
|
|
self.ap_model.clear()
|
2004-11-19 01:51:06 +05:30
|
|
|
|
self.child_model = DisplayModels.ChildModel([],self.parent.db)
|
|
|
|
|
self.child_list.set_model(self.child_model)
|
2005-02-17 04:19:54 +05:30
|
|
|
|
|
|
|
|
|
def set_buttons(self):
|
|
|
|
|
mode = not self.parent.db.readonly
|
|
|
|
|
|
|
|
|
|
self.top.get_widget('add_child_btn').set_sensitive(mode)
|
|
|
|
|
self.top.get_widget('add_child_btn2').set_sensitive(mode)
|
|
|
|
|
self.top.get_widget('add_parents').set_sensitive(mode)
|
|
|
|
|
self.top.get_widget('add_parents2').set_sensitive(mode)
|
|
|
|
|
self.top.get_widget('add_spparents').set_sensitive(mode)
|
|
|
|
|
self.top.get_widget('add_spparents2').set_sensitive(mode)
|
|
|
|
|
self.top.get_widget('del_child_btn').set_sensitive(mode)
|
|
|
|
|
self.top.get_widget('del_child_btn2').set_sensitive(mode)
|
|
|
|
|
self.top.get_widget('del_parents').set_sensitive(mode)
|
|
|
|
|
self.top.get_widget('del_parents2').set_sensitive(mode)
|
|
|
|
|
self.top.get_widget('del_spparents').set_sensitive(mode)
|
|
|
|
|
self.top.get_widget('del_spparents2').set_sensitive(mode)
|
|
|
|
|
self.top.get_widget('select_child2').set_sensitive(mode)
|
|
|
|
|
self.top.get_widget('select_child').set_sensitive(mode)
|
|
|
|
|
self.add_spouse_btn.set_sensitive(mode)
|
|
|
|
|
self.remove_spouse_btn.set_sensitive(mode)
|
|
|
|
|
self.select_spouse_btn.set_sensitive(mode)
|
2004-11-19 01:51:06 +05:30
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
def load_family(self,family=None):
|
2005-02-17 04:19:54 +05:30
|
|
|
|
self.set_buttons()
|
2004-04-17 00:45:02 +05:30
|
|
|
|
if self.parent.active_person:
|
2004-10-06 09:12:54 +05:30
|
|
|
|
handle = self.parent.active_person.get_handle()
|
|
|
|
|
self.person = self.parent.db.get_person_from_handle(handle)
|
2004-04-17 00:45:02 +05:30
|
|
|
|
else:
|
|
|
|
|
self.person = None
|
2003-02-14 07:50:59 +05:30
|
|
|
|
self.clear()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
return
|
2003-01-02 10:01:52 +05:30
|
|
|
|
|
2005-04-04 09:29:42 +05:30
|
|
|
|
bhandle = self.person.get_birth_handle()
|
|
|
|
|
dhandle = self.person.get_death_handle()
|
|
|
|
|
bd = self.parent.db.get_event_from_handle(bhandle)
|
|
|
|
|
dd = self.parent.db.get_event_from_handle(dhandle)
|
2003-04-30 09:03:20 +05:30
|
|
|
|
|
|
|
|
|
if bd and dd:
|
2004-12-29 10:36:10 +05:30
|
|
|
|
n = "%s [%s]\n\t%s %s\n\t%s %s " % (
|
2005-01-01 09:57:15 +05:30
|
|
|
|
NameDisplay.displayer.display(self.person),
|
2004-12-29 10:36:10 +05:30
|
|
|
|
self.person.get_gramps_id(),
|
|
|
|
|
_BORN,DateHandler.displayer.display(bd.get_date_object()),
|
|
|
|
|
_DIED,DateHandler.displayer.display(dd.get_date_object()))
|
2003-04-30 09:03:20 +05:30
|
|
|
|
elif bd:
|
2004-12-29 10:36:10 +05:30
|
|
|
|
n = "%s [%s]\n\t%s %s" % (
|
2005-01-01 09:57:15 +05:30
|
|
|
|
NameDisplay.displayer.display(self.person),
|
2004-12-29 10:36:10 +05:30
|
|
|
|
self.person.get_gramps_id(),
|
|
|
|
|
_BORN,DateHandler.displayer.display(bd.get_date_object()))
|
2003-04-30 09:03:20 +05:30
|
|
|
|
elif dd:
|
2004-12-29 10:36:10 +05:30
|
|
|
|
n = "%s [%s]\n\t%s %s" % (
|
2005-01-01 09:57:15 +05:30
|
|
|
|
NameDisplay.displayer.display(self.person),
|
2004-12-29 10:36:10 +05:30
|
|
|
|
self.person.get_gramps_id(),
|
|
|
|
|
_DIED,DateHandler.displayer.display(dd.get_date_object()))
|
2003-04-30 09:03:20 +05:30
|
|
|
|
else:
|
2005-01-01 09:57:15 +05:30
|
|
|
|
n = "%s [%s]" % (NameDisplay.displayer.display(self.person),
|
2004-06-27 08:40:06 +05:30
|
|
|
|
self.person.get_gramps_id())
|
2003-02-10 09:41:01 +05:30
|
|
|
|
|
2003-02-24 10:21:57 +05:30
|
|
|
|
self.ap_model.clear()
|
|
|
|
|
self.ap_data.get_selection().set_mode(gtk.SELECTION_NONE)
|
2004-10-06 09:12:54 +05:30
|
|
|
|
node = self.ap_model.append()
|
|
|
|
|
self.ap_model.set(node,0,n)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
self.selected_spouse = None
|
|
|
|
|
self.spouse_model.clear()
|
2003-01-02 10:01:52 +05:30
|
|
|
|
self.sp_parents_model.clear()
|
2004-04-17 00:45:02 +05:30
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
|
splist = self.person.get_family_handle_list()
|
2003-06-03 08:24:56 +05:30
|
|
|
|
|
|
|
|
|
if len(splist) > 1:
|
|
|
|
|
self.spouse_selection.set_mode(gtk.SELECTION_SINGLE)
|
|
|
|
|
else:
|
|
|
|
|
self.spouse_selection.set_mode(gtk.SELECTION_NONE)
|
|
|
|
|
|
|
|
|
|
flist = {}
|
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
for f in splist:
|
2004-08-13 10:04:07 +05:30
|
|
|
|
fm = self.parent.db.get_family_from_handle(f)
|
2004-12-03 07:19:09 +05:30
|
|
|
|
if not fm:
|
|
|
|
|
continue
|
2004-07-28 07:59:07 +05:30
|
|
|
|
if fm.get_father_handle() == self.person.get_handle():
|
|
|
|
|
sp_id = fm.get_mother_handle()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
|
sp_id = fm.get_father_handle()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2004-10-06 09:12:54 +05:30
|
|
|
|
node = self.spouse_model.append()
|
|
|
|
|
flist[f] = node
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2004-02-26 10:21:57 +05:30
|
|
|
|
if sp_id:
|
2004-08-07 10:46:57 +05:30
|
|
|
|
sp = self.parent.db.get_person_from_handle(sp_id)
|
2004-02-19 10:35:43 +05:30
|
|
|
|
event = self.find_marriage(fm)
|
|
|
|
|
if event:
|
2004-12-29 10:36:10 +05:30
|
|
|
|
mdate = " - %s" % DateHandler.displayer.display(event.get_date_object())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
else:
|
|
|
|
|
mdate = ""
|
2004-12-29 10:36:10 +05:30
|
|
|
|
v = "%s [%s]\n\t%s%s" % (
|
2005-01-01 09:57:15 +05:30
|
|
|
|
NameDisplay.displayer.display(sp),
|
2004-12-29 10:36:10 +05:30
|
|
|
|
sp.get_gramps_id(),
|
|
|
|
|
const.family_relations[fm.get_relationship()][0], mdate)
|
2004-10-06 09:12:54 +05:30
|
|
|
|
self.spouse_model.set(node,0,v)
|
2004-11-19 06:44:37 +05:30
|
|
|
|
self.spouse_model.set(node,1,f)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
else:
|
2004-10-06 09:12:54 +05:30
|
|
|
|
self.spouse_model.set(node,0,"%s\n" % _("<double click to add spouse>"))
|
2004-11-19 06:44:37 +05:30
|
|
|
|
self.spouse_model.set(node,1,f)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
|
if family and family.get_handle() in flist:
|
2003-06-03 08:24:56 +05:30
|
|
|
|
self.display_marriage(family)
|
2004-10-06 09:12:54 +05:30
|
|
|
|
node = flist[family.get_handle()]
|
|
|
|
|
self.spouse_selection.select_iter(node)
|
2003-06-03 08:24:56 +05:30
|
|
|
|
elif len(flist) > 0:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
fid = splist[0]
|
2004-08-11 09:12:38 +05:30
|
|
|
|
fam = self.parent.db.get_family_from_handle(fid)
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.display_marriage(fam)
|
2004-10-06 09:12:54 +05:30
|
|
|
|
node = flist[fid]
|
|
|
|
|
self.spouse_selection.select_iter(node)
|
2003-06-03 08:24:56 +05:30
|
|
|
|
else:
|
|
|
|
|
self.display_marriage(None)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
self.update_list(self.ap_parents_model,self.ap_parents,self.person)
|
|
|
|
|
|
2004-02-19 10:35:43 +05:30
|
|
|
|
def find_marriage(self,family):
|
2004-07-28 07:59:07 +05:30
|
|
|
|
for event_handle in family.get_event_list():
|
|
|
|
|
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.parent.db.get_event_from_handle(event_handle)
|
2004-02-29 07:59:48 +05:30
|
|
|
|
if event.get_name() == "Marriage":
|
|
|
|
|
return event
|
2004-02-19 10:35:43 +05:30
|
|
|
|
return None
|
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
def update_list(self,model,tree,person):
|
|
|
|
|
model.clear()
|
|
|
|
|
sel = None
|
|
|
|
|
selection = tree.get_selection()
|
2004-10-06 09:12:54 +05:30
|
|
|
|
family_list = person.get_parent_family_handle_list()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2004-10-06 09:12:54 +05:30
|
|
|
|
for (f,mrel,frel) in family_list:
|
2004-08-11 09:12:38 +05:30
|
|
|
|
fam = self.parent.db.get_family_from_handle(f)
|
2004-07-28 07:59:07 +05:30
|
|
|
|
father_handle = fam.get_father_handle()
|
|
|
|
|
mother_handle = fam.get_mother_handle()
|
2004-08-07 10:46:57 +05:30
|
|
|
|
f = self.parent.db.get_person_from_handle(father_handle)
|
|
|
|
|
m = self.parent.db.get_person_from_handle(mother_handle)
|
2005-03-10 07:08:08 +05:30
|
|
|
|
|
|
|
|
|
father = self.nameof(_("Father"),f,
|
|
|
|
|
const.child_rel_list[frel])
|
|
|
|
|
mother = self.nameof(_("Mother"),m,
|
|
|
|
|
const.child_rel_list[mrel])
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2004-10-06 09:12:54 +05:30
|
|
|
|
node = model.append()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
if not sel:
|
2004-10-06 09:12:54 +05:30
|
|
|
|
sel = node
|
2002-10-20 19:55:16 +05:30
|
|
|
|
v = "%s\n%s" % (father,mother)
|
2004-10-06 09:12:54 +05:30
|
|
|
|
model.set(node,0,v)
|
|
|
|
|
if len(family_list) > 1:
|
2002-10-20 19:55:16 +05:30
|
|
|
|
selection.set_mode(gtk.SELECTION_SINGLE)
|
|
|
|
|
selection.select_iter(sel)
|
|
|
|
|
else:
|
|
|
|
|
selection.set_mode(gtk.SELECTION_NONE)
|
|
|
|
|
|
|
|
|
|
def nameof(self,l,p,mode):
|
|
|
|
|
if p:
|
2005-01-01 09:57:15 +05:30
|
|
|
|
n = NameDisplay.displayer.display(p)
|
2004-06-27 08:40:06 +05:30
|
|
|
|
pid = p.get_gramps_id()
|
2004-06-15 09:13:33 +05:30
|
|
|
|
return _("%s: %s [%s]\n\tRelationship: %s") % (l,n,pid,_(mode))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
else:
|
2002-11-27 19:06:11 +05:30
|
|
|
|
return _("%s: unknown") % (l)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2005-04-04 09:29:42 +05:30
|
|
|
|
def delete_family_from(self,person_handle,trans):
|
2004-12-03 07:19:09 +05:30
|
|
|
|
person = self.parent.db.get_person_from_handle(person_handle)
|
|
|
|
|
person.remove_family_handle(self.family.get_handle())
|
|
|
|
|
self.parent.db.remove_family(self.family.get_handle(),trans)
|
2004-07-28 07:59:07 +05:30
|
|
|
|
flist = self.person.get_family_handle_list()
|
2002-11-28 11:22:02 +05:30
|
|
|
|
if len(flist) > 0:
|
2004-12-03 07:19:09 +05:30
|
|
|
|
self.family = self.parent.db.get_family_from_handle(flist[0])
|
2002-11-28 11:22:02 +05:30
|
|
|
|
else:
|
|
|
|
|
self.family = None
|
2005-01-09 07:48:49 +05:30
|
|
|
|
n = NameDisplay.displayer.display(person)
|
2002-11-28 11:22:02 +05:30
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
def display_marriage(self,family):
|
|
|
|
|
if not family:
|
2004-04-17 00:45:02 +05:30
|
|
|
|
self.family = None
|
2004-11-30 09:23:51 +05:30
|
|
|
|
self.child_model = DisplayModels.ChildModel([],self.parent.db)
|
|
|
|
|
self.child_list.set_model(self.child_model)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
return
|
2004-11-25 23:40:06 +05:30
|
|
|
|
|
|
|
|
|
hlist = family.get_child_handle_list()
|
|
|
|
|
self.child_model = DisplayModels.ChildModel(hlist,self.parent.db)
|
|
|
|
|
self.child_list.set_model(self.child_model)
|
2004-08-11 09:12:38 +05:30
|
|
|
|
self.family = self.parent.db.get_family_from_handle(family.get_handle())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
|
if self.family.get_father_handle() == self.person.get_handle():
|
|
|
|
|
sp_id = self.family.get_mother_handle()
|
2004-02-26 10:21:57 +05:30
|
|
|
|
if sp_id:
|
2004-08-07 10:46:57 +05:30
|
|
|
|
self.selected_spouse = self.parent.db.get_person_from_handle(sp_id)
|
2004-02-26 10:21:57 +05:30
|
|
|
|
else:
|
|
|
|
|
self.selected_spouse = None
|
2002-10-20 19:55:16 +05:30
|
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
|
sp_id = self.family.get_father_handle()
|
2004-02-26 10:21:57 +05:30
|
|
|
|
if sp_id:
|
2004-08-07 10:46:57 +05:30
|
|
|
|
self.selected_spouse = self.parent.db.get_person_from_handle(sp_id)
|
2004-02-26 10:21:57 +05:30
|
|
|
|
else:
|
|
|
|
|
self.selected_spouse = None
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
if self.selected_spouse:
|
|
|
|
|
self.update_list(self.sp_parents_model,self.sp_parents,
|
|
|
|
|
self.selected_spouse)
|
|
|
|
|
|
2003-10-20 08:17:03 +05:30
|
|
|
|
def build_parents_menu(self,family,event):
|
2003-08-01 09:08:51 +05:30
|
|
|
|
"""Builds the menu that allows editing operations on the child list"""
|
2003-08-25 05:12:42 +05:30
|
|
|
|
menu = gtk.Menu()
|
|
|
|
|
menu.set_title(_('Parents Menu'))
|
|
|
|
|
|
|
|
|
|
back_sensitivity = self.parent.hindex > 0
|
|
|
|
|
fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history)
|
|
|
|
|
nav_entries = [
|
2003-08-29 08:38:02 +05:30
|
|
|
|
(gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity),
|
|
|
|
|
(gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity),
|
2004-01-20 21:36:17 +05:30
|
|
|
|
#FIXME: revert to stock item when German gtk translation is fixed
|
2005-03-10 05:58:57 +05:30
|
|
|
|
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
|
2004-01-20 21:36:17 +05:30
|
|
|
|
(_("Home"),self.parent.on_home_clicked,1),
|
2003-08-25 05:12:42 +05:30
|
|
|
|
(None,None,0),
|
|
|
|
|
]
|
|
|
|
|
for stock_id,callback,sensitivity in nav_entries:
|
|
|
|
|
item = gtk.ImageMenuItem(stock_id)
|
2004-01-20 21:36:17 +05:30
|
|
|
|
#FIXME: remove when German gtk translation is fixed
|
2005-03-10 05:58:57 +05:30
|
|
|
|
if stock_id == _("Home"):
|
|
|
|
|
im = gtk.image_new_from_stock(gtk.STOCK_HOME,gtk.ICON_SIZE_MENU)
|
|
|
|
|
im.show()
|
|
|
|
|
item.set_image(im)
|
2003-08-25 05:12:42 +05:30
|
|
|
|
if callback:
|
|
|
|
|
item.connect("activate",callback)
|
|
|
|
|
item.set_sensitive(sensitivity)
|
|
|
|
|
item.show()
|
|
|
|
|
menu.append(item)
|
|
|
|
|
|
2003-08-01 09:08:51 +05:30
|
|
|
|
entries = [
|
2003-08-30 06:46:40 +05:30
|
|
|
|
(_("Make the selected parents the active family"), self.ap_parents_clicked),
|
2003-08-01 09:08:51 +05:30
|
|
|
|
(_("Edit the child/parent relationships"), self.edit_ap_relationships),
|
2003-08-30 06:46:40 +05:30
|
|
|
|
(_("Add parents"), self.add_parents_clicked),
|
2003-08-01 09:08:51 +05:30
|
|
|
|
(_("Remove parents"),self.del_parents_clicked),
|
|
|
|
|
]
|
2005-02-20 06:32:15 +05:30
|
|
|
|
if not self.parent.db.readonly:
|
|
|
|
|
for msg,callback in entries:
|
|
|
|
|
Utils.add_menuitem(menu,msg,family,callback)
|
2003-10-20 08:17:03 +05:30
|
|
|
|
menu.popup(None,None,None,event.button,event.time)
|
2003-08-01 09:08:51 +05:30
|
|
|
|
|
2003-10-20 08:17:03 +05:30
|
|
|
|
def build_sp_parents_menu(self,family,event):
|
2003-08-01 09:08:51 +05:30
|
|
|
|
"""Builds the menu that allows editing operations on the child list"""
|
2003-08-25 05:12:42 +05:30
|
|
|
|
menu = gtk.Menu()
|
|
|
|
|
menu.set_title(_('Spouse Parents Menu'))
|
|
|
|
|
|
|
|
|
|
back_sensitivity = self.parent.hindex > 0
|
|
|
|
|
fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history)
|
|
|
|
|
nav_entries = [
|
2003-08-29 08:38:02 +05:30
|
|
|
|
(gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity),
|
|
|
|
|
(gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity),
|
2004-01-20 21:36:17 +05:30
|
|
|
|
#FIXME: revert to stock item when German gtk translation is fixed
|
2005-03-10 05:58:57 +05:30
|
|
|
|
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
|
2004-01-20 21:36:17 +05:30
|
|
|
|
(_("Home"),self.parent.on_home_clicked,1),
|
2003-08-25 05:12:42 +05:30
|
|
|
|
(None,None,0),
|
|
|
|
|
]
|
|
|
|
|
for stock_id,callback,sensitivity in nav_entries:
|
|
|
|
|
item = gtk.ImageMenuItem(stock_id)
|
2004-01-20 21:36:17 +05:30
|
|
|
|
#FIXME: remove when German gtk translation is fixed
|
2005-03-10 05:58:57 +05:30
|
|
|
|
if stock_id == _("Home"):
|
|
|
|
|
im = gtk.image_new_from_stock(gtk.STOCK_HOME,gtk.ICON_SIZE_MENU)
|
|
|
|
|
im.show()
|
|
|
|
|
item.set_image(im)
|
2003-08-25 05:12:42 +05:30
|
|
|
|
if callback:
|
|
|
|
|
item.connect("activate",callback)
|
|
|
|
|
item.set_sensitive(sensitivity)
|
|
|
|
|
item.show()
|
|
|
|
|
menu.append(item)
|
|
|
|
|
|
2003-08-01 09:08:51 +05:30
|
|
|
|
entries = [
|
2003-08-30 06:46:40 +05:30
|
|
|
|
(_("Make the selected parents the active family"), self.sp_parents_clicked),
|
2003-08-01 09:08:51 +05:30
|
|
|
|
(_("Edit the child/parent relationships"), self.edit_sp_relationships),
|
2003-08-30 06:46:40 +05:30
|
|
|
|
(_("Add parents"), self.add_sp_parents),
|
2003-08-01 09:08:51 +05:30
|
|
|
|
(_("Remove parents"),self.del_sp_parents),
|
|
|
|
|
]
|
2005-02-20 06:32:15 +05:30
|
|
|
|
if not self.parent.db.readonly:
|
|
|
|
|
for msg,callback in entries:
|
|
|
|
|
Utils.add_menuitem(menu,msg,family,callback)
|
2003-10-20 08:17:03 +05:30
|
|
|
|
menu.popup(None,None,None,event.button,event.time)
|
2003-08-01 09:08:51 +05:30
|
|
|
|
|
|
|
|
|
def edit_ap_relationships(self,obj):
|
|
|
|
|
self.parent_editor(self.person,self.ap_selection)
|
|
|
|
|
|
|
|
|
|
def edit_sp_relationships(self,obj):
|
|
|
|
|
self.parent_editor(self.selected_spouse,self.sp_selection)
|
|
|
|
|
|
2003-11-20 10:29:36 +05:30
|
|
|
|
def ap_par_button_press(self,obj,event):
|
2003-08-31 04:44:00 +05:30
|
|
|
|
if self.person == None:
|
|
|
|
|
return
|
2002-10-20 19:55:16 +05:30
|
|
|
|
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
|
|
|
|
self.parent_editor(self.person,self.ap_selection)
|
2003-08-01 09:08:51 +05:30
|
|
|
|
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
2004-07-28 07:59:07 +05:30
|
|
|
|
plist = self.person.get_parent_family_handle_list()
|
2003-08-01 09:08:51 +05:30
|
|
|
|
|
|
|
|
|
if len(plist) == 0:
|
2003-10-20 08:17:03 +05:30
|
|
|
|
self.build_parents_nosel_menu(event)
|
2003-08-01 09:08:51 +05:30
|
|
|
|
return
|
|
|
|
|
elif len(plist) == 1:
|
|
|
|
|
family,m,r = plist[0]
|
|
|
|
|
else:
|
2004-10-06 09:12:54 +05:30
|
|
|
|
model, node = self.ap_selection.get_selected()
|
|
|
|
|
path = model.get_path(node)
|
2003-08-01 09:08:51 +05:30
|
|
|
|
family,m,r = plist[path[0]]
|
2003-10-20 08:17:03 +05:30
|
|
|
|
self.build_parents_menu(family,event)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2003-11-20 10:29:36 +05:30
|
|
|
|
def sp_par_button_press(self,obj,event):
|
2003-08-01 09:08:51 +05:30
|
|
|
|
if self.selected_spouse == None:
|
2003-08-25 05:12:42 +05:30
|
|
|
|
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
2003-10-20 08:17:03 +05:30
|
|
|
|
self.build_nav_menu(event)
|
2003-08-25 09:24:08 +05:30
|
|
|
|
return
|
2002-10-20 19:55:16 +05:30
|
|
|
|
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
|
|
|
|
self.parent_editor(self.selected_spouse,self.sp_selection)
|
2003-08-01 09:08:51 +05:30
|
|
|
|
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
2004-07-28 07:59:07 +05:30
|
|
|
|
plist = self.selected_spouse.get_parent_family_handle_list()
|
2003-08-01 09:08:51 +05:30
|
|
|
|
if len(plist) == 0:
|
2003-10-20 08:17:03 +05:30
|
|
|
|
self.build_sp_parents_nosel_menu(event)
|
2003-08-01 09:08:51 +05:30
|
|
|
|
return
|
|
|
|
|
elif len(plist) == 1:
|
|
|
|
|
family,m,r = plist[0]
|
|
|
|
|
else:
|
2004-10-06 09:12:54 +05:30
|
|
|
|
model, node = self.sp_selection.get_selected()
|
|
|
|
|
path = model.get_path(node)
|
2003-08-01 09:08:51 +05:30
|
|
|
|
family,m,r = plist[path[0]]
|
2003-10-20 08:17:03 +05:30
|
|
|
|
self.build_sp_parents_menu(family,event)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
def add_parents_clicked(self,obj):
|
|
|
|
|
self.parent_add(self.person)
|
|
|
|
|
|
|
|
|
|
def add_sp_parents(self,obj):
|
2002-11-10 00:14:58 +05:30
|
|
|
|
if self.selected_spouse:
|
|
|
|
|
self.parent_add(self.selected_spouse)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
def del_parents_clicked(self,obj):
|
2004-07-28 07:59:07 +05:30
|
|
|
|
if len(self.person.get_parent_family_handle_list()) == 0:
|
2002-11-10 00:14:58 +05:30
|
|
|
|
return
|
2005-01-01 09:57:15 +05:30
|
|
|
|
n = NameDisplay.displayer.display(self.person)
|
2003-02-24 10:21:57 +05:30
|
|
|
|
QuestionDialog(_('Remove Parents of %s') % n,
|
|
|
|
|
_('Removing the parents of a person removes the person as a '
|
|
|
|
|
'child of the parents. The parents are not removed from the '
|
|
|
|
|
'database, and the relationship between the parents '
|
|
|
|
|
'is not removed.'),
|
2003-03-23 09:20:59 +05:30
|
|
|
|
_('_Remove Parents'),
|
2002-11-10 00:14:58 +05:30
|
|
|
|
self.really_del_parents)
|
|
|
|
|
|
|
|
|
|
def really_del_parents(self):
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.parent_deleter(self.person,self.ap_selection)
|
|
|
|
|
|
|
|
|
|
def del_sp_parents(self,obj):
|
2004-07-28 07:59:07 +05:30
|
|
|
|
if not self.selected_spouse or len(self.selected_spouse.get_parent_family_handle_list()) == 0:
|
2002-11-10 00:14:58 +05:30
|
|
|
|
return
|
2005-01-01 09:57:15 +05:30
|
|
|
|
n = NameDisplay.displayer.display(self.selected_spouse)
|
2003-02-24 10:21:57 +05:30
|
|
|
|
QuestionDialog(_('Remove Parents of %s') % n,
|
|
|
|
|
_('Removing the parents of a person removes the person as a '
|
|
|
|
|
'child of the parents. The parents are not removed from the '
|
|
|
|
|
'database, and the relationship between the parents '
|
|
|
|
|
'is not removed.'),
|
2003-03-23 09:20:59 +05:30
|
|
|
|
_('_Remove Parents'),
|
2002-12-14 10:37:09 +05:30
|
|
|
|
self.really_del_sp_parents)
|
2002-11-10 00:14:58 +05:30
|
|
|
|
|
2002-12-14 10:37:09 +05:30
|
|
|
|
def really_del_sp_parents(self):
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.parent_deleter(self.selected_spouse,self.sp_selection)
|
|
|
|
|
|
2002-10-25 10:22:51 +05:30
|
|
|
|
def child_back(self,obj):
|
|
|
|
|
"""makes the currently select child the active person"""
|
2004-10-06 09:12:54 +05:30
|
|
|
|
model, node = self.child_selection.get_selected()
|
|
|
|
|
if node:
|
2004-11-30 09:23:51 +05:30
|
|
|
|
handle = self.child_model.get_value(node,_HANDLE_COL)
|
|
|
|
|
child = self.parent.db.get_person_from_handle(handle)
|
2004-07-12 05:23:02 +05:30
|
|
|
|
self.parent.change_active_person(child)
|
2002-10-25 10:22:51 +05:30
|
|
|
|
self.load_family()
|
2003-08-13 09:58:07 +05:30
|
|
|
|
else:
|
2004-10-06 09:12:54 +05:30
|
|
|
|
child_list = self.family.get_child_handle_list()
|
|
|
|
|
if len(child_list) == 1:
|
|
|
|
|
p = self.parent.db.get_person_from_handle(child_list[0])
|
2004-07-12 05:23:02 +05:30
|
|
|
|
self.parent.change_active_person(p)
|
2003-08-13 09:58:07 +05:30
|
|
|
|
self.load_family()
|
2002-10-25 10:22:51 +05:30
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
def parent_editor(self,person,selection):
|
|
|
|
|
if not person:
|
|
|
|
|
return
|
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
|
plist = person.get_parent_family_handle_list()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
if len(plist) == 0:
|
|
|
|
|
return
|
|
|
|
|
elif len(plist) == 1:
|
|
|
|
|
parents,mrel,frel = plist[0]
|
|
|
|
|
else:
|
2004-10-06 09:12:54 +05:30
|
|
|
|
model, node = selection.get_selected()
|
|
|
|
|
if not node:
|
2002-10-20 19:55:16 +05:30
|
|
|
|
return
|
|
|
|
|
|
2004-10-06 09:12:54 +05:30
|
|
|
|
row = model.get_path(node)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
parents,mrel,frel = plist[row[0]]
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
ChooseParents.ModifyParents(self.parent.db,person,parents,
|
2003-11-19 08:44:14 +05:30
|
|
|
|
self.parent.topWindow)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
except:
|
|
|
|
|
DisplayTrace.DisplayTrace()
|
|
|
|
|
|
|
|
|
|
def parent_add(self,person):
|
|
|
|
|
if not person:
|
|
|
|
|
return
|
|
|
|
|
try:
|
2004-04-17 00:45:02 +05:30
|
|
|
|
ChooseParents.ChooseParents(self.parent,
|
|
|
|
|
self.parent.db,
|
|
|
|
|
person,
|
2005-04-01 11:03:22 +05:30
|
|
|
|
None)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
except:
|
|
|
|
|
DisplayTrace.DisplayTrace()
|
|
|
|
|
|
|
|
|
|
def parent_deleter(self,person,selection):
|
|
|
|
|
if not person:
|
|
|
|
|
return
|
2004-07-12 05:23:02 +05:30
|
|
|
|
|
2004-08-13 10:04:07 +05:30
|
|
|
|
trans = self.parent.db.transaction_begin()
|
2004-07-28 07:59:07 +05:30
|
|
|
|
plist = person.get_parent_family_handle_list()
|
2004-07-12 05:23:02 +05:30
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
if len(plist) == 0:
|
|
|
|
|
return
|
|
|
|
|
if len(plist) == 1:
|
2004-07-28 07:59:07 +05:30
|
|
|
|
person.clear_parent_family_handle_list()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
else:
|
2004-10-06 09:12:54 +05:30
|
|
|
|
model, node = selection.get_selected()
|
|
|
|
|
if not node:
|
2002-10-20 19:55:16 +05:30
|
|
|
|
return
|
|
|
|
|
|
2004-10-06 09:12:54 +05:30
|
|
|
|
row = model.get_path(node)
|
2004-07-28 07:59:07 +05:30
|
|
|
|
family_handle = person.get_parent_family_handle_list()[row[0]][0]
|
|
|
|
|
person.remove_parent_family_handle(family_handle)
|
2004-08-07 10:46:57 +05:30
|
|
|
|
fam = self.parent.db.get_family_from_handle(family_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
|
|
|
|
|
|
if len(fam.get_child_handle_list()) == 0:
|
|
|
|
|
father_handle = fam.get_father_handle()
|
|
|
|
|
mother_handle = fam.get_mother_handle()
|
|
|
|
|
if father_handle == None and mother_handle:
|
2005-02-16 19:19:32 +05:30
|
|
|
|
mother = self.parent.db.get_person_from_handle(mother_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
|
mother.remove_family_handle(fam)
|
2004-07-12 05:23:02 +05:30
|
|
|
|
self.parent.db.commit_person(mother,trans)
|
2004-12-03 07:19:09 +05:30
|
|
|
|
self.parent.db.remove_family(fam,trans)
|
2004-07-28 07:59:07 +05:30
|
|
|
|
elif mother_handle == None and father_handle:
|
2005-02-16 19:19:32 +05:30
|
|
|
|
father = self.parent.db.get_person_from_handle(father_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
|
father.remove_family_handle(fam,trans)
|
2004-07-12 05:23:02 +05:30
|
|
|
|
self.parent.db.commit_person(father,trans)
|
2004-12-03 07:19:09 +05:30
|
|
|
|
self.parent.db.remove_family(fam,trans)
|
2004-02-26 10:21:57 +05:30
|
|
|
|
|
2004-03-30 10:20:24 +05:30
|
|
|
|
self.parent.db.commit_person(person,trans)
|
2004-05-19 11:43:36 +05:30
|
|
|
|
n = person.get_primary_name().get_regular_name()
|
2004-08-13 10:04:07 +05:30
|
|
|
|
self.parent.db.transaction_commit(trans,_("Remove Parents (%s)") % n)
|
2004-03-30 10:20:24 +05:30
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.load_family()
|
|
|
|
|
|
2003-01-10 10:51:32 +05:30
|
|
|
|
def drag_data_received(self,widget,context,x,y,sel_data,info,time):
|
2003-01-13 09:29:10 +05:30
|
|
|
|
path = self.child_list.get_path_at_pos(x,y)
|
|
|
|
|
if path == None:
|
2004-07-28 07:59:07 +05:30
|
|
|
|
row = len(self.family.get_child_handle_list())
|
2003-01-13 09:29:10 +05:30
|
|
|
|
else:
|
|
|
|
|
row = path[0][0] -1
|
2005-04-06 14:58:54 +05:30
|
|
|
|
|
|
|
|
|
if DdTargets.PERSON_LINK.drag_type in context.targets:
|
|
|
|
|
drop_person_handle = sel_data.data
|
|
|
|
|
|
|
|
|
|
# Check child is not already in the family
|
|
|
|
|
if drop_person_handle in self.family.get_child_handle_list():
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
family = self.family
|
|
|
|
|
person = self.person
|
|
|
|
|
new_person = self.parent.db.get_person_from_handle(drop_person_handle)
|
|
|
|
|
trans = self.parent.db.transaction_begin()
|
|
|
|
|
if not family:
|
|
|
|
|
# Add family to active person,
|
|
|
|
|
# if it does not exist yet (child with no spouse)
|
|
|
|
|
family = RelLib.Family()
|
|
|
|
|
self.parent.db.add_family(family,trans)
|
|
|
|
|
person.add_family_handle(family.get_handle())
|
|
|
|
|
if person.get_gender() == RelLib.Person.MALE:
|
|
|
|
|
family.set_father_handle(person.get_handle())
|
|
|
|
|
else:
|
|
|
|
|
family.set_mother_handle(person.get_handle())
|
|
|
|
|
self.parent.db.commit_family(family,trans)
|
|
|
|
|
self.parent.db.commit_person(person,trans)
|
|
|
|
|
|
|
|
|
|
family.add_child_handle(new_person.get_handle())
|
|
|
|
|
new_person.add_parent_family_handle(family.get_handle(),
|
|
|
|
|
RelLib.Person.CHILD_REL_BIRTH,
|
|
|
|
|
RelLib.Person.CHILD_REL_BIRTH)
|
|
|
|
|
self.parent.db.commit_person(new_person,trans)
|
|
|
|
|
self.parent.db.commit_family(family,trans)
|
|
|
|
|
self.parent.db.transaction_commit(trans,_("Add Child to Family"))
|
|
|
|
|
self.display_marriage(family)
|
2003-01-10 10:51:32 +05:30
|
|
|
|
|
2005-04-06 14:58:54 +05:30
|
|
|
|
elif sel_data and sel_data.data:
|
2003-01-10 10:51:32 +05:30
|
|
|
|
exec 'data = %s' % sel_data.data
|
|
|
|
|
exec 'mytype = "%s"' % data[0]
|
|
|
|
|
exec 'person = "%s"' % data[1]
|
2003-03-08 10:33:18 +05:30
|
|
|
|
|
2003-01-10 10:51:32 +05:30
|
|
|
|
if mytype != 'child':
|
|
|
|
|
return
|
|
|
|
|
|
2003-01-13 09:29:10 +05:30
|
|
|
|
s,i = self.child_selection.get_selected()
|
|
|
|
|
if not i:
|
|
|
|
|
return
|
2003-03-08 10:33:18 +05:30
|
|
|
|
|
2003-01-13 09:29:10 +05:30
|
|
|
|
spath = s.get_path(i)
|
|
|
|
|
src = spath[0]
|
2004-10-06 09:12:54 +05:30
|
|
|
|
child_list = self.family.get_child_handle_list()
|
2003-03-08 10:33:18 +05:30
|
|
|
|
|
2004-10-06 09:12:54 +05:30
|
|
|
|
obj = child_list[src]
|
|
|
|
|
child_list.remove(obj)
|
|
|
|
|
child_list.insert(row,obj)
|
2003-03-08 10:33:18 +05:30
|
|
|
|
|
2004-10-06 09:12:54 +05:30
|
|
|
|
if self.birth_dates_in_order(child_list) == 0:
|
2003-02-27 05:59:37 +05:30
|
|
|
|
WarningDialog(_("Attempt to Reorder Children Failed"),
|
|
|
|
|
_("Children must be ordered by their birth dates."))
|
2003-01-13 09:29:10 +05:30
|
|
|
|
return
|
2004-10-06 09:12:54 +05:30
|
|
|
|
self.family.set_child_handle_list(child_list)
|
2004-08-13 10:04:07 +05:30
|
|
|
|
trans = self.parent.db.transaction_begin()
|
2004-06-30 09:36:10 +05:30
|
|
|
|
self.parent.db.commit_family(self.family,trans)
|
2004-08-13 10:04:07 +05:30
|
|
|
|
self.parent.db.transaction_commit(trans,_('Reorder children'))
|
2004-11-19 06:44:37 +05:30
|
|
|
|
self.load_family(self.family)
|
|
|
|
|
|
|
|
|
|
def sp_drag_data_received(self,widget,context,x,y,sel_data,info,time):
|
|
|
|
|
self.in_drag = True
|
|
|
|
|
path = self.spouse_list.get_path_at_pos(x,y)
|
|
|
|
|
if path == None:
|
|
|
|
|
row = len(self.person.get_family_handle_list())
|
|
|
|
|
else:
|
|
|
|
|
row = path[0][0] -1
|
|
|
|
|
|
|
|
|
|
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 != 'spouse':
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
s,i = self.spouse_selection.get_selected()
|
|
|
|
|
if not i:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
spath = s.get_path(i)
|
|
|
|
|
src = spath[0]
|
|
|
|
|
family_list = self.person.get_family_handle_list()
|
|
|
|
|
|
|
|
|
|
obj = family_list[src]
|
|
|
|
|
family_list.remove(obj)
|
|
|
|
|
family_list.insert(row,obj)
|
|
|
|
|
|
|
|
|
|
self.person.set_family_handle_list(family_list)
|
|
|
|
|
trans = self.parent.db.transaction_begin()
|
|
|
|
|
self.parent.db.commit_person(self.person,trans)
|
|
|
|
|
self.parent.db.transaction_commit(trans,_('Reorder spouses'))
|
|
|
|
|
self.load_family()
|
|
|
|
|
#self.display_marriage(self.family)
|
|
|
|
|
self.in_drag = False
|
2003-01-13 09:29:10 +05:30
|
|
|
|
|
2003-01-10 10:51:32 +05:30
|
|
|
|
def drag_data_get(self,widget, context, sel_data, info, time):
|
2004-10-06 09:12:54 +05:30
|
|
|
|
store,node = self.child_selection.get_selected()
|
|
|
|
|
if not node:
|
2003-01-13 09:29:10 +05:30
|
|
|
|
return
|
2004-11-30 09:23:51 +05:30
|
|
|
|
handle = self.child_model.get_value(node,_HANDLE_COL)
|
2003-01-10 10:51:32 +05:30
|
|
|
|
bits_per = 8; # we're going to pass a string
|
2005-04-06 14:58:54 +05:30
|
|
|
|
|
|
|
|
|
if sel_data.target == DdTargets.PERSON_LINK.drag_type:
|
|
|
|
|
sel_data.set(sel_data.target, bits_per, handle)
|
|
|
|
|
else:
|
|
|
|
|
data = str(('child',handle));
|
|
|
|
|
sel_data.set(sel_data.target, bits_per, data)
|
2003-01-10 10:51:32 +05:30
|
|
|
|
|
2004-11-19 06:44:37 +05:30
|
|
|
|
def sp_drag_data_get(self,widget, context, sel_data, info, time):
|
|
|
|
|
store,node = self.spouse_selection.get_selected()
|
|
|
|
|
if not node:
|
|
|
|
|
return
|
|
|
|
|
handle = self.spouse_model.get_value(node,1)
|
|
|
|
|
bits_per = 8; # we're going to pass a string
|
|
|
|
|
data = str(('spouse',handle));
|
|
|
|
|
sel_data.set(sel_data.target, bits_per, data)
|
|
|
|
|
|
2003-06-15 09:43:16 +05:30
|
|
|
|
def north_american(self,val):
|
2005-02-01 09:16:29 +05:30
|
|
|
|
if self.person.get_gender() == RelLib.Person.MALE:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
pname = self.person.get_primary_name()
|
|
|
|
|
return (pname.get_surname_prefix(),pname.get_surname())
|
2003-06-15 09:43:16 +05:30
|
|
|
|
elif self.family:
|
2004-07-28 07:59:07 +05:30
|
|
|
|
fid = self.family.get_father_handle()
|
|
|
|
|
f = self.parent.db.get_family_from_handle(fid)
|
2003-06-15 09:43:16 +05:30
|
|
|
|
if f:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
pname = f.get_primary_name()
|
|
|
|
|
return (pname.get_surname_prefix(),pname.get_surname())
|
2003-10-11 07:52:51 +05:30
|
|
|
|
return ("","")
|
2003-06-15 09:43:16 +05:30
|
|
|
|
|
|
|
|
|
def no_name(self,val):
|
2003-10-06 09:59:50 +05:30
|
|
|
|
return ("","")
|
2003-06-15 09:43:16 +05:30
|
|
|
|
|
|
|
|
|
def latin_american(self,val):
|
|
|
|
|
if self.family:
|
2004-07-28 07:59:07 +05:30
|
|
|
|
father = self.family.get_father_handle()
|
|
|
|
|
mother = self.family.get_mother_handle()
|
2003-06-15 09:43:16 +05:30
|
|
|
|
if not father or not mother:
|
2003-10-11 07:52:51 +05:30
|
|
|
|
return ("","")
|
2004-02-14 11:10:30 +05:30
|
|
|
|
fsn = father.get_primary_name().get_surname()
|
|
|
|
|
msn = mother.get_primary_name().get_surname()
|
2003-06-15 09:43:16 +05:30
|
|
|
|
if not father or not mother:
|
2003-10-06 09:59:50 +05:30
|
|
|
|
return ("","")
|
2003-06-15 09:43:16 +05:30
|
|
|
|
try:
|
2003-10-06 09:59:50 +05:30
|
|
|
|
return ("","%s %s" % (fsn.split()[0],msn.split()[0]))
|
2003-06-15 09:43:16 +05:30
|
|
|
|
except:
|
2003-10-06 09:59:50 +05:30
|
|
|
|
return ("","")
|
2003-06-15 09:43:16 +05:30
|
|
|
|
else:
|
2003-10-06 09:59:50 +05:30
|
|
|
|
return ("","")
|
2003-06-15 09:43:16 +05:30
|
|
|
|
|
|
|
|
|
def icelandic(self,val):
|
|
|
|
|
fname = ""
|
2005-02-01 09:16:29 +05:30
|
|
|
|
if self.person.get_gender() == RelLib.Person.MALE:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
fname = self.person.get_primary_name().get_first_name()
|
2003-06-15 09:43:16 +05:30
|
|
|
|
elif self.family:
|
2004-07-28 07:59:07 +05:30
|
|
|
|
f = self.family.get_father_handle()
|
2003-06-15 09:43:16 +05:30
|
|
|
|
if f:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
fname = f.get_primary_name().get_first_name()
|
2003-06-15 09:43:16 +05:30
|
|
|
|
if fname:
|
2003-07-08 06:12:26 +05:30
|
|
|
|
fname = fname.split()[0]
|
2003-06-15 09:43:16 +05:30
|
|
|
|
if val == 0:
|
2003-10-06 09:59:50 +05:30
|
|
|
|
return ("","%ssson" % fname)
|
2003-06-15 09:43:16 +05:30
|
|
|
|
elif val == 1:
|
2003-10-06 09:59:50 +05:30
|
|
|
|
return ("","%sd<EFBFBD>ttir" % fname)
|
2003-06-15 09:43:16 +05:30
|
|
|
|
else:
|
2003-10-06 09:59:50 +05:30
|
|
|
|
return ("","")
|
2003-06-15 09:43:16 +05:30
|
|
|
|
|
2004-03-25 09:34:35 +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-23 07:55:07 +05:30
|
|
|
|
inorder = True
|
|
|
|
|
prev_date = 0
|
2004-03-25 09:34:35 +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.parent.db.get_person_from_handle(child_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
|
birth_handle = 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
|
|
|
|
birth = self.parent.db.get_event_from_handle(birth_handle)
|
2004-03-25 09:34:35 +05:30
|
|
|
|
if not birth:
|
|
|
|
|
continue
|
2004-09-23 07:55:07 +05:30
|
|
|
|
child_date = birth.get_date_object().get_sort_value()
|
|
|
|
|
if child_date == 0:
|
2004-03-25 09:34:35 +05:30
|
|
|
|
continue
|
2005-03-10 05:58:57 +05:30
|
|
|
|
if prev_date <= child_date: # <= allows for twins
|
2004-03-25 09:34:35 +05:30
|
|
|
|
prev_date = child_date
|
|
|
|
|
else:
|
2004-09-23 07:55:07 +05:30
|
|
|
|
inorder = False
|
2004-03-25 09:34:35 +05:30
|
|
|
|
return inorder
|