From 6c22a6ed62fbed5d089a42846e9356432731091b Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Wed, 16 Feb 2005 13:49:32 +0000 Subject: [PATCH] * src/EditSource.py (DelSrcQuery.query_response): Typos. * src/ImageSelect.py (DeleteMediaQuery.query_response): Typo. * src/GrampsInMemDB.py (remove_place,remove_object): Add methods; (remove_person,remove_source,remove_family): Correctly remove from id_trans table. * src/FamilyView.py (parent_deleter,really_remove_spouse): Use get_ instead of find_ functions. svn: r4036 --- gramps2/ChangeLog | 9 +++++++++ gramps2/src/EditSource.py | 15 ++++++++++----- gramps2/src/FamilyView.py | 21 ++++++++++++++++----- gramps2/src/GrampsInMemDB.py | 24 +++++++++++++++++++++--- gramps2/src/ImageSelect.py | 2 +- 5 files changed, 57 insertions(+), 14 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 934b94432..e2d99681d 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,12 @@ +2005-02-16 Alex Roitman + * src/EditSource.py (DelSrcQuery.query_response): Typos. + * src/ImageSelect.py (DeleteMediaQuery.query_response): Typo. + * src/GrampsInMemDB.py (remove_place,remove_object): Add methods; + (remove_person,remove_source,remove_family): Correctly remove from + id_trans table. + * src/FamilyView.py (parent_deleter,really_remove_spouse): + Use get_ instead of find_ functions. + 2005-02-15 Don Allingham * src/AddMedia.py: handle "note only" media object * src/DisplayModels.py: handle media type of None diff --git a/gramps2/src/EditSource.py b/gramps2/src/EditSource.py index 420faa740..ed40e2a61 100644 --- a/gramps2/src/EditSource.py +++ b/gramps2/src/EditSource.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2004 Donald N. Allingham +# Copyright (C) 2000-2005 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 @@ -20,6 +20,13 @@ # $Id$ +#------------------------------------------------------------------------- +# +# Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + #------------------------------------------------------------------------- # # GTK/Gnome modules @@ -40,8 +47,6 @@ import ListModel import RelLib import NameDisplay -from gettext import gettext as _ - #------------------------------------------------------------------------- # # Constants @@ -483,7 +488,7 @@ class DelSrcQuery: self.db.commit_family(p,trans) for p_id in self.db.get_media_object_handles(): - p = self.db.get_object_from_handle(p_id,trans) + p = self.db.get_object_from_handle(p_id) if self.delete_source(p): self.db.commit_media_object(p,trans) @@ -494,4 +499,4 @@ class DelSrcQuery: self.db.remove_source(self.source.get_handle(),trans) self.db.transaction_commit(trans,_("Delete Source (%s)") % self.source.get_title()) - self.update() + self.update(self.source.get_handle()) diff --git a/gramps2/src/FamilyView.py b/gramps2/src/FamilyView.py index a8df2a2a2..d2304d8fa 100644 --- a/gramps2/src/FamilyView.py +++ b/gramps2/src/FamilyView.py @@ -2,7 +2,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2004 Donald N. Allingham +# Copyright (C) 2000-2005 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 @@ -20,6 +20,13 @@ # $Id$ +#------------------------------------------------------------------------- +# +# Python modules +# +#------------------------------------------------------------------------- +from gettext import gettext as _ + #------------------------------------------------------------------------- # # GTK/Gnome modules @@ -48,9 +55,13 @@ import DateHandler import DisplayModels import NameDisplay -from gettext import gettext as _ from QuestionDialog import QuestionDialog,WarningDialog +#------------------------------------------------------------------------- +# +# Constants +# +#------------------------------------------------------------------------- _BORN = _('b.') _DIED = _('d.') @@ -843,7 +854,7 @@ class FamilyView: for handle in [father_id, mother_id]: if handle: - p = self.parent.db.find_person_from_handle(handle) + p = self.parent.db.get_person_from_handle(handle) p.remove_family_handle(self.family.get_handle()) self.parent.db.commit_person(p,trans) @@ -1327,12 +1338,12 @@ class FamilyView: father_handle = fam.get_father_handle() mother_handle = fam.get_mother_handle() if father_handle == None and mother_handle: - mother = self.parent.db.find_person_from_handle(mother_handle) + mother = self.parent.db.get_person_from_handle(mother_handle) mother.remove_family_handle(fam) self.parent.db.commit_person(mother,trans) self.parent.db.remove_family(fam,trans) elif mother_handle == None and father_handle: - father = self.parent.db.find_person_from_handle(father_handle) + father = self.parent.db.get_person_from_handle(father_handle) father.remove_family_handle(fam,trans) self.parent.db.commit_person(father,trans) self.parent.db.remove_family(fam,trans) diff --git a/gramps2/src/GrampsInMemDB.py b/gramps2/src/GrampsInMemDB.py index c66a70371..cb0878da8 100644 --- a/gramps2/src/GrampsInMemDB.py +++ b/gramps2/src/GrampsInMemDB.py @@ -135,21 +135,39 @@ class GrampsInMemDB(GrampsDbBase): if transaction != None: old_data = self.person_map.get(handle) transaction.add(PERSON_KEY,handle,old_data) - del self.id_trans[self.person_map[handle].get_gramps_id()] + del self.id_trans[person.get_gramps_id()] del self.person_map[handle] def remove_source(self,handle,transaction): + source = self.get_source_from_handle(handle) if transaction != None: old_data = self.source_map.get(str(handle)) transaction.add(SOURCE_KEY,handle,old_data) - del self.sid_trans[self.source_map[handle].get_gramps_id()] + del self.sid_trans[source.get_gramps_id()] del self.source_map[str(handle)] + def remove_place(self,handle,transaction): + place = self.get_place_from_handle(handle) + if transaction != None: + old_data = self.place_map.get(str(handle)) + transaction.add(PLACE_KEY,handle,old_data) + del self.pid_trans[place.get_gramps_id()] + del self.place_map[str(handle)] + + def remove_object(self,handle,transaction): + obj = self.get_object_from_handle(handle) + if transaction != None: + old_data = self.media_map.get(str(handle)) + transaction.add(MEDIA_KEY,handle,old_data) + del self.oid_trans[obj.get_gramps_id()] + del self.media_map[str(handle)] + def remove_family(self,handle,transaction): + family = self.get_family_from_handle(handle) if transaction != None: old_data = self.family_map.get(str(handle)) transaction.add(FAMILY_KEY,handle,old_data) - del self.fid_trans[self.family_map[handle].get_gramps_id()] + del self.fid_trans[family.get_gramps_id()] del self.family_map[str(handle)] def remove_event(self,handle,transaction): diff --git a/gramps2/src/ImageSelect.py b/gramps2/src/ImageSelect.py index afde5d133..0df5c76eb 100644 --- a/gramps2/src/ImageSelect.py +++ b/gramps2/src/ImageSelect.py @@ -1309,7 +1309,7 @@ class DeleteMediaQuery: self.db.remove_object(self.media.get_handle(),trans) self.db.transaction_commit(trans,_("Remove Media Object")) if self.update: - self.update() + self.update(self.media.get_handle()) def build_dropdown(entry,strings): store = gtk.ListStore(str)