From b2e95112e107f920ed222f34cab3a6b2b6d10f33 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 10 Mar 2006 04:29:08 +0000 Subject: [PATCH] MediaView integrity after add svn: r6127 --- gramps2/ChangeLog | 1 + gramps2/src/AddMedia.py | 6 +----- gramps2/src/DataViews/_MediaView.py | 8 +------- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 30a37423d..757502776 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,5 @@ 2006-03-09 Don Allingham + * src/AddMedia.py: avoid double commit * src/GrampsDb/_GrampsDbBase.py: fix add of places in internal map * src/Editors/_EditEventRef.py: commit place properly * src/DataViews/_FamilyView.py: avoid reentry diff --git a/gramps2/src/AddMedia.py b/gramps2/src/AddMedia.py index f48cb014c..707f60181 100644 --- a/gramps2/src/AddMedia.py +++ b/gramps2/src/AddMedia.py @@ -30,7 +30,6 @@ Provides the interface to allow a person to add a media object to the database. # #------------------------------------------------------------------------- import os -import gc #------------------------------------------------------------------------- # @@ -109,7 +108,6 @@ class AddMediaObject: Callback function called with the save button is pressed. A new media object is created, and added to the database. """ - description = unicode(self.description.get_text()) if self.internal.get_active(): @@ -136,13 +134,13 @@ class AddMediaObject: description = os.path.basename(filename) mobj = RelLib.MediaObject() + mobj.set_handle(Utils.create_id()) mobj.set_description(description) mobj.set_mime_type(mtype) name = filename mobj.set_path(name) trans = self.db.transaction_begin() - self.db.add_object(mobj,trans) self.object = mobj self.db.commit_media_object(mobj,trans) self.db.transaction_commit(trans,_("Add Media Object")) @@ -178,12 +176,10 @@ class AddMediaObject: if val == gtk.RESPONSE_OK: self.on_savephoto_clicked() self.window.destroy() - gc.collect() return self.object elif val == gtk.RESPONSE_HELP: self.on_help_imagesel_clicked(None) else: self.window.destroy() - gc.collect() return None return None diff --git a/gramps2/src/DataViews/_MediaView.py b/gramps2/src/DataViews/_MediaView.py index fe78dc120..e4377d364 100644 --- a/gramps2/src/DataViews/_MediaView.py +++ b/gramps2/src/DataViews/_MediaView.py @@ -105,11 +105,6 @@ class MediaView(PageView.ListView): self.image = gtk.Image() self.image.set_size_request(int(const.thumbScale), int(const.thumbScale)) -# label = gtk.Label('%s' % _('Preview')) -# label.set_use_markup(True) -# frame = gtk.Frame() -# frame.set_label_widget(label) -# frame.add(self.image) vbox.pack_start(self.image,False) vbox.pack_start(base,True) @@ -153,8 +148,7 @@ class MediaView(PageView.ListView): def on_double_click(self,obj,event): handle = self.first_selected() if handle: - place = self.dbstate.db.get_place_from_handle(handle) - #EditPlace.EditPlace(place,self.dbstate, self.uistate) + media_obj = self.dbstate.db.get_object_from_handle(handle) def add(self,obj): """Add a new media object to the media list"""