2003-10-05 01:32:38 +05:30
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
|
|
|
# Copyright (C) 2000-2003 Donald N. Allingham
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
2003-10-20 08:17:03 +05:30
|
|
|
# $Id$
|
|
|
|
|
2005-04-06 18:58:51 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# standard python modules
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
import cPickle as pickle
|
2003-10-05 01:32:38 +05:30
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# internationalization
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
from gettext import gettext as _
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gtk
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import gtk
|
|
|
|
import gtk.glade
|
|
|
|
|
|
|
|
from gtk.gdk import ACTION_COPY, BUTTON1_MASK
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gtk
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2004-03-08 03:20:41 +05:30
|
|
|
import PeopleModel
|
2004-04-28 09:36:25 +05:30
|
|
|
import GenericFilter
|
2005-04-06 14:58:54 +05:30
|
|
|
from DdTargets import DdTargets
|
2004-03-22 10:11:35 +05:30
|
|
|
|
|
|
|
column_names = [
|
|
|
|
_('Name'),
|
|
|
|
_('ID') ,
|
|
|
|
_('Gender'),
|
|
|
|
_('Birth Date'),
|
|
|
|
_('Birth Place'),
|
|
|
|
_('Death Date'),
|
|
|
|
_('Death Place'),
|
2004-06-03 08:58:46 +05:30
|
|
|
_('Spouse'),
|
2004-08-24 09:18:15 +05:30
|
|
|
_('Last Change'),
|
2005-03-20 05:14:01 +05:30
|
|
|
_('Cause of Death'),
|
2004-03-22 10:11:35 +05:30
|
|
|
]
|
2003-10-05 01:32:38 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# PeopleView
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
class PeopleView:
|
|
|
|
|
|
|
|
def __init__(self,parent):
|
|
|
|
self.parent = parent
|
|
|
|
|
2005-04-04 06:41:50 +05:30
|
|
|
self.parent.connect('database-changed',self.change_db)
|
|
|
|
|
2004-04-28 09:36:25 +05:30
|
|
|
all = GenericFilter.GenericFilter()
|
|
|
|
all.set_name(_("Entire Database"))
|
|
|
|
all.add_rule(GenericFilter.Everyone([]))
|
|
|
|
|
2004-12-20 04:25:41 +05:30
|
|
|
self.DataFilter = None
|
2004-03-08 03:20:41 +05:30
|
|
|
self.pscroll = self.parent.gtop.get_widget("pscroll")
|
|
|
|
self.person_tree = self.parent.gtop.get_widget("person_tree")
|
2005-02-24 05:55:34 +05:30
|
|
|
self.person_tree.set_rules_hint(True)
|
2004-03-10 10:45:06 +05:30
|
|
|
self.renderer = gtk.CellRendererText()
|
2005-06-05 09:31:56 +05:30
|
|
|
self.inactive = False
|
2004-03-10 10:45:06 +05:30
|
|
|
|
|
|
|
self.columns = []
|
|
|
|
self.build_columns()
|
2004-04-28 09:36:25 +05:30
|
|
|
self.person_selection = self.person_tree.get_selection()
|
2005-02-28 00:26:31 +05:30
|
|
|
self.person_selection.set_mode(gtk.SELECTION_MULTIPLE)
|
2004-04-28 09:36:25 +05:30
|
|
|
self.person_selection.connect('changed',self.row_changed)
|
|
|
|
self.person_tree.connect('row_activated', self.alpha_event)
|
2004-06-03 08:58:46 +05:30
|
|
|
self.person_tree.connect('button-press-event',
|
|
|
|
self.on_plist_button_press)
|
2004-04-28 09:36:25 +05:30
|
|
|
|
2005-04-06 14:58:54 +05:30
|
|
|
#
|
|
|
|
# DnD support
|
|
|
|
#
|
|
|
|
self.person_tree.connect('drag_data_get', self.person_drag_data_get)
|
|
|
|
|
|
|
|
def person_drag_data_get(self, widget, context, sel_data, info, time):
|
|
|
|
selected_ids = self.get_selected_objects()
|
|
|
|
|
|
|
|
if len(selected_ids) == 1:
|
|
|
|
sel_data.set(sel_data.target, 8, selected_ids[0])
|
|
|
|
elif len(selected_ids) > 1:
|
2005-04-06 18:58:51 +05:30
|
|
|
sel_data.set(DdTargets.PERSON_LINK_LIST.drag_type,8,
|
|
|
|
pickle.dumps(selected_ids))
|
|
|
|
|
|
|
|
def set_dnd_target(self,obj):
|
|
|
|
selected_ids = self.get_selected_objects()
|
|
|
|
|
|
|
|
if len(selected_ids) == 1:
|
2005-04-23 21:23:30 +05:30
|
|
|
self.person_tree.drag_source_set(
|
|
|
|
BUTTON1_MASK, [DdTargets.PERSON_LINK.target()], ACTION_COPY)
|
2005-04-06 18:58:51 +05:30
|
|
|
elif len(selected_ids) > 1:
|
2005-04-23 21:23:30 +05:30
|
|
|
self.person_tree.drag_source_set(
|
|
|
|
BUTTON1_MASK, [DdTargets.PERSON_LINK_LIST.target()], ACTION_COPY)
|
2005-04-06 14:58:54 +05:30
|
|
|
|
2005-01-16 09:30:35 +05:30
|
|
|
def sort_clicked(self,obj):
|
|
|
|
for col in self.columns:
|
|
|
|
if obj == col:
|
|
|
|
if col.get_sort_indicator():
|
|
|
|
if col.get_sort_order() == gtk.SORT_ASCENDING:
|
|
|
|
col.set_sort_order(gtk.SORT_DESCENDING)
|
|
|
|
else:
|
|
|
|
col.set_sort_order(gtk.SORT_ASCENDING)
|
|
|
|
else:
|
|
|
|
col.set_sort_order(gtk.SORT_ASCENDING)
|
|
|
|
col.set_sort_indicator(True)
|
|
|
|
else:
|
|
|
|
col.set_sort_indicator(False)
|
|
|
|
|
2004-03-10 10:45:06 +05:30
|
|
|
def build_columns(self):
|
|
|
|
for column in self.columns:
|
|
|
|
self.person_tree.remove_column(column)
|
|
|
|
|
2004-10-24 06:39:12 +05:30
|
|
|
column = gtk.TreeViewColumn(_('Name'), self.renderer,text=0)
|
2005-02-24 05:55:34 +05:30
|
|
|
column.set_resizable(True)
|
2005-01-16 09:30:35 +05:30
|
|
|
#column.set_clickable(True)
|
|
|
|
#column.connect('clicked',self.sort_clicked)
|
2004-03-10 10:45:06 +05:30
|
|
|
column.set_min_width(225)
|
2004-04-30 08:31:51 +05:30
|
|
|
column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
|
2004-03-10 10:45:06 +05:30
|
|
|
self.person_tree.append_column(column)
|
|
|
|
self.columns = [column]
|
|
|
|
|
2004-03-22 10:11:35 +05:30
|
|
|
index = 1
|
2004-08-13 10:04:07 +05:30
|
|
|
for pair in self.parent.db.get_person_column_order():
|
2004-03-10 10:45:06 +05:30
|
|
|
if not pair[0]:
|
|
|
|
continue
|
2004-03-22 10:11:35 +05:30
|
|
|
name = column_names[pair[1]]
|
2005-04-05 20:32:59 +05:30
|
|
|
column = gtk.TreeViewColumn(name, self.renderer, markup=pair[1])
|
2005-02-24 05:55:34 +05:30
|
|
|
column.set_resizable(True)
|
2004-03-22 10:11:35 +05:30
|
|
|
column.set_min_width(60)
|
2004-04-30 08:31:51 +05:30
|
|
|
column.set_sizing(gtk.TREE_VIEW_COLUMN_GROW_ONLY)
|
2004-03-10 10:45:06 +05:30
|
|
|
self.columns.append(column)
|
|
|
|
self.person_tree.append_column(column)
|
2004-03-22 10:11:35 +05:30
|
|
|
index += 1
|
2004-03-10 10:45:06 +05:30
|
|
|
|
2004-03-08 03:20:41 +05:30
|
|
|
def build_tree(self):
|
2005-04-01 11:03:22 +05:30
|
|
|
self.person_model = PeopleModel.PeopleModel(self.parent.db,
|
2005-04-08 16:19:26 +05:30
|
|
|
self.DataFilter,
|
|
|
|
self.parent.filter_invert.get_active())
|
2005-01-16 09:30:35 +05:30
|
|
|
self.person_tree.set_model(self.person_model)
|
2004-10-01 08:08:23 +05:30
|
|
|
|
2004-03-08 03:20:41 +05:30
|
|
|
def get_selected_objects(self):
|
2005-06-05 09:31:56 +05:30
|
|
|
(mode,paths) = self.person_selection.get_selected_rows()
|
2004-03-08 03:20:41 +05:30
|
|
|
mlist = []
|
2005-06-05 09:31:56 +05:30
|
|
|
for path in paths:
|
|
|
|
node = self.person_model.on_get_iter(path)
|
|
|
|
mlist.append(self.person_model.on_get_value(node, PeopleModel.COLUMN_INT_ID))
|
2004-03-08 03:20:41 +05:30
|
|
|
return mlist
|
2003-10-05 01:32:38 +05:30
|
|
|
|
|
|
|
def row_changed(self,obj):
|
2004-06-03 08:58:46 +05:30
|
|
|
"""Called with a row is changed. Check the selected objects from
|
|
|
|
the person_tree to get the IDs of the selected objects. Set the
|
|
|
|
active person to the first person in the list. If no one is
|
|
|
|
selected, set the active person to None"""
|
2004-03-22 10:11:35 +05:30
|
|
|
|
|
|
|
selected_ids = self.get_selected_objects()
|
|
|
|
try:
|
2004-08-07 10:46:57 +05:30
|
|
|
person = self.parent.db.get_person_from_handle(selected_ids[0])
|
2004-03-22 10:11:35 +05:30
|
|
|
self.parent.change_active_person(person)
|
|
|
|
except:
|
|
|
|
self.parent.change_active_person(None)
|
2003-12-03 09:37:36 +05:30
|
|
|
|
2005-06-05 09:31:56 +05:30
|
|
|
if len(selected_ids) == 1:
|
|
|
|
self.person_tree.drag_source_set(BUTTON1_MASK,
|
|
|
|
[DdTargets.PERSON_LINK.target()],
|
|
|
|
ACTION_COPY)
|
|
|
|
elif len(selected_ids) > 1:
|
|
|
|
self.person_tree.drag_source_set(BUTTON1_MASK,
|
|
|
|
[DdTargets.PERSON_LINK_LIST.target()],
|
|
|
|
ACTION_COPY)
|
|
|
|
|
2003-10-05 01:32:38 +05:30
|
|
|
def change_db(self,db):
|
2004-03-10 10:45:06 +05:30
|
|
|
self.build_columns()
|
2005-04-06 15:10:41 +05:30
|
|
|
db.connect('person-add', self.person_added)
|
|
|
|
db.connect('person-update', self.person_updated)
|
|
|
|
db.connect('person-delete', self.person_removed)
|
|
|
|
db.connect('person-rebuild', self.redisplay_person_list)
|
2005-04-04 06:41:50 +05:30
|
|
|
self.apply_filter()
|
2005-06-05 09:31:56 +05:30
|
|
|
|
2004-06-29 09:21:49 +05:30
|
|
|
def remove_from_person_list(self,person):
|
2004-06-03 08:58:46 +05:30
|
|
|
"""Remove the selected person from the list. A person object is
|
|
|
|
expected, not an ID"""
|
2004-07-28 07:59:07 +05:30
|
|
|
path = self.person_model.on_get_path(person.get_handle())
|
2005-07-09 01:54:54 +05:30
|
|
|
#self.person_model.row_deleted(path)
|
|
|
|
(col,row) = path
|
|
|
|
if row > 0:
|
|
|
|
self.person_selection.select_path((col,row-1))
|
|
|
|
elif row == 0 and self.person_model.on_get_iter(path):
|
|
|
|
self.person_selection.select_path(path)
|
2003-10-05 01:32:38 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
def remove_from_history(self,person_handle,old_id=None):
|
2004-02-16 02:19:34 +05:30
|
|
|
"""Removes a person from the history list"""
|
2003-10-07 04:19:16 +05:30
|
|
|
if old_id:
|
|
|
|
del_id = old_id
|
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
del_id = person_handle
|
2003-10-07 04:19:16 +05:30
|
|
|
|
|
|
|
hc = self.parent.history.count(del_id)
|
|
|
|
for c in range(hc):
|
|
|
|
self.parent.history.remove(del_id)
|
2005-01-09 07:48:49 +05:30
|
|
|
self.parent.hindex -= 1
|
2003-10-07 04:19:16 +05:30
|
|
|
|
|
|
|
mhc = self.parent.mhistory.count(del_id)
|
|
|
|
for c in range(mhc):
|
|
|
|
self.parent.mhistory.remove(del_id)
|
|
|
|
|
2003-10-05 01:32:38 +05:30
|
|
|
def apply_filter_clicked(self):
|
2005-01-07 10:04:02 +05:30
|
|
|
index = self.parent.filter_list.get_active()
|
|
|
|
self.DataFilter = self.parent.filter_model.get_filter(index)
|
2004-04-30 08:31:51 +05:30
|
|
|
if self.DataFilter.need_param:
|
2004-05-14 04:15:51 +05:30
|
|
|
qual = unicode(self.parent.filter_text.get_text())
|
|
|
|
self.DataFilter.set_parameter(qual)
|
2004-04-28 09:36:25 +05:30
|
|
|
self.apply_filter()
|
2003-11-02 01:25:30 +05:30
|
|
|
self.goto_active_person()
|
2003-10-05 01:32:38 +05:30
|
|
|
|
2004-08-29 01:19:34 +05:30
|
|
|
def goto_active_person(self):
|
2005-06-05 09:31:56 +05:30
|
|
|
if not self.parent.active_person or self.inactive:
|
2003-10-05 01:32:38 +05:30
|
|
|
return
|
2005-06-05 09:31:56 +05:30
|
|
|
self.inactive = True
|
2004-03-08 03:20:41 +05:30
|
|
|
p = self.parent.active_person
|
2004-12-10 05:08:43 +05:30
|
|
|
try:
|
|
|
|
path = self.person_model.on_get_path(p.get_handle())
|
|
|
|
group_name = p.get_primary_name().get_group_name()
|
|
|
|
top_name = self.parent.db.get_name_group_mapping(group_name)
|
|
|
|
top_path = self.person_model.on_get_path(top_name)
|
|
|
|
self.person_tree.expand_row(top_path,0)
|
2005-04-23 21:23:30 +05:30
|
|
|
|
|
|
|
current = self.person_model.on_get_iter(path)
|
|
|
|
selected = self.person_selection.path_is_selected(path)
|
|
|
|
if current != p.get_handle() or not selected:
|
|
|
|
self.person_selection.unselect_all()
|
|
|
|
self.person_selection.select_path(path)
|
|
|
|
self.person_tree.scroll_to_cell(path,None,1,0.5,0)
|
2004-12-10 05:08:43 +05:30
|
|
|
except KeyError:
|
|
|
|
self.person_selection.unselect_all()
|
|
|
|
print "Person not currently available due to filter"
|
|
|
|
self.parent.active_person = p
|
2005-06-05 09:31:56 +05:30
|
|
|
self.inactive = False
|
2004-03-08 03:20:41 +05:30
|
|
|
|
2004-05-14 04:15:51 +05:30
|
|
|
def alpha_event(self,*obj):
|
2003-10-05 01:32:38 +05:30
|
|
|
self.parent.load_person(self.parent.active_person)
|
|
|
|
|
|
|
|
def apply_filter(self,current_model=None):
|
|
|
|
self.parent.status_text(_('Updating display...'))
|
2004-12-10 05:08:43 +05:30
|
|
|
self.build_tree()
|
2003-10-05 01:32:38 +05:30
|
|
|
self.parent.modify_statusbar()
|
|
|
|
|
|
|
|
def on_plist_button_press(self,obj,event):
|
|
|
|
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
2003-10-20 08:17:03 +05:30
|
|
|
self.build_people_context_menu(event)
|
2003-10-05 01:32:38 +05:30
|
|
|
|
2003-10-20 08:17:03 +05:30
|
|
|
def build_people_context_menu(self,event):
|
2003-10-05 01:32:38 +05:30
|
|
|
"""Builds the menu with navigation and
|
|
|
|
editing operations on the people's list"""
|
|
|
|
|
2003-10-06 07:12:55 +05:30
|
|
|
back_sensitivity = self.parent.hindex > 0
|
|
|
|
fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history)
|
2004-04-04 10:09:52 +05:30
|
|
|
mlist = self.get_selected_objects()
|
2003-10-05 01:32:38 +05:30
|
|
|
if mlist:
|
2005-06-05 09:31:56 +05:30
|
|
|
sel_sensitivity = True
|
2003-10-05 01:32:38 +05:30
|
|
|
else:
|
2005-06-05 09:31:56 +05:30
|
|
|
sel_sensitivity = False
|
2005-04-07 06:21:26 +05:30
|
|
|
merge_sensitivity = len(mlist) == 2
|
2003-10-05 01:32:38 +05:30
|
|
|
entries = [
|
2003-10-06 07:12:55 +05:30
|
|
|
(gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity),
|
|
|
|
(gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity),
|
2005-07-09 01:54:54 +05:30
|
|
|
(_("Home"),self.parent.on_home_clicked,1),
|
2003-10-06 07:12:55 +05:30
|
|
|
(_("Add Bookmark"),self.parent.on_add_bookmark_activate,sel_sensitivity),
|
2003-10-05 01:32:38 +05:30
|
|
|
(None,None,0),
|
2003-10-06 07:12:55 +05:30
|
|
|
(gtk.STOCK_ADD, self.parent.add_button_clicked,1),
|
|
|
|
(gtk.STOCK_REMOVE, self.parent.remove_button_clicked,sel_sensitivity),
|
|
|
|
(_("Edit"), self.parent.edit_button_clicked,sel_sensitivity),
|
2005-04-07 06:21:26 +05:30
|
|
|
#(None,None,0),
|
|
|
|
#(_("Compare and Merge"), self.parent.on_merge_activate,
|
|
|
|
# merge_sensitivity),
|
|
|
|
#(_("Fast Merge"), self.parent.on_fast_merge_activate,
|
|
|
|
# merge_sensitivity),
|
2003-10-05 01:32:38 +05:30
|
|
|
]
|
|
|
|
|
|
|
|
menu = gtk.Menu()
|
|
|
|
menu.set_title(_('People Menu'))
|
|
|
|
for stock_id,callback,sensitivity in entries:
|
|
|
|
item = gtk.ImageMenuItem(stock_id)
|
2003-12-05 05:41:22 +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-10-05 01:32:38 +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-10-05 01:32:38 +05:30
|
|
|
|
2005-04-01 11:03:22 +05:30
|
|
|
def redisplay_person_list(self):
|
|
|
|
self.build_tree()
|
|
|
|
|
|
|
|
def person_added(self,handle_list):
|
|
|
|
for node in handle_list:
|
|
|
|
person = self.parent.db.get_person_from_handle(node)
|
|
|
|
top = person.get_primary_name().get_group_name()
|
|
|
|
self.person_model.rebuild_data(self.DataFilter)
|
|
|
|
if not self.person_model.is_visable(node):
|
|
|
|
continue
|
|
|
|
if (not self.person_model.sname_sub.has_key(top) or
|
|
|
|
len(self.person_model.sname_sub[top]) == 1):
|
|
|
|
path = self.person_model.on_get_path(top)
|
|
|
|
pnode = self.person_model.get_iter(path)
|
|
|
|
self.person_model.row_inserted(path,pnode)
|
|
|
|
path = self.person_model.on_get_path(node)
|
2004-10-04 09:58:58 +05:30
|
|
|
pnode = self.person_model.get_iter(path)
|
|
|
|
self.person_model.row_inserted(path,pnode)
|
2005-03-31 10:00:44 +05:30
|
|
|
|
2005-04-01 11:03:22 +05:30
|
|
|
def person_removed(self,handle_list):
|
|
|
|
for node in handle_list:
|
|
|
|
person = self.parent.db.get_person_from_handle(node)
|
|
|
|
if not self.person_model.is_visable(node):
|
|
|
|
continue
|
|
|
|
top = person.get_primary_name().get_group_name()
|
|
|
|
mylist = self.person_model.sname_sub.get(top,[])
|
|
|
|
if mylist:
|
|
|
|
try:
|
|
|
|
path = self.person_model.on_get_path(node)
|
2005-03-31 10:00:44 +05:30
|
|
|
self.person_model.row_deleted(path)
|
2005-04-01 11:03:22 +05:30
|
|
|
if len(mylist) == 1:
|
|
|
|
path = self.person_model.on_get_path(top)
|
|
|
|
self.person_model.row_deleted(path)
|
|
|
|
except KeyError:
|
|
|
|
pass
|
2005-03-31 10:00:44 +05:30
|
|
|
self.person_model.rebuild_data(self.DataFilter,skip=node)
|
|
|
|
|
2005-04-01 11:03:22 +05:30
|
|
|
def person_updated(self,handle_list):
|
|
|
|
for node in handle_list:
|
|
|
|
person = self.parent.db.get_person_from_handle(node)
|
|
|
|
try:
|
|
|
|
oldpath = self.person_model.iter2path[node]
|
|
|
|
except:
|
|
|
|
return
|
|
|
|
pathval = self.person_model.on_get_path(node)
|
|
|
|
pnode = self.person_model.get_iter(pathval)
|
|
|
|
|
|
|
|
# calculate the new data
|
2005-06-05 09:31:56 +05:30
|
|
|
|
|
|
|
if person.primary_name.group_as:
|
|
|
|
surname = person.primary_name.group_as
|
|
|
|
else:
|
|
|
|
surname = self.parent.db.get_name_group_mapping(person.primary_name.surname)
|
|
|
|
|
|
|
|
|
|
|
|
if oldpath[0] == surname:
|
|
|
|
self.person_model.build_sub_entry(surname)
|
|
|
|
else:
|
|
|
|
self.person_model.calculate_data(self.DataFilter)
|
2005-04-01 11:03:22 +05:30
|
|
|
|
|
|
|
# find the path of the person in the new data build
|
|
|
|
newpath = self.person_model.temp_iter2path[node]
|
|
|
|
|
|
|
|
# if paths same, just issue row changed signal
|
2005-03-31 10:00:44 +05:30
|
|
|
|
2005-04-01 11:03:22 +05:30
|
|
|
if oldpath == newpath:
|
|
|
|
self.person_model.row_changed(pathval,pnode)
|
|
|
|
else:
|
|
|
|
# paths different, get the new surname list
|
|
|
|
|
|
|
|
mylist = self.person_model.temp_sname_sub.get(oldpath[0],[])
|
|
|
|
path = self.person_model.on_get_path(node)
|
|
|
|
|
|
|
|
# delete original
|
|
|
|
self.person_model.row_deleted(pathval)
|
|
|
|
|
|
|
|
# delete top node of original if necessar
|
|
|
|
if len(mylist)==0:
|
|
|
|
self.person_model.row_deleted(pathval[0])
|
|
|
|
|
|
|
|
# determine if we need to insert a new top node',
|
|
|
|
insert = not self.person_model.sname_sub.has_key(newpath[0])
|
|
|
|
|
|
|
|
# assign new data
|
|
|
|
self.person_model.assign_data()
|
|
|
|
|
|
|
|
# insert new row if needed
|
|
|
|
if insert:
|
|
|
|
path = self.person_model.on_get_path(newpath[0])
|
|
|
|
pnode = self.person_model.get_iter(path)
|
|
|
|
self.person_model.row_inserted(path,pnode)
|
|
|
|
|
|
|
|
# insert new person
|
|
|
|
path = self.person_model.on_get_path(node)
|
2005-03-31 10:00:44 +05:30
|
|
|
pnode = self.person_model.get_iter(path)
|
|
|
|
self.person_model.row_inserted(path,pnode)
|
2005-04-01 11:03:22 +05:30
|
|
|
|
2004-10-01 08:08:23 +05:30
|
|
|
self.goto_active_person()
|