* src/PeopleModel.py: clear data cache

svn: r5907
This commit is contained in:
Don Allingham 2006-02-09 05:10:20 +00:00
parent 3b92398870
commit 57359f125d
3 changed files with 23 additions and 19 deletions

View File

@ -1,4 +1,5 @@
2006-02-08 Don Allingham <don@gramps-project.org> 2006-02-08 Don Allingham <don@gramps-project.org>
* src/PeopleModel.py: clear data cache
* src/EditFamily.py: set focus on surname * src/EditFamily.py: set focus on surname
* src/EditPerson.py: hook up add child * src/EditPerson.py: hook up add child
* src/PersonView.py: fix delete person dispay * src/PersonView.py: fix delete person dispay

View File

@ -171,6 +171,9 @@ class PeopleModel(gtk.GenericTreeModel):
for name in self.temp_top_path2iter: for name in self.temp_top_path2iter:
self.build_sub_entry(name) self.build_sub_entry(name)
def clear_cache(self):
self.prev_handle = None
def build_sub_entry(self,name): def build_sub_entry(self,name):
self.prev_handle = None self.prev_handle = None
slist = map(lambda x: (self.sortnames[x],x),self.temp_sname_sub[name]) slist = map(lambda x: (self.sortnames[x],x),self.temp_sname_sub[name])

View File

@ -484,6 +484,7 @@ class PersonView(PageView.PersonNavView):
pickle.dumps(selected_ids)) pickle.dumps(selected_ids))
def person_added(self,handle_list): def person_added(self,handle_list):
self.model.clear_cache()
for node in handle_list: for node in handle_list:
person = self.dbstate.db.get_person_from_handle(node) person = self.dbstate.db.get_person_from_handle(node)
top = person.get_primary_name().get_group_name() top = person.get_primary_name().get_group_name()
@ -500,25 +501,26 @@ class PersonView(PageView.PersonNavView):
self.model.row_inserted(path,pnode) self.model.row_inserted(path,pnode)
def person_removed(self,handle_list): def person_removed(self,handle_list):
for node in handle_list: self.model.clear_cache()
person = self.dbstate.db.get_person_from_handle(node) self.build_tree()
top = person.get_primary_name().get_group_name() # for node in handle_list:
mylist = self.model.sname_sub.get(top,[]) # person = self.dbstate.db.get_person_from_handle(node)
self.model.calculate_data() # top = person.get_primary_name().get_group_name()
if mylist: # mylist = self.model.sname_sub.get(top,[])
try: # self.model.calculate_data()
path = self.model.on_get_path(node) # if mylist:
self.model.row_deleted(path) # try:
print "delete",path # path = self.model.on_get_path(node)
if len(mylist) == 1: # self.model.row_deleted(path)
path = self.model.on_get_path(top) # if len(mylist) == 1:
print "delete",path # path = self.model.on_get_path(top)
self.model.row_deleted(path) # self.model.row_deleted(path)
except KeyError: # except KeyError:
pass # pass
self.model.assign_data() # self.model.assign_data()
def person_updated(self,handle_list): def person_updated(self,handle_list):
self.model.clear_cache()
for node in handle_list: for node in handle_list:
person = self.dbstate.db.get_person_from_handle(node) person = self.dbstate.db.get_person_from_handle(node)
try: try:
@ -577,10 +579,8 @@ class PersonView(PageView.PersonNavView):
path = self.model.on_get_path(node) path = self.model.on_get_path(node)
pnode = self.model.get_iter(path) pnode = self.model.get_iter(path)
self.model.row_inserted(path,pnode) self.model.row_inserted(path,pnode)
self.goto_active_person() self.goto_active_person()
def get_selected_objects(self): def get_selected_objects(self):
(mode,paths) = self.selection.get_selected_rows() (mode,paths) = self.selection.get_selected_rows()
mlist = [] mlist = []