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

* src/DisplayTabs/_GalleryTab.py: correctly update displaytab


svn: r9236
This commit is contained in:
Benny Malengier 2007-10-22 20:45:34 +00:00
parent f8d26dede0
commit 48b7b5db8f
2 changed files with 34 additions and 16 deletions

View File

@ -1,3 +1,6 @@
2007-10-22 Benny Malengier <benny.malengier@gramps-project.org>
* src/DisplayTabs/_GalleryTab.py: correctly update displaytab
2007-10-22 Benny Malengier <benny.malengier@gramps-project.org>
* src/GrampsDb/_GrampsInMemDB.py: xml load/save not working, fixed #1319

View File

@ -78,9 +78,12 @@ 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 connect_db_signals(self):
#connect external remove/change of object to rebuild of grampstab
self._add_db_signal('media-delete', self.media_delete)
self._add_db_signal('media-rebuild', self.rebuild)
self._add_db_signal('media-update', self.media_update)
def double_click(self, obj, event):
"""
@ -292,14 +295,10 @@ class GalleryTab(ButtonTab):
from Editors import EditMediaRef
EditMediaRef(self.dbstate, self.uistate, self.track,
obj, ref, self.edit_callback)
obj, ref, None)
except Errors.WindowActiveError:
pass
def edit_callback(self, media_ref, ref):
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
@ -307,18 +306,34 @@ class GalleryTab(ButtonTab):
Note: delete of object will cause reference on database to be removed,
so this method need not do this
"""
rebuild = False
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
while 1:
pos = None
try :
pos = ref_handles.index(handle)
except ValueError :
break
if pos is not None:
#oeps, we need to remove this reference, and rebuild tab
self.media_list.remove(self.media_list[pos])
if pos is not None:
#oeps, we need to remove this reference, and rebuild tab
del self.media_list[pos]
del ref_handles[pos]
rebuild = True
if rebuild:
self.rebuild()
def media_update(self, upd_media_handle_list):
"""
Outside of this tab media objects have been changed. Check if tab
and object must be changed.
"""
ref_handles = [x.ref for x in self.media_list]
for handle in upd_media_handle_list :
if handle in ref_handles:
self.rebuild()
break
def _set_dnd(self):
"""