From 56ba9fc78851c3424cdeda6c16e9b392cabd427d Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Fri, 20 May 2005 18:19:23 +0000 Subject: [PATCH] * 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 --- gramps2/ChangeLog | 4 ++++ gramps2/src/GrampsBSDDB.py | 2 +- gramps2/src/ImageSelect.py | 13 ++++++------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 93554d381..2174db191 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,5 +1,9 @@ 2005-05-20 Alex Roitman * 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 * src/DisplayModels.py: remove place column diff --git a/gramps2/src/GrampsBSDDB.py b/gramps2/src/GrampsBSDDB.py index 7376c4c53..1605d2828 100644 --- a/gramps2/src/GrampsBSDDB.py +++ b/gramps2/src/GrampsBSDDB.py @@ -318,7 +318,7 @@ class GrampsBSDDB(GrampsDbBase): if not self.readonly and handle and str(handle) in self.media_map: if transaction != None: 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.media_map.delete(str(handle)) diff --git a/gramps2/src/ImageSelect.py b/gramps2/src/ImageSelect.py index 6bb890444..7511e82e6 100644 --- a/gramps2/src/ImageSelect.py +++ b/gramps2/src/ImageSelect.py @@ -368,18 +368,17 @@ class Gallery(ImageSelect): def add_thumbnail(self, photo): """Scale the image and add it to the IconList.""" oid = photo.get_reference_handle() - obj = self.db.get_object_from_handle(oid) - if self.canvas_list.has_key(oid): - (grp,item,text,x,y) = self.canvas_list[oid] + media_obj = self.db.get_object_from_handle(oid) + if self.canvas_list.has_key(photo): + (grp,item,text,x,y) = self.canvas_list[photo] if x != self.cx or y != self.cy: grp.move(self.cx-x,self.cy-y) else: - description = obj.get_description() + description = media_obj.get_description() if len(description) > 20: description = "%s..." % description[0:20] try: - media_obj = self.db.get_object_from_handle(oid) mtype = media_obj.get_mime_type() if mtype and mtype.startswith("image"): 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) 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 @@ -582,7 +581,7 @@ class Gallery(ImageSelect): if 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[1].hide() val[2].hide()