From 295b7d1a2b7dc036353eebb7fdff3e69417afdc5 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sat, 18 Jun 2005 03:55:12 +0000 Subject: [PATCH] * src/ChooseParents.py: optimize the add of a person to the models svn: r4842 --- gramps2/ChangeLog | 1 + gramps2/src/ChooseParents.py | 26 +++++++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index c261667a8..5edd52d07 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,5 @@ 2005-06-17 Don Allingham + * src/ChooseParents.py: optimize the add of a person to the models * src/EditPlace.py: check to make sure a duplicate title is not entered diff --git a/gramps2/src/ChooseParents.py b/gramps2/src/ChooseParents.py index e4c886fb9..5af473945 100644 --- a/gramps2/src/ChooseParents.py +++ b/gramps2/src/ChooseParents.py @@ -90,7 +90,7 @@ class ChooseParents: self.parent_selected = 0 self.renderer = gtk.CellRendererText() - db.connect('person-add', self.redraw) + db.connect('person-add', self.person_added) db.connect('person-update', self.redraw) db.connect('person-delete', self.redraw) db.connect('person-rebuild', self.redraw) @@ -283,6 +283,26 @@ class ChooseParents: """Display the relevant portion of GRAMPS manual""" gnome.help_display('gramps-manual','gramps-edit-quick') + def person_added(self,handle_list): + self.person_added_base(handle_list,self.father_model, self.father_filter) + self.person_added_base(handle_list,self.mother_model, self.mother_filter) + + def person_added_base(self,handle_list,model,data_filter): + for node in handle_list: + person = self.db.get_person_from_handle(node) + top = person.get_primary_name().get_group_name() + model.rebuild_data(data_filter) + if not model.is_visable(node): + continue + if (not model.sname_sub.has_key(top) or + len(model.sname_sub[top]) == 1): + path = model.on_get_path(top) + pnode = model.get_iter(path) + model.row_inserted(path,pnode) + path = model.on_get_path(node) + pnode = model.get_iter(path) + model.row_inserted(path,pnode) + def redraw(self,handle_list): self.redrawf() self.redrawm() @@ -522,7 +542,7 @@ class ChooseParents: self.father_list.scroll_to_cell(path,None,1,0.5,0) except KeyError: self.father_filter = self.all_males_filter - self.showallf_toggled(None) + self.redrawf() path = self.father_model.on_get_path(handle) top_path = self.father_model.on_get_path(name) self.father_list.expand_row(top_path,0) @@ -537,7 +557,7 @@ class ChooseParents: self.mother_list.scroll_to_cell(path,None,1,0.5,0) except: self.mother_filter = self.all_females_filter - self.showallm_toggled(None) + self.redrawm() path = self.mother_model.on_get_path(handle) top_path = self.mother_model.on_get_path(name) self.mother_list.expand_row(top_path,0)