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
|
|
|
|
|
#
|
2004-01-08 21:09:33 +05:30
|
|
|
|
# Copyright (C) 2000-2004 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
|
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
# GTK/Gnome modules
|
|
|
|
|
#
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
import gobject
|
|
|
|
|
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 sort
|
|
|
|
|
import Utils
|
|
|
|
|
import GrampsCfg
|
|
|
|
|
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
|
2003-01-10 10:51:32 +05:30
|
|
|
|
|
2003-08-17 07:44:33 +05:30
|
|
|
|
from gettext import gettext as _
|
2003-01-10 10:51:32 +05:30
|
|
|
|
from QuestionDialog import QuestionDialog,WarningDialog
|
|
|
|
|
|
2003-05-24 09:10:58 +05:30
|
|
|
|
_BORN = _('b.')
|
|
|
|
|
_DIED = _('d.')
|
|
|
|
|
|
2003-01-10 10:51:32 +05:30
|
|
|
|
pycode_tgts = [('child', 0, 0)]
|
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 ]
|
2003-08-26 09:15:41 +05:30
|
|
|
|
self.init_interface()
|
|
|
|
|
|
|
|
|
|
def set_widgets(self,val):
|
2003-10-17 09:54:36 +05:30
|
|
|
|
already_init = self.cadded[val]
|
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:
|
|
|
|
|
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)
|
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:
|
|
|
|
|
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)
|
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
|
|
|
|
|
|
|
|
|
def init_interface(self):
|
2003-08-28 07:20:29 +05:30
|
|
|
|
fv = GrampsCfg.familyview
|
|
|
|
|
self.set_widgets(fv)
|
|
|
|
|
|
|
|
|
|
already_init = self.cadded[fv]
|
2003-08-26 09:15:41 +05:30
|
|
|
|
|
2003-02-24 10:21:57 +05:30
|
|
|
|
self.ap_model = gtk.ListStore(gobject.TYPE_STRING)
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
self.ap_parents_model = gtk.ListStore(gobject.TYPE_STRING)
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
self.sp_parents_model = gtk.ListStore(gobject.TYPE_STRING)
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
self.spouse_model = gtk.ListStore(gobject.TYPE_STRING)
|
|
|
|
|
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
|
|
|
|
|
|
2003-01-10 10:51:32 +05:30
|
|
|
|
self.child_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY)
|
|
|
|
|
self.child_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
|
|
|
|
|
self.child_list.connect('drag_data_get', self.drag_data_get)
|
|
|
|
|
self.child_list.connect('drag_begin', self.drag_begin)
|
|
|
|
|
self.child_list.connect('drag_data_received',self.drag_data_received)
|
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.child_model = gtk.ListStore(gobject.TYPE_INT, gobject.TYPE_STRING,
|
|
|
|
|
gobject.TYPE_STRING,gobject.TYPE_STRING,
|
|
|
|
|
gobject.TYPE_STRING,gobject.TYPE_STRING,
|
|
|
|
|
gobject.TYPE_STRING)
|
2003-01-10 10:51:32 +05:30
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.child_selection = self.child_list.get_selection()
|
|
|
|
|
|
2003-09-03 10:27:36 +05:30
|
|
|
|
if not already_init:
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
self.child_list.set_model(self.child_model)
|
|
|
|
|
self.child_list.set_search_column(0)
|
|
|
|
|
self.child_selection = self.child_list.get_selection()
|
|
|
|
|
|
2003-08-31 08:59:12 +05:30
|
|
|
|
if not already_init:
|
|
|
|
|
Utils.build_columns(self.child_list,
|
2003-11-05 17:07:00 +05:30
|
|
|
|
[ (' ',30,0), (_('Name'),250,-1), (_('ID'),50,-1),
|
2003-11-13 09:54:13 +05:30
|
|
|
|
(_('Gender'),75,-1), (_('Birth date'),150,6),
|
2003-08-31 08:59:12 +05:30
|
|
|
|
(_('Status'),100,-1), ('',0,-1) ])
|
2003-08-28 07:20:29 +05:30
|
|
|
|
self.cadded[fv] = 1
|
|
|
|
|
|
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)
|
2003-08-31 04:44:00 +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:
|
|
|
|
|
self.remove_spouse(obj)
|
|
|
|
|
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):
|
|
|
|
|
model, iter = self.child_selection.get_selected()
|
|
|
|
|
if not iter:
|
|
|
|
|
return
|
|
|
|
|
id = self.child_model.get_value(iter,2)
|
|
|
|
|
if event.keyval == gtk.gdk.keyval_from_name("Return") and not event.state:
|
|
|
|
|
self.child_rel_by_id(id)
|
|
|
|
|
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 = [
|
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
|
|
|
|
|
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
|
|
|
|
|
(_("Home"),self.parent.on_home_clicked,1),
|
2003-08-25 05:12:42 +05:30
|
|
|
|
(_("Add Bookmark"),self.parent.on_add_bookmark_activate,1),
|
|
|
|
|
]
|
2003-08-25 09:24:08 +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
|
|
|
|
|
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
|
|
|
|
|
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
|
|
|
|
|
(_("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
|
|
|
|
|
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 = [
|
|
|
|
|
(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
|
|
|
|
|
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
|
|
|
|
|
(_("Home"),self.parent.on_home_clicked,1),
|
2003-08-30 06:46:40 +05:30
|
|
|
|
(None,None,0),
|
|
|
|
|
(_("Add parents"),self.add_parents_clicked,1),
|
|
|
|
|
]
|
|
|
|
|
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
|
|
|
|
|
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 = [
|
|
|
|
|
(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
|
|
|
|
|
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
|
|
|
|
|
(_("Home"),self.parent.on_home_clicked,1),
|
2003-08-30 06:46:40 +05:30
|
|
|
|
(None,None,0),
|
|
|
|
|
(_("Add parents"),self.add_sp_parents,1),
|
|
|
|
|
]
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
def on_child_list_button_press(self,obj,event):
|
2003-06-17 09:45:58 +05:30
|
|
|
|
model, iter = self.child_selection.get_selected()
|
|
|
|
|
if not iter:
|
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
|
|
|
|
|
id = self.child_model.get_value(iter,2)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
|
2003-11-20 10:29:36 +05:30
|
|
|
|
self.child_rel_by_id(id)
|
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:
|
2003-10-20 08:17:03 +05:30
|
|
|
|
self.build_child_menu(id,event)
|
2003-08-01 09:08:51 +05:30
|
|
|
|
|
2003-10-20 08:17:03 +05:30
|
|
|
|
def build_child_menu(self,id,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
|
|
|
|
|
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
|
|
|
|
|
(_("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
|
|
|
|
|
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),
|
|
|
|
|
]
|
|
|
|
|
for msg,callback in entries:
|
|
|
|
|
Utils.add_menuitem(menu,msg,id,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):
|
|
|
|
|
model, iter = self.child_selection.get_selected()
|
|
|
|
|
if not iter:
|
|
|
|
|
return
|
2004-02-14 11:10:30 +05:30
|
|
|
|
child = self.parent.db.get_person(self.child_model.get_value(iter,2))
|
2003-08-01 09:08:51 +05:30
|
|
|
|
try:
|
2004-02-21 12:10:44 +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-02-14 11:10:30 +05:30
|
|
|
|
person = self.parent.db.get_person(obj.get_data(Utils.OBJECT))
|
2004-02-16 04:40:12 +05:30
|
|
|
|
SelectChild.EditRel(self.parent.db,person,self.family,self.load_family)
|
2003-06-17 09:45:58 +05:30
|
|
|
|
|
2003-11-20 10:29:36 +05:30
|
|
|
|
def child_rel_by_id(self,id):
|
2004-02-14 11:10:30 +05:30
|
|
|
|
person = self.parent.db.get_person(id)
|
2004-02-16 04:40:12 +05:30
|
|
|
|
SelectChild.EditRel(self.parent.db,person,self.family,self.load_family)
|
2003-11-20 10:29:36 +05:30
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
def spouse_changed(self,obj):
|
|
|
|
|
model, iter = obj.get_selected()
|
|
|
|
|
if not iter:
|
|
|
|
|
self.display_marriage(None)
|
|
|
|
|
else:
|
|
|
|
|
row = model.get_path(iter)
|
2004-02-14 11:10:30 +05:30
|
|
|
|
id = self.person.get_family_id_list()[row[0]]
|
|
|
|
|
fam = self.parent.db.find_family_from_id(id)
|
|
|
|
|
self.display_marriage(fam)
|
2003-08-01 09:08:51 +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
|
|
|
|
|
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
|
|
|
|
|
(_("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
|
|
|
|
|
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),
|
|
|
|
|
]
|
|
|
|
|
for msg,callback in entries:
|
2003-10-20 08:17:03 +05:30
|
|
|
|
Utils.add_menuitem(menu,msg,None,callback)
|
|
|
|
|
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-02-14 11:10:30 +05:30
|
|
|
|
self.person.set_preferred_family_id(self.family)
|
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-21 12:10:44 +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):
|
|
|
|
|
Marriage.Marriage(self.family,self.parent.db,
|
|
|
|
|
self.parent.new_after_edit,
|
|
|
|
|
self.load_family)
|
|
|
|
|
|
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:
|
|
|
|
|
Marriage.Marriage(self.family,self.parent.db,
|
2003-06-07 22:00:44 +05:30
|
|
|
|
self.parent.new_after_edit,
|
|
|
|
|
self.load_family)
|
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.load_family,
|
2003-10-17 08:42:05 +05:30
|
|
|
|
self.parent.people_view.redisplay_person_list,
|
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:
|
2004-02-21 12:10:44 +05:30
|
|
|
|
AddSpouse.AddSpouse(self.parent, self.parent.db, self.person,
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.load_family,
|
2003-10-17 08:42:05 +05:30
|
|
|
|
self.parent.people_view.redisplay_person_list)
|
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()
|
2004-02-14 11:10:30 +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:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
person.set_gender(RelLib.Person.male)
|
2003-06-15 09:43:16 +05:30
|
|
|
|
try:
|
2004-02-21 12:10:44 +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()
|
|
|
|
|
|
2003-12-18 00:08:02 +05:30
|
|
|
|
def spouse_after_edit(self,epo):
|
2003-10-13 08:56:05 +05:30
|
|
|
|
ap = self.parent.active_person
|
|
|
|
|
if epo:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.parent.db.build_person_display(epo.person.get_id(),epo.original_id)
|
2003-10-13 08:56:05 +05:30
|
|
|
|
self.parent.people_view.remove_from_person_list(epo.person,epo.original_id)
|
|
|
|
|
self.parent.people_view.redisplay_person_list(epo.person)
|
|
|
|
|
|
|
|
|
|
self.parent.active_person = ap
|
|
|
|
|
self.load_family(self.family)
|
|
|
|
|
|
2003-12-18 00:08:02 +05:30
|
|
|
|
def new_spouse_after_edit(self,epo):
|
2004-02-16 02:19:34 +05:30
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
|
if epo.person.get_id() == "":
|
|
|
|
|
self.parent.db.add_person(epo.person)
|
2003-06-15 09:43:16 +05:30
|
|
|
|
else:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.parent.db.add_person_no_map(epo.person,epo.person.get_id())
|
2004-02-16 02:19:34 +05:30
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.parent.db.build_person_display(epo.person.get_id())
|
2003-10-08 09:54:11 +05:30
|
|
|
|
self.parent.people_view.add_to_person_list(epo.person,0)
|
2003-06-15 09:43:16 +05:30
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.family = self.parent.db.new_family()
|
|
|
|
|
self.person.add_family_id(self.family.get_id())
|
|
|
|
|
epo.person.add_family_id(self.family.get_id())
|
2003-06-15 09:43:16 +05:30
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
|
if self.person.get_gender() == RelLib.Person.male:
|
2004-02-16 02:19:34 +05:30
|
|
|
|
self.family.set_mother_id(epo.person.get_id())
|
|
|
|
|
self.family.set_father_id(self.person.get_id())
|
2003-06-15 09:43:16 +05:30
|
|
|
|
else:
|
2004-02-16 02:19:34 +05:30
|
|
|
|
self.family.set_father_id(epo.person.get_id())
|
|
|
|
|
self.family.set_mother_id(self.person.get_id())
|
2003-06-15 09:43:16 +05:30
|
|
|
|
|
|
|
|
|
self.load_family(self.family)
|
|
|
|
|
|
|
|
|
|
Marriage.Marriage(self.family,self.parent.db,
|
|
|
|
|
self.parent.new_after_edit,
|
|
|
|
|
self.load_family)
|
|
|
|
|
|
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()
|
|
|
|
|
autoname = GrampsCfg.lastnamegen
|
|
|
|
|
|
|
|
|
|
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-02-21 12:10:44 +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):
|
|
|
|
|
if not self.family:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.family = self.parent.db.new_family()
|
|
|
|
|
person.add_family_id(self.family.get_id())
|
|
|
|
|
if person.get_gender() == RelLib.Person.male:
|
|
|
|
|
self.family.set_father_id(person)
|
2003-06-19 09:24:45 +05:30
|
|
|
|
else:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.family.set_mother_id(person)
|
2003-06-19 09:24:45 +05:30
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.family.add_child_id(person)
|
|
|
|
|
person.add_parent_family_id(self.family.get_id(),"Birth","Birth")
|
2003-06-19 09:24:45 +05:30
|
|
|
|
self.parent.update_person_list(person)
|
|
|
|
|
self.load_family(self.family)
|
|
|
|
|
|
2003-12-18 00:08:02 +05:30
|
|
|
|
def new_child_after_edit(self,epo):
|
2003-06-19 09:24:45 +05:30
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
|
if epo.person.get_id() == "":
|
|
|
|
|
self.parent.db.add_person(epo.person)
|
2003-06-15 09:43:16 +05:30
|
|
|
|
else:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.parent.db.add_person_no_map(epo.person,epo.person.get_id())
|
2003-06-19 09:24:45 +05:30
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.parent.db.build_person_display(epo.person.get_id())
|
2003-10-08 09:54:11 +05:30
|
|
|
|
self.parent.people_view.add_to_person_list(epo.person,0)
|
2003-06-15 09:43:16 +05:30
|
|
|
|
|
2003-06-19 09:24:45 +05:30
|
|
|
|
if not self.family:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.family = self.parent.db.new_family()
|
|
|
|
|
self.person.add_family_id(self.family.get_id())
|
|
|
|
|
if self.person.get_gender() == RelLib.Person.male:
|
|
|
|
|
self.family.set_father_id(self.person)
|
2003-06-19 09:24:45 +05:30
|
|
|
|
else:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.family.set_mother_id(self.person)
|
2003-06-19 09:24:45 +05:30
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.family.add_child_id(epo.person)
|
|
|
|
|
epo.person.add_parent_family_id(self.family.get_id(),"Birth","Birth")
|
2003-12-10 09:50:23 +05:30
|
|
|
|
self.display_marriage(self.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:
|
2002-11-03 02:49:58 +05:30
|
|
|
|
SelectChild.SelectChild(self.parent.db, self.family,
|
2002-11-15 09:19:39 +05:30
|
|
|
|
self.person, self.load_family,
|
2003-06-19 09:24:45 +05:30
|
|
|
|
self.update_person_list)
|
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):
|
|
|
|
|
if not self.family or not self.person:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
model, iter = self.child_selection.get_selected()
|
|
|
|
|
if not iter:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
id = self.child_model.get_value(iter,2)
|
2004-02-14 11:10:30 +05:30
|
|
|
|
child = self.parent.db.get_person(id)
|
2002-10-28 19:06:39 +05:30
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.family.remove_child_id(child)
|
|
|
|
|
child.remove_parent_family_id(self.family)
|
2002-10-28 19:06:39 +05:30
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
|
if len(self.family.get_child_id_list()) == 0:
|
|
|
|
|
if self.family.get_father_id() == None:
|
|
|
|
|
self.delete_family_from(self.family.get_mother_id())
|
|
|
|
|
elif self.family.get_mother_id() == None:
|
|
|
|
|
self.delete_family_from(self.family.get_father_id())
|
2002-10-28 19:06:39 +05:30
|
|
|
|
|
|
|
|
|
Utils.modified()
|
|
|
|
|
self.load_family()
|
|
|
|
|
|
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:
|
2003-02-24 10:21:57 +05:30
|
|
|
|
nap = GrampsCfg.nameof(self.person)
|
|
|
|
|
nsp = GrampsCfg.nameof(self.selected_spouse)
|
|
|
|
|
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-02-14 11:10:30 +05:30
|
|
|
|
elif self.family and not self.family.get_child_id_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-14 11:10:30 +05:30
|
|
|
|
if self.selected_spouse == self.family.get_father_id():
|
|
|
|
|
self.family.set_father_id(None)
|
2003-12-07 09:45:54 +05:30
|
|
|
|
else:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.family.set_mother_id(None)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
if self.selected_spouse:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.selected_spouse.remove_family_id(self.family.get_id())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
|
if len(self.family.get_child_id_list()) == 0:
|
|
|
|
|
self.person.remove_family_id(self.family.get_id())
|
|
|
|
|
self.parent.db.delete_family(self.family.get_id())
|
|
|
|
|
if len(self.person.get_family_id_list()) > 0:
|
|
|
|
|
self.load_family(self.person.get_family_id_list()[0])
|
2002-10-20 19:55:16 +05:30
|
|
|
|
else:
|
|
|
|
|
self.load_family()
|
|
|
|
|
else:
|
|
|
|
|
self.load_family()
|
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
|
if len(self.person.get_family_id_list()) <= 1:
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.spouse_selection.set_mode(gtk.SELECTION_NONE)
|
|
|
|
|
|
|
|
|
|
Utils.modified()
|
|
|
|
|
|
|
|
|
|
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):
|
|
|
|
|
self.change_families(self.person)
|
|
|
|
|
|
|
|
|
|
def sp_parents_clicked(self,obj):
|
|
|
|
|
self.change_families(self.selected_spouse)
|
|
|
|
|
|
|
|
|
|
def change_families(self,person):
|
|
|
|
|
if not person:
|
|
|
|
|
return
|
2004-02-14 11:10:30 +05:30
|
|
|
|
plist = person.get_parent_family_id_list()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
if len(plist) == 0:
|
|
|
|
|
return
|
|
|
|
|
if len(plist) == 1:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
family_id,m,r = plist[0]
|
2002-10-20 19:55:16 +05:30
|
|
|
|
else:
|
|
|
|
|
model, iter = self.ap_selection.get_selected()
|
|
|
|
|
path = model.get_path(iter)
|
2004-02-14 11:10:30 +05:30
|
|
|
|
family_id,m,r = plist[path[0]]
|
|
|
|
|
family = self.parent.db.find_family_from_id(family_id)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
|
if family.get_father_id():
|
|
|
|
|
person_id = family.get_father_id()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
else:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
person_id = family.get_mother_id()
|
|
|
|
|
person = self.parent.db.find_person_from_id(person_id)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.parent.change_active_person(person)
|
|
|
|
|
self.load_family(family)
|
2003-02-14 07:50:59 +05:30
|
|
|
|
|
|
|
|
|
def clear(self):
|
|
|
|
|
self.spouse_model.clear()
|
|
|
|
|
self.child_model.clear()
|
|
|
|
|
self.sp_parents_model.clear()
|
|
|
|
|
self.ap_parents_model.clear()
|
2003-02-24 10:21:57 +05:30
|
|
|
|
self.ap_model.clear()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
def load_family(self,family=None):
|
2004-02-14 11:10:30 +05:30
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.person = self.parent.active_person
|
|
|
|
|
if not self.person:
|
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
|
|
|
|
|
2004-02-21 11:41:59 +05:30
|
|
|
|
bd = self.parent.db.find_event_from_id(self.person.get_birth_id())
|
|
|
|
|
dd = self.parent.db.find_event_from_id(self.person.get_death_id())
|
2003-04-30 09:03:20 +05:30
|
|
|
|
|
|
|
|
|
if bd and dd:
|
2003-05-24 09:10:58 +05:30
|
|
|
|
n = "%s\n\t%s %s\n\t%s %s " % (GrampsCfg.nameof(self.person),
|
2004-02-21 11:41:59 +05:30
|
|
|
|
_BORN,bd.get_date(),_DIED,dd.get_date())
|
2003-04-30 09:03:20 +05:30
|
|
|
|
elif bd:
|
2004-02-21 11:41:59 +05:30
|
|
|
|
n = "%s\n\t%s %s" % (GrampsCfg.nameof(self.person),_BORN,bd.get_date())
|
2003-04-30 09:03:20 +05:30
|
|
|
|
elif dd:
|
2004-02-21 11:41:59 +05:30
|
|
|
|
n = "%s\n\t%s %s" % (GrampsCfg.nameof(self.person),_DIED,dd.get_date())
|
2003-04-30 09:03:20 +05:30
|
|
|
|
else:
|
|
|
|
|
n = GrampsCfg.nameof(self.person)
|
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)
|
|
|
|
|
iter = self.ap_model.append()
|
|
|
|
|
self.ap_model.set(iter,0,n)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
self.selected_spouse = None
|
|
|
|
|
self.spouse_model.clear()
|
2002-11-21 10:11:40 +05:30
|
|
|
|
self.child_model.clear()
|
2003-01-02 10:01:52 +05:30
|
|
|
|
self.sp_parents_model.clear()
|
2004-02-14 11:10:30 +05:30
|
|
|
|
splist = self.person.get_family_id_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:
|
|
|
|
|
if not f:
|
|
|
|
|
continue
|
2004-02-14 11:10:30 +05:30
|
|
|
|
fm = self.parent.db.find_family_no_map(f)
|
|
|
|
|
|
|
|
|
|
if fm.get_father_id() == self.person.get_id():
|
|
|
|
|
sp_id = fm.get_mother_id()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
else:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
sp_id = fm.get_father_id()
|
|
|
|
|
sp = self.parent.db.find_person_from_id(sp_id)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
iter = self.spouse_model.append()
|
2004-02-14 11:10:30 +05:30
|
|
|
|
flist[f] = iter
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
if sp:
|
2004-02-19 10:35:43 +05:30
|
|
|
|
event = self.find_marriage(fm)
|
|
|
|
|
if event:
|
|
|
|
|
mdate = " - %s" % event.get_date()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
else:
|
|
|
|
|
mdate = ""
|
2003-01-19 11:55:20 +05:30
|
|
|
|
v = "%s\n\t%s%s" % (GrampsCfg.nameof(sp),
|
2004-02-14 11:10:30 +05:30
|
|
|
|
const.display_frel(fm.get_relationship()),
|
2003-08-07 09:24:10 +05:30
|
|
|
|
mdate)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
self.spouse_model.set(iter,0,v)
|
|
|
|
|
else:
|
2004-02-04 10:12:06 +05:30
|
|
|
|
self.spouse_model.set(iter,0,"%s\n" % _("<double click to add spouse>"))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
|
if family and family.get_id() in flist:
|
2003-06-03 08:24:56 +05:30
|
|
|
|
self.display_marriage(family)
|
2004-02-14 11:10:30 +05:30
|
|
|
|
iter = flist[family.get_id()]
|
2003-06-03 08:24:56 +05:30
|
|
|
|
self.spouse_selection.select_iter(iter)
|
|
|
|
|
elif len(flist) > 0:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
fid = splist[0]
|
|
|
|
|
fam = self.parent.db.find_family_from_id(fid)
|
|
|
|
|
self.display_marriage(fam)
|
|
|
|
|
iter = flist[fid]
|
2003-06-03 08:24:56 +05:30
|
|
|
|
self.spouse_selection.select_iter(iter)
|
|
|
|
|
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):
|
|
|
|
|
for event_id in family.get_event_list():
|
|
|
|
|
event = self.parent.db.find_event_from_id(event_id)
|
|
|
|
|
if event.get_name() == "Marriage":
|
|
|
|
|
return event
|
|
|
|
|
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-02-14 11:10:30 +05:30
|
|
|
|
list = person.get_parent_family_id_list()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
for (f,mrel,frel) in list:
|
2004-02-21 11:41:59 +05:30
|
|
|
|
fam = self.parent.db.find_family_from_id(f)
|
2004-02-14 11:10:30 +05:30
|
|
|
|
father_id = fam.get_father_id()
|
|
|
|
|
mother_id = fam.get_mother_id()
|
|
|
|
|
f = self.parent.db.find_person_from_id(father_id)
|
|
|
|
|
m = self.parent.db.find_person_from_id(mother_id)
|
|
|
|
|
father = self.nameof(_("Father"),f,frel)
|
|
|
|
|
mother = self.nameof(_("Mother"),m,mrel)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
iter = model.append()
|
|
|
|
|
if not sel:
|
|
|
|
|
sel = iter
|
|
|
|
|
v = "%s\n%s" % (father,mother)
|
|
|
|
|
model.set(iter,0,v)
|
|
|
|
|
if len(list) > 1:
|
|
|
|
|
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:
|
2003-01-19 11:55:20 +05:30
|
|
|
|
n = GrampsCfg.nameof(p)
|
2003-08-11 06:29:16 +05:30
|
|
|
|
return _("%s: %s\n\tRelationship: %s") % (l,n,_(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
|
|
|
|
|
2002-11-28 11:22:02 +05:30
|
|
|
|
def delete_family_from(self,person):
|
2004-02-14 11:10:30 +05:30
|
|
|
|
person.remove_family_id(self.family.get_id())
|
|
|
|
|
self.parent.db.delete_family(self.family.get_id())
|
|
|
|
|
flist = self.person.get_family_id_list()
|
2002-11-28 11:22:02 +05:30
|
|
|
|
if len(flist) > 0:
|
2004-01-08 21:09:33 +05:30
|
|
|
|
self.family = flist[0]
|
2002-11-28 11:22:02 +05:30
|
|
|
|
else:
|
|
|
|
|
self.family = None
|
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
|
def display_marriage(self,family):
|
|
|
|
|
self.child_model.clear()
|
2004-02-14 11:10:30 +05:30
|
|
|
|
|
2003-06-19 09:24:45 +05:30
|
|
|
|
self.family = family
|
2002-10-20 19:55:16 +05:30
|
|
|
|
if not family:
|
|
|
|
|
return
|
|
|
|
|
|
2004-02-15 08:03:44 +05:30
|
|
|
|
if family.get_father_id() == self.person.get_id():
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.selected_spouse = self.parent.db.find_person_from_id(family.get_mother_id())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
else:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.selected_spouse = self.parent.db.find_person_from_id(family.get_father_id())
|
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)
|
|
|
|
|
|
|
|
|
|
i = 0
|
|
|
|
|
fiter = None
|
2004-02-14 11:10:30 +05:30
|
|
|
|
child_list = list(family.get_child_id_list())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
self.child_map = {}
|
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
|
for child_id in child_list:
|
2002-10-20 19:55:16 +05:30
|
|
|
|
status = _("Unknown")
|
2004-02-14 11:10:30 +05:30
|
|
|
|
|
|
|
|
|
child = self.parent.db.find_person_from_id(child_id)
|
|
|
|
|
for fam in child.get_parent_family_id_list():
|
2004-02-15 08:03:44 +05:30
|
|
|
|
if fam[0] == family.get_id():
|
2004-02-14 11:10:30 +05:30
|
|
|
|
if self.person == family.get_father_id():
|
2002-10-20 19:55:16 +05:30
|
|
|
|
status = "%s/%s" % (_(fam[2]),_(fam[1]))
|
|
|
|
|
else:
|
|
|
|
|
status = "%s/%s" % (_(fam[1]),_(fam[2]))
|
|
|
|
|
|
|
|
|
|
iter = self.child_model.append()
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.child_map[iter] = child.get_id()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
if fiter == None:
|
|
|
|
|
fiter = self.child_model.get_path(iter)
|
2004-02-14 11:10:30 +05:30
|
|
|
|
val = self.parent.db.get_person_display(child.get_id())
|
2003-11-05 17:07:00 +05:30
|
|
|
|
i += 1
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.child_model.set(iter,0,i,1,val[0],2,val[1],3,val[2],
|
|
|
|
|
4,val[3],5,status,6,val[6])
|
2003-08-01 09:08:51 +05:30
|
|
|
|
|
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
|
|
|
|
|
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
|
|
|
|
|
(_("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
|
|
|
|
|
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),
|
|
|
|
|
]
|
|
|
|
|
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
|
|
|
|
|
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
|
|
|
|
|
(_("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
|
|
|
|
|
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),
|
|
|
|
|
]
|
|
|
|
|
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-02-14 11:10:30 +05:30
|
|
|
|
plist = self.person.get_parent_family_id_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:
|
|
|
|
|
model, iter = self.ap_selection.get_selected()
|
|
|
|
|
path = model.get_path(iter)
|
|
|
|
|
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-02-14 11:10:30 +05:30
|
|
|
|
plist = self.selected_spouse.get_parent_family_id_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:
|
|
|
|
|
model, iter = self.sp_selection.get_selected()
|
|
|
|
|
path = model.get_path(iter)
|
|
|
|
|
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-02-14 11:10:30 +05:30
|
|
|
|
if len(self.person.get_parent_family_id_list()) == 0:
|
2002-11-10 00:14:58 +05:30
|
|
|
|
return
|
2003-02-24 10:21:57 +05:30
|
|
|
|
n = GrampsCfg.nameof(self.person)
|
|
|
|
|
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-02-14 11:10:30 +05:30
|
|
|
|
if not self.selected_spouse or len(self.selected_spouse.get_parent_family_id_list()) == 0:
|
2002-11-10 00:14:58 +05:30
|
|
|
|
return
|
2003-03-08 11:29:20 +05:30
|
|
|
|
n = GrampsCfg.nameof(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"""
|
|
|
|
|
model, iter = self.child_selection.get_selected()
|
|
|
|
|
if iter:
|
|
|
|
|
id = self.child_model.get_value(iter,2)
|
2004-02-14 11:10:30 +05:30
|
|
|
|
self.parent.change_active_person(self.parent.db.get_person(id))
|
2002-10-25 10:22:51 +05:30
|
|
|
|
self.load_family()
|
2003-08-13 09:58:07 +05:30
|
|
|
|
else:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
list = self.family.get_child_id_list()
|
2003-08-13 09:58:07 +05:30
|
|
|
|
if len(list) == 1:
|
|
|
|
|
self.parent.change_active_person(list[0])
|
|
|
|
|
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-02-14 11:10:30 +05:30
|
|
|
|
plist = person.get_parent_family_id_list()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
if len(plist) == 0:
|
|
|
|
|
return
|
|
|
|
|
elif len(plist) == 1:
|
|
|
|
|
parents,mrel,frel = plist[0]
|
|
|
|
|
else:
|
|
|
|
|
model, iter = selection.get_selected()
|
|
|
|
|
if not iter:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
row = model.get_path(iter)
|
|
|
|
|
parents,mrel,frel = plist[row[0]]
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
ChooseParents.ModifyParents(self.parent.db,person,parents,
|
2003-11-19 08:44:14 +05:30
|
|
|
|
self.load_family,
|
|
|
|
|
self.parent.full_update,
|
|
|
|
|
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-02-21 12:10:44 +05:30
|
|
|
|
ChooseParents.ChooseParents(self.parent, self.parent.db,person,None,
|
2003-11-19 08:44:14 +05:30
|
|
|
|
self.load_family,
|
2003-11-24 02:23:20 +05:30
|
|
|
|
self.parent.full_update)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
except:
|
|
|
|
|
DisplayTrace.DisplayTrace()
|
|
|
|
|
|
|
|
|
|
def parent_deleter(self,person,selection):
|
|
|
|
|
if not person:
|
|
|
|
|
return
|
2004-02-14 11:10:30 +05:30
|
|
|
|
plist = person.get_parent_family_id_list()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
if len(plist) == 0:
|
|
|
|
|
return
|
|
|
|
|
if len(plist) == 1:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
person.clear_parent_family_id_list()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
else:
|
|
|
|
|
model, iter = selection.get_selected()
|
|
|
|
|
if not iter:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
row = model.get_path(iter)
|
2004-02-14 11:10:30 +05:30
|
|
|
|
fam = person.get_parent_family_id_list()[row[0]]
|
|
|
|
|
person.remove_parent_family_id(fam[0])
|
2002-11-10 00:14:58 +05:30
|
|
|
|
Utils.modified()
|
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-02-14 11:10:30 +05:30
|
|
|
|
row = len(self.family.get_child_id_list())
|
2003-01-13 09:29:10 +05:30
|
|
|
|
else:
|
|
|
|
|
row = path[0][0] -1
|
2003-01-10 10:51:32 +05:30
|
|
|
|
|
|
|
|
|
if sel_data and sel_data.data:
|
|
|
|
|
exec 'data = %s' % sel_data.data
|
|
|
|
|
exec 'mytype = "%s"' % data[0]
|
|
|
|
|
exec 'person = "%s"' % data[1]
|
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-02-14 11:10:30 +05:30
|
|
|
|
list = self.family.get_child_id_list()
|
2003-03-08 10:33:18 +05:30
|
|
|
|
|
2003-01-13 09:29:10 +05:30
|
|
|
|
obj = list[src]
|
|
|
|
|
list.remove(obj)
|
|
|
|
|
list.insert(row,obj)
|
2003-03-08 10:33:18 +05:30
|
|
|
|
|
2003-01-13 09:29:10 +05:30
|
|
|
|
if (birth_dates_in_order(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-02-14 11:10:30 +05:30
|
|
|
|
self.family.set_child_id_list(list)
|
2003-03-08 10:33:18 +05:30
|
|
|
|
self.display_marriage(self.family)
|
2003-01-13 09:29:10 +05:30
|
|
|
|
Utils.modified()
|
|
|
|
|
|
2003-01-10 10:51:32 +05:30
|
|
|
|
def drag_data_get(self,widget, context, sel_data, info, time):
|
2003-01-13 09:29:10 +05:30
|
|
|
|
store,iter = self.child_selection.get_selected()
|
|
|
|
|
if not iter:
|
|
|
|
|
return
|
|
|
|
|
id = self.child_model.get_value(iter,2)
|
2003-01-10 10:51:32 +05:30
|
|
|
|
bits_per = 8; # we're going to pass a string
|
2003-03-08 10:33:18 +05:30
|
|
|
|
data = str(('child',id));
|
2003-01-10 10:51:32 +05:30
|
|
|
|
sel_data.set(sel_data.target, bits_per, data)
|
|
|
|
|
|
2003-06-15 09:43:16 +05:30
|
|
|
|
def north_american(self,val):
|
2004-02-14 11:10:30 +05:30
|
|
|
|
if self.person.get_gender() == RelLib.Person.male:
|
|
|
|
|
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-02-14 11:10:30 +05:30
|
|
|
|
f = self.family.get_father_id()
|
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-02-14 11:10:30 +05:30
|
|
|
|
father = self.family.get_father_id()
|
|
|
|
|
mother = self.family.get_mother_id()
|
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 = ""
|
2004-02-14 11:10:30 +05:30
|
|
|
|
if self.person.get_gender() == RelLib.Person.male:
|
|
|
|
|
fname = self.person.get_primary_name().get_first_name()
|
2003-06-15 09:43:16 +05:30
|
|
|
|
elif self.family:
|
2004-02-14 11:10:30 +05:30
|
|
|
|
f = self.family.get_father_id()
|
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
|
|
|
|
|
2003-05-17 08:50:50 +05:30
|
|
|
|
def drag_begin(self, obj, context):
|
|
|
|
|
return
|
|
|
|
|
# model, iter = self.child_selection.get_selected()
|
|
|
|
|
# path = model.get_path(iter)
|
|
|
|
|
# pixmap = self.child_list.create_row_drag_icon(path)
|
|
|
|
|
# print "map",pixmap
|
|
|
|
|
|
|
|
|
|
# myimage = gtk.Image()
|
|
|
|
|
# print "set",pixmap
|
|
|
|
|
# myimage.set_from_pixmap(pixmap,None)
|
|
|
|
|
|
|
|
|
|
# print "image"
|
|
|
|
|
# pixbuf = myimage.get_pixbuf()
|
|
|
|
|
# print "buf", pixbuf
|
|
|
|
|
|
|
|
|
|
# context.set_icon_pixbuf(pixbuf,0,0)
|
|
|
|
|
# return
|
2003-01-13 09:29:10 +05:30
|
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
# birth_dates_in_order
|
|
|
|
|
#
|
|
|
|
|
# Check any *valid* birthdates in the list to insure that they are in
|
|
|
|
|
# numerically increasing order.
|
|
|
|
|
#
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
def birth_dates_in_order(list):
|
|
|
|
|
inorder = 1
|
|
|
|
|
prev_date = "00000000"
|
|
|
|
|
for i in range(len(list)):
|
|
|
|
|
child = list[i]
|
2004-02-14 11:10:30 +05:30
|
|
|
|
bday = child.get_birth().get_date_object()
|
2003-01-13 09:29:10 +05:30
|
|
|
|
child_date = sort.build_sort_date(bday)
|
|
|
|
|
if (child_date == "99999999"):
|
|
|
|
|
continue
|
|
|
|
|
if (prev_date <= child_date): # <= allows for twins
|
|
|
|
|
prev_date = child_date
|
|
|
|
|
else:
|
|
|
|
|
inorder = 0
|
|
|
|
|
return inorder
|