From a4688d10adb26b96a6875946c05e03ae07306806 Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Wed, 18 May 2005 15:37:05 +0000 Subject: [PATCH] * src/GrampsInMemDB.py: Emit the *-delete signals correctly. * src/GrampsDbBase.py: Emission of the *-update/*-add signals should not depend on the existance of a transaction. svn: r4616 --- gramps2/ChangeLog | 5 +++++ gramps2/src/GrampsDbBase.py | 23 +++++++++++------------ gramps2/src/GrampsInMemDB.py | 5 +++-- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index b1d738424..54d36e2aa 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2005-05-18 Martin Hawlisch + * src/GrampsInMemDB.py: Emit the *-delete signals correctly. + * src/GrampsDbBase.py: Emission of the *-update/*-add signals should not depend + on the existance of a transaction. + 2005-05-18 Don Allingham * src/plugins/FilterEditor.py: sort entries in Add Rule dialog diff --git a/gramps2/src/GrampsDbBase.py b/gramps2/src/GrampsDbBase.py index 293e6cf44..b6a025aa4 100644 --- a/gramps2/src/GrampsDbBase.py +++ b/gramps2/src/GrampsDbBase.py @@ -272,12 +272,11 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback): else: person.change = int(time.time()) handle = str(person.get_handle()) + old_data = self.person_map.get(handle) if transaction != None: - old_data = self.person_map.get(handle) transaction.add(PERSON_KEY,handle,old_data) - self.person_map[handle] = person.serialize() - if transaction and old_data: + if old_data: self.emit('person-update',([handle],)) else: self.emit('person-add',([handle],)) @@ -294,11 +293,11 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback): else: obj.change = int(time.time()) handle = str(obj.get_handle()) + old_data = self.media_map.get(handle) if transaction != None: - old_data = self.media_map.get(handle) transaction.add(MEDIA_KEY,handle,old_data) self.media_map[handle] = obj.serialize() - if transaction and old_data: + if old_data: self.emit('media-update',([handle],)) else: self.emit('media-add',([handle],)) @@ -315,11 +314,11 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback): else: source.change = int(time.time()) handle = str(source.get_handle()) + old_data = self.source_map.get(handle) if transaction != None: - old_data = self.source_map.get(handle) transaction.add(SOURCE_KEY,handle,old_data) self.source_map[handle] = source.serialize() - if transaction and old_data: + if old_data: self.emit('source-update',([handle],)) else: self.emit('source-add',([handle],)) @@ -336,11 +335,11 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback): else: place.change = int(time.time()) handle = str(place.get_handle()) + old_data = self.place_map.get(handle) if transaction != None: - old_data = self.place_map.get(handle) transaction.add(PLACE_KEY,handle,old_data) self.place_map[handle] = place.serialize() - if transaction and old_data: + if old_data: self.emit('place-update',([handle],)) else: self.emit('place-add',([handle],)) @@ -357,8 +356,8 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback): else: event.change = int(time.time()) handle = str(event.get_handle()) + old_data = self.event_map.get(handle) if transaction != None: - old_data = self.event_map.get(handle) transaction.add(EVENT_KEY,handle,old_data) self.event_map[handle] = event.serialize() @@ -374,12 +373,12 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback): else: family.change = int(time.time()) handle = str(family.get_handle()) + old_data = self.family_map.get(handle) if transaction != None: - old_data = self.family_map.get(handle) transaction.add(FAMILY_KEY,handle,old_data) self.family_map[handle] = family.serialize() - if transaction and old_data: + if old_data: self.emit('family-update',([handle],)) else: self.emit('family-add',([handle],)) diff --git a/gramps2/src/GrampsInMemDB.py b/gramps2/src/GrampsInMemDB.py index 409e955c4..9b12be3ac 100644 --- a/gramps2/src/GrampsInMemDB.py +++ b/gramps2/src/GrampsInMemDB.py @@ -164,7 +164,7 @@ class GrampsInMemDB(GrampsDbBase): if transaction != None: old_data = self.place_map.get(str(handle)) transaction.add(PLACE_KEY,handle,old_data) - self.emit('person-delete',([handle],)) + self.emit('place-delete',([handle],)) del self.pid_trans[place.get_gramps_id()] del self.place_map[str(handle)] @@ -175,6 +175,7 @@ class GrampsInMemDB(GrampsDbBase): if transaction != None: old_data = self.media_map.get(str(handle)) transaction.add(MEDIA_KEY,handle,old_data) + self.emit('media-delete',([handle],)) del self.oid_trans[obj.get_gramps_id()] del self.media_map[str(handle)] @@ -185,7 +186,7 @@ class GrampsInMemDB(GrampsDbBase): if transaction != None: old_data = self.family_map.get(str(handle)) transaction.add(FAMILY_KEY,handle,old_data) - self.emit('family-delete',([str(handle),])) + self.emit('family-delete',([handle],)) del self.fid_trans[family.get_gramps_id()] del self.family_map[str(handle)]