* 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 Benny Malengier <benny.malengier@gramps-project.org> 


svn: r9081
This commit is contained in:
Benny Malengier 2007-10-05 11:54:04 +00:00
parent 5bdeeeb762
commit b10607715e
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 Benny Malengier <benny.malengier@gramps-project.org>
* src/GrampsDb/_ReadGedcom.py: issue #1169, wrong GEDCOM parse ADDR

View File

@ -78,6 +78,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):
"""
Handles the double click on list. If the double click occurs,
@ -270,6 +273,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()