From d2dde84a4a5b2f981a528e2ed4e6d4586221ce2d Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Mon, 6 Oct 2003 22:49:16 +0000 Subject: [PATCH] * src/gramps_main.py (delete_person_response): Add remove_from_history call before deleting the person. * src/PeopleView.py (remove_from_history): Add function; (row_changed) Remove extra change_active_person() call. svn: r2201 --- gramps2/ChangeLog | 6 ++++++ gramps2/src/PeopleView.py | 17 ++++++++++++++++- gramps2/src/gramps_main.py | 13 +++++++------ 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 6c3517547..b045ebadc 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,9 @@ +2003-10-06 Alex Roitman + * src/gramps_main.py (delete_person_response): Add remove_from_history + call before deleting the person. + * src/PeopleView.py (remove_from_history): Add function; + (row_changed) Remove extra change_active_person() call. + 2003-10-06 Tim Waugh * src/Makefile.am: Ship PeopleView.py and PeopleStore.py. diff --git a/gramps2/src/PeopleView.py b/gramps2/src/PeopleView.py index 44f0f916e..2cd78a934 100644 --- a/gramps2/src/PeopleView.py +++ b/gramps2/src/PeopleView.py @@ -84,7 +84,6 @@ class PeopleView: def row_changed(self,obj): mlist = self.person_tree.get_selected_objects() if mlist and mlist[0]: - self.parent.change_active_person(self.parent.db.getPerson(mlist[0])) try: self.parent.change_active_person(self.parent.db.getPerson(mlist[0])) except: @@ -160,6 +159,22 @@ class PeopleView: if person == self.parent.active_person: self.parent.active_person = None + def remove_from_history(self,person,old_id=None): + pid = person.getId() + if old_id: + del_id = old_id + else: + del_id = pid + + hc = self.parent.history.count(del_id) + for c in range(hc): + self.parent.history.remove(del_id) + self.parent.hindex = self.parent.hindex - 1 + + mhc = self.parent.mhistory.count(del_id) + for c in range(mhc): + self.parent.mhistory.remove(del_id) + def apply_filter_clicked(self): invert_filter = self.parent.filter_inv.get_active() qualifer = self.parent.filter_text.get_text() diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 280b39af1..1fe9b106d 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -1507,21 +1507,22 @@ class Gramps: if family: family.removeChild(self.active_person) + self.people_view.remove_from_history(self.active_person) self.db.removePerson(self.active_person.getId()) self.people_view.remove_from_person_list(self.active_person) self.people_view.person_model.sort_column_changed() - try: - self.mhistory = self.mhistory[:-2] - self.change_active_person(self.mhistory[-2]) - except: - self.mhistory = [] - self.change_active_person(None) + + self.change_active_person(None) + self.redraw_histmenu() self.update_display(0) Utils.modified() def merge_update(self,p1,p2,old_id): self.people_view.remove_from_person_list(p1,old_id) self.people_view.remove_from_person_list(p2) + self.people_view.remove_from_history(p1,old_id) + self.people_view.remove_from_history(p2) + self.redraw_histmenu() self.people_view.redisplay_person_list(p1) self.update_display(0)