From 57359f125d8d8be10c1b41b2f10211607bed981d Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 9 Feb 2006 05:10:20 +0000 Subject: [PATCH] * src/PeopleModel.py: clear data cache svn: r5907 --- ChangeLog | 1 + src/PeopleModel.py | 3 +++ src/PersonView.py | 38 +++++++++++++++++++------------------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index ac1aeefb9..7b8c9a5a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ 2006-02-08 Don Allingham + * src/PeopleModel.py: clear data cache * src/EditFamily.py: set focus on surname * src/EditPerson.py: hook up add child * src/PersonView.py: fix delete person dispay diff --git a/src/PeopleModel.py b/src/PeopleModel.py index 895c60e5f..aa3bf71f3 100644 --- a/src/PeopleModel.py +++ b/src/PeopleModel.py @@ -170,6 +170,9 @@ class PeopleModel(gtk.GenericTreeModel): self.temp_top_path2iter = locale_sort(self.temp_sname_sub.keys()) for name in self.temp_top_path2iter: self.build_sub_entry(name) + + def clear_cache(self): + self.prev_handle = None def build_sub_entry(self,name): self.prev_handle = None diff --git a/src/PersonView.py b/src/PersonView.py index fa7b92f32..ee0584bb5 100644 --- a/src/PersonView.py +++ b/src/PersonView.py @@ -484,6 +484,7 @@ class PersonView(PageView.PersonNavView): pickle.dumps(selected_ids)) def person_added(self,handle_list): + self.model.clear_cache() for node in handle_list: person = self.dbstate.db.get_person_from_handle(node) top = person.get_primary_name().get_group_name() @@ -500,25 +501,26 @@ class PersonView(PageView.PersonNavView): self.model.row_inserted(path,pnode) def person_removed(self,handle_list): - for node in handle_list: - person = self.dbstate.db.get_person_from_handle(node) - top = person.get_primary_name().get_group_name() - mylist = self.model.sname_sub.get(top,[]) - self.model.calculate_data() - if mylist: - try: - path = self.model.on_get_path(node) - self.model.row_deleted(path) - print "delete",path - if len(mylist) == 1: - path = self.model.on_get_path(top) - print "delete",path - self.model.row_deleted(path) - except KeyError: - pass - self.model.assign_data() + self.model.clear_cache() + self.build_tree() +# for node in handle_list: +# person = self.dbstate.db.get_person_from_handle(node) +# top = person.get_primary_name().get_group_name() +# mylist = self.model.sname_sub.get(top,[]) +# self.model.calculate_data() +# if mylist: +# try: +# path = self.model.on_get_path(node) +# self.model.row_deleted(path) +# if len(mylist) == 1: +# path = self.model.on_get_path(top) +# self.model.row_deleted(path) +# except KeyError: +# pass +# self.model.assign_data() def person_updated(self,handle_list): + self.model.clear_cache() for node in handle_list: person = self.dbstate.db.get_person_from_handle(node) try: @@ -577,10 +579,8 @@ class PersonView(PageView.PersonNavView): path = self.model.on_get_path(node) pnode = self.model.get_iter(path) self.model.row_inserted(path,pnode) - self.goto_active_person() - def get_selected_objects(self): (mode,paths) = self.selection.get_selected_rows() mlist = []