* 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
This commit is contained in:
Martin Hawlisch 2005-05-18 15:37:05 +00:00
parent 054c446aed
commit a4688d10ad
3 changed files with 19 additions and 14 deletions

View File

@ -1,3 +1,8 @@
2005-05-18 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* 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 <don@gramps-project.org> 2005-05-18 Don Allingham <don@gramps-project.org>
* src/plugins/FilterEditor.py: sort entries in Add Rule dialog * src/plugins/FilterEditor.py: sort entries in Add Rule dialog

View File

@ -272,12 +272,11 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
else: else:
person.change = int(time.time()) person.change = int(time.time())
handle = str(person.get_handle()) handle = str(person.get_handle())
old_data = self.person_map.get(handle)
if transaction != None: if transaction != None:
old_data = self.person_map.get(handle)
transaction.add(PERSON_KEY,handle,old_data) transaction.add(PERSON_KEY,handle,old_data)
self.person_map[handle] = person.serialize() self.person_map[handle] = person.serialize()
if transaction and old_data: if old_data:
self.emit('person-update',([handle],)) self.emit('person-update',([handle],))
else: else:
self.emit('person-add',([handle],)) self.emit('person-add',([handle],))
@ -294,11 +293,11 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
else: else:
obj.change = int(time.time()) obj.change = int(time.time())
handle = str(obj.get_handle()) handle = str(obj.get_handle())
old_data = self.media_map.get(handle)
if transaction != None: if transaction != None:
old_data = self.media_map.get(handle)
transaction.add(MEDIA_KEY,handle,old_data) transaction.add(MEDIA_KEY,handle,old_data)
self.media_map[handle] = obj.serialize() self.media_map[handle] = obj.serialize()
if transaction and old_data: if old_data:
self.emit('media-update',([handle],)) self.emit('media-update',([handle],))
else: else:
self.emit('media-add',([handle],)) self.emit('media-add',([handle],))
@ -315,11 +314,11 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
else: else:
source.change = int(time.time()) source.change = int(time.time())
handle = str(source.get_handle()) handle = str(source.get_handle())
old_data = self.source_map.get(handle)
if transaction != None: if transaction != None:
old_data = self.source_map.get(handle)
transaction.add(SOURCE_KEY,handle,old_data) transaction.add(SOURCE_KEY,handle,old_data)
self.source_map[handle] = source.serialize() self.source_map[handle] = source.serialize()
if transaction and old_data: if old_data:
self.emit('source-update',([handle],)) self.emit('source-update',([handle],))
else: else:
self.emit('source-add',([handle],)) self.emit('source-add',([handle],))
@ -336,11 +335,11 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
else: else:
place.change = int(time.time()) place.change = int(time.time())
handle = str(place.get_handle()) handle = str(place.get_handle())
old_data = self.place_map.get(handle)
if transaction != None: if transaction != None:
old_data = self.place_map.get(handle)
transaction.add(PLACE_KEY,handle,old_data) transaction.add(PLACE_KEY,handle,old_data)
self.place_map[handle] = place.serialize() self.place_map[handle] = place.serialize()
if transaction and old_data: if old_data:
self.emit('place-update',([handle],)) self.emit('place-update',([handle],))
else: else:
self.emit('place-add',([handle],)) self.emit('place-add',([handle],))
@ -357,8 +356,8 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
else: else:
event.change = int(time.time()) event.change = int(time.time())
handle = str(event.get_handle()) handle = str(event.get_handle())
old_data = self.event_map.get(handle)
if transaction != None: if transaction != None:
old_data = self.event_map.get(handle)
transaction.add(EVENT_KEY,handle,old_data) transaction.add(EVENT_KEY,handle,old_data)
self.event_map[handle] = event.serialize() self.event_map[handle] = event.serialize()
@ -374,12 +373,12 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
else: else:
family.change = int(time.time()) family.change = int(time.time())
handle = str(family.get_handle()) handle = str(family.get_handle())
old_data = self.family_map.get(handle)
if transaction != None: if transaction != None:
old_data = self.family_map.get(handle)
transaction.add(FAMILY_KEY,handle,old_data) transaction.add(FAMILY_KEY,handle,old_data)
self.family_map[handle] = family.serialize() self.family_map[handle] = family.serialize()
if transaction and old_data: if old_data:
self.emit('family-update',([handle],)) self.emit('family-update',([handle],))
else: else:
self.emit('family-add',([handle],)) self.emit('family-add',([handle],))

View File

@ -164,7 +164,7 @@ class GrampsInMemDB(GrampsDbBase):
if transaction != None: if transaction != None:
old_data = self.place_map.get(str(handle)) old_data = self.place_map.get(str(handle))
transaction.add(PLACE_KEY,handle,old_data) 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.pid_trans[place.get_gramps_id()]
del self.place_map[str(handle)] del self.place_map[str(handle)]
@ -175,6 +175,7 @@ class GrampsInMemDB(GrampsDbBase):
if transaction != None: if transaction != None:
old_data = self.media_map.get(str(handle)) old_data = self.media_map.get(str(handle))
transaction.add(MEDIA_KEY,handle,old_data) transaction.add(MEDIA_KEY,handle,old_data)
self.emit('media-delete',([handle],))
del self.oid_trans[obj.get_gramps_id()] del self.oid_trans[obj.get_gramps_id()]
del self.media_map[str(handle)] del self.media_map[str(handle)]
@ -185,7 +186,7 @@ class GrampsInMemDB(GrampsDbBase):
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)
self.emit('family-delete',([str(handle),])) self.emit('family-delete',([handle],))
del self.fid_trans[family.get_gramps_id()] del self.fid_trans[family.get_gramps_id()]
del self.family_map[str(handle)] del self.family_map[str(handle)]