* src/GrampsBSDDB.py (remove_object): Use correct key for transaction.

* src/ImageSelect.py (add_thumbnail, on_delete_media_clicked):
Identify canvas items by MediaRef instance, not by the handle of the
referred MediaObject.


svn: r4641
This commit is contained in:
Alex Roitman 2005-05-20 18:19:23 +00:00
parent 09d5280dcd
commit 56ba9fc788
3 changed files with 11 additions and 8 deletions

View File

@ -1,5 +1,9 @@
2005-05-20 Alex Roitman <shura@gramps-project.org> 2005-05-20 Alex Roitman <shura@gramps-project.org>
* src/SelectObject.py (on_select_row): Properly get mime type. * src/SelectObject.py (on_select_row): Properly get mime type.
* src/GrampsBSDDB.py (remove_object): Use correct key for transaction.
* src/ImageSelect.py (add_thumbnail, on_delete_media_clicked):
Identify canvas items by MediaRef instance, not by the handle of the
referred MediaObject.
2005-05-19 Don Allingham <don@gramps-project.org> 2005-05-19 Don Allingham <don@gramps-project.org>
* src/DisplayModels.py: remove place column * src/DisplayModels.py: remove place column

View File

@ -318,7 +318,7 @@ class GrampsBSDDB(GrampsDbBase):
if not self.readonly and handle and str(handle) in self.media_map: if not self.readonly and handle and str(handle) in self.media_map:
if transaction != None: if transaction != None:
old_data = self.media_map.get(handle) old_data = self.media_map.get(handle)
transaction.add(PLACE_KEY,handle,old_data) transaction.add(MEDIA_KEY,handle,old_data)
self.emit('media-delete',([handle],)) self.emit('media-delete',([handle],))
self.media_map.delete(str(handle)) self.media_map.delete(str(handle))

View File

@ -368,18 +368,17 @@ class Gallery(ImageSelect):
def add_thumbnail(self, photo): def add_thumbnail(self, photo):
"""Scale the image and add it to the IconList.""" """Scale the image and add it to the IconList."""
oid = photo.get_reference_handle() oid = photo.get_reference_handle()
obj = self.db.get_object_from_handle(oid) media_obj = self.db.get_object_from_handle(oid)
if self.canvas_list.has_key(oid): if self.canvas_list.has_key(photo):
(grp,item,text,x,y) = self.canvas_list[oid] (grp,item,text,x,y) = self.canvas_list[photo]
if x != self.cx or y != self.cy: if x != self.cx or y != self.cy:
grp.move(self.cx-x,self.cy-y) grp.move(self.cx-x,self.cy-y)
else: else:
description = obj.get_description() description = media_obj.get_description()
if len(description) > 20: if len(description) > 20:
description = "%s..." % description[0:20] description = "%s..." % description[0:20]
try: try:
media_obj = self.db.get_object_from_handle(oid)
mtype = media_obj.get_mime_type() mtype = media_obj.get_mime_type()
if mtype and mtype.startswith("image"): if mtype and mtype.startswith("image"):
image = ImgManip.get_thumbnail_image(media_obj.get_path()) image = ImgManip.get_thumbnail_image(media_obj.get_path())
@ -424,7 +423,7 @@ class Gallery(ImageSelect):
self.p_map[i] = (item,text,box,photo,oid) self.p_map[i] = (item,text,box,photo,oid)
i.show() i.show()
self.canvas_list[oid] = (grp,item,text,self.cx,self.cy) self.canvas_list[photo] = (grp,item,text,self.cx,self.cy)
self.cx += _PAD + _IMAGEX self.cx += _PAD + _IMAGEX
@ -582,7 +581,7 @@ class Gallery(ImageSelect):
if self.sel: if self.sel:
(i,t,b,photo,oid) = self.p_map[self.sel] (i,t,b,photo,oid) = self.p_map[self.sel]
val = self.canvas_list[photo.get_reference_handle()] val = self.canvas_list[photo]
val[0].hide() val[0].hide()
val[1].hide() val[1].hide()
val[2].hide() val[2].hide()