2007-10-05 Benny Malengier <benny.malengier@gramps-project.org>

* src/DisplayTabs/_GalleryTab.py: remove bug that leads to database 
corruption,
	if media is deleted in mediaview, remove media in all open gallery tabs


svn: r9082
This commit is contained in:
Benny Malengier 2007-10-05 11:58:27 +00:00
parent 0b24aa2b6a
commit 6d6357a2fc
2 changed files with 27 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2007-10-05 Benny Malengier <benny.malengier@gramps-project.org>
* src/DisplayTabs/_GalleryTab.py: remove bug that leads to database corruption,
if media is deleted in mediaview, remove media in all open gallery tabs
2007-10-05 James G. Sack <jgsack@san.rr.com>
* src/GrampsDb/_GrampsDbBase.py:
* src/GrampsDb/_GrampsGEDDB.py:

View File

@ -77,6 +77,9 @@ class GalleryTab(ButtonTab):
self.rebuild()
self.show_all()
#connect external remove of object to rebuild
self.dbstate.db.connect('media-delete',self.media_delete)
def double_click(self, obj, event):
"""
@ -271,6 +274,26 @@ class GalleryTab(ButtonTab):
self.changed = True
self.rebuild()
def media_delete(self, del_media_handle_list):
"""
Outside of this tab media objects have been deleted. Check if tab
and object must be changed.
Note: delete of object will cause reference on database to be removed,
so this method need not do this
"""
ref_handles = [x.ref for x in self.media_list]
for handle in del_media_handle_list :
pos = None
try :
pos = ref_handles.index(handle)
except ValueError :
continue
if pos is not None:
#oeps, we need to remove this reference, and rebuild tab
self.media_list.remove(self.media_list[pos])
self.rebuild()
def _set_dnd(self):
"""
Sets up drag-n-drop. The source and destionation are set by calling .target()