* 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
This commit is contained in:
Alex Roitman 2005-02-16 13:49:32 +00:00
parent 064311fc73
commit 6c22a6ed62
5 changed files with 57 additions and 14 deletions

View File

@ -1,3 +1,12 @@
2005-02-16 Alex Roitman <shura@alex.neuro.umn.edu>
* 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 <dallingham@users.sourceforge.net> 2005-02-15 Don Allingham <dallingham@users.sourceforge.net>
* src/AddMedia.py: handle "note only" media object * src/AddMedia.py: handle "note only" media object
* src/DisplayModels.py: handle media type of None * src/DisplayModels.py: handle media type of None

View File

@ -1,7 +1,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # 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 # 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 # it under the terms of the GNU General Public License as published by
@ -20,6 +20,13 @@
# $Id$ # $Id$
#-------------------------------------------------------------------------
#
# Python modules
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# GTK/Gnome modules # GTK/Gnome modules
@ -40,8 +47,6 @@ import ListModel
import RelLib import RelLib
import NameDisplay import NameDisplay
from gettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Constants # Constants
@ -483,7 +488,7 @@ class DelSrcQuery:
self.db.commit_family(p,trans) self.db.commit_family(p,trans)
for p_id in self.db.get_media_object_handles(): 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): if self.delete_source(p):
self.db.commit_media_object(p,trans) self.db.commit_media_object(p,trans)
@ -494,4 +499,4 @@ class DelSrcQuery:
self.db.remove_source(self.source.get_handle(),trans) self.db.remove_source(self.source.get_handle(),trans)
self.db.transaction_commit(trans,_("Delete Source (%s)") % self.source.get_title()) self.db.transaction_commit(trans,_("Delete Source (%s)") % self.source.get_title())
self.update() self.update(self.source.get_handle())

View File

@ -2,7 +2,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # 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 # 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 # it under the terms of the GNU General Public License as published by
@ -20,6 +20,13 @@
# $Id$ # $Id$
#-------------------------------------------------------------------------
#
# Python modules
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# GTK/Gnome modules # GTK/Gnome modules
@ -48,9 +55,13 @@ import DateHandler
import DisplayModels import DisplayModels
import NameDisplay import NameDisplay
from gettext import gettext as _
from QuestionDialog import QuestionDialog,WarningDialog from QuestionDialog import QuestionDialog,WarningDialog
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
_BORN = _('b.') _BORN = _('b.')
_DIED = _('d.') _DIED = _('d.')
@ -843,7 +854,7 @@ class FamilyView:
for handle in [father_id, mother_id]: for handle in [father_id, mother_id]:
if handle: 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()) p.remove_family_handle(self.family.get_handle())
self.parent.db.commit_person(p,trans) self.parent.db.commit_person(p,trans)
@ -1327,12 +1338,12 @@ class FamilyView:
father_handle = fam.get_father_handle() father_handle = fam.get_father_handle()
mother_handle = fam.get_mother_handle() mother_handle = fam.get_mother_handle()
if father_handle == None and 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) mother.remove_family_handle(fam)
self.parent.db.commit_person(mother,trans) self.parent.db.commit_person(mother,trans)
self.parent.db.remove_family(fam,trans) self.parent.db.remove_family(fam,trans)
elif mother_handle == None and father_handle: 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) father.remove_family_handle(fam,trans)
self.parent.db.commit_person(father,trans) self.parent.db.commit_person(father,trans)
self.parent.db.remove_family(fam,trans) self.parent.db.remove_family(fam,trans)

View File

@ -135,21 +135,39 @@ class GrampsInMemDB(GrampsDbBase):
if transaction != None: if transaction != None:
old_data = self.person_map.get(handle) old_data = self.person_map.get(handle)
transaction.add(PERSON_KEY,handle,old_data) 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] del self.person_map[handle]
def remove_source(self,handle,transaction): def remove_source(self,handle,transaction):
source = self.get_source_from_handle(handle)
if transaction != None: if transaction != None:
old_data = self.source_map.get(str(handle)) old_data = self.source_map.get(str(handle))
transaction.add(SOURCE_KEY,handle,old_data) 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)] 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): def remove_family(self,handle,transaction):
family = self.get_family_from_handle(handle)
if transaction != None: if transaction != None:
old_data = self.family_map.get(str(handle)) old_data = self.family_map.get(str(handle))
transaction.add(FAMILY_KEY,handle,old_data) 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)] del self.family_map[str(handle)]
def remove_event(self,handle,transaction): def remove_event(self,handle,transaction):

View File

@ -1309,7 +1309,7 @@ class DeleteMediaQuery:
self.db.remove_object(self.media.get_handle(),trans) self.db.remove_object(self.media.get_handle(),trans)
self.db.transaction_commit(trans,_("Remove Media Object")) self.db.transaction_commit(trans,_("Remove Media Object"))
if self.update: if self.update:
self.update() self.update(self.media.get_handle())
def build_dropdown(entry,strings): def build_dropdown(entry,strings):
store = gtk.ListStore(str) store = gtk.ListStore(str)