MediaView integrity after add

svn: r6127
This commit is contained in:
Don Allingham 2006-03-10 04:29:08 +00:00
parent d064e0bb8b
commit b2e95112e1
3 changed files with 3 additions and 12 deletions

View File

@ -1,4 +1,5 @@
2006-03-09 Don Allingham <don@gramps-project.org> 2006-03-09 Don Allingham <don@gramps-project.org>
* src/AddMedia.py: avoid double commit
* src/GrampsDb/_GrampsDbBase.py: fix add of places in internal map * src/GrampsDb/_GrampsDbBase.py: fix add of places in internal map
* src/Editors/_EditEventRef.py: commit place properly * src/Editors/_EditEventRef.py: commit place properly
* src/DataViews/_FamilyView.py: avoid reentry * src/DataViews/_FamilyView.py: avoid reentry

View File

@ -30,7 +30,6 @@ Provides the interface to allow a person to add a media object to the database.
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os import os
import gc
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -109,7 +108,6 @@ class AddMediaObject:
Callback function called with the save button is pressed. Callback function called with the save button is pressed.
A new media object is created, and added to the database. A new media object is created, and added to the database.
""" """
description = unicode(self.description.get_text()) description = unicode(self.description.get_text())
if self.internal.get_active(): if self.internal.get_active():
@ -136,13 +134,13 @@ class AddMediaObject:
description = os.path.basename(filename) description = os.path.basename(filename)
mobj = RelLib.MediaObject() mobj = RelLib.MediaObject()
mobj.set_handle(Utils.create_id())
mobj.set_description(description) mobj.set_description(description)
mobj.set_mime_type(mtype) mobj.set_mime_type(mtype)
name = filename name = filename
mobj.set_path(name) mobj.set_path(name)
trans = self.db.transaction_begin() trans = self.db.transaction_begin()
self.db.add_object(mobj,trans)
self.object = mobj self.object = mobj
self.db.commit_media_object(mobj,trans) self.db.commit_media_object(mobj,trans)
self.db.transaction_commit(trans,_("Add Media Object")) self.db.transaction_commit(trans,_("Add Media Object"))
@ -178,12 +176,10 @@ class AddMediaObject:
if val == gtk.RESPONSE_OK: if val == gtk.RESPONSE_OK:
self.on_savephoto_clicked() self.on_savephoto_clicked()
self.window.destroy() self.window.destroy()
gc.collect()
return self.object return self.object
elif val == gtk.RESPONSE_HELP: elif val == gtk.RESPONSE_HELP:
self.on_help_imagesel_clicked(None) self.on_help_imagesel_clicked(None)
else: else:
self.window.destroy() self.window.destroy()
gc.collect()
return None return None
return None return None

View File

@ -105,11 +105,6 @@ class MediaView(PageView.ListView):
self.image = gtk.Image() self.image = gtk.Image()
self.image.set_size_request(int(const.thumbScale), self.image.set_size_request(int(const.thumbScale),
int(const.thumbScale)) int(const.thumbScale))
# label = gtk.Label('<b>%s</b>' % _('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(self.image,False)
vbox.pack_start(base,True) vbox.pack_start(base,True)
@ -153,8 +148,7 @@ class MediaView(PageView.ListView):
def on_double_click(self,obj,event): def on_double_click(self,obj,event):
handle = self.first_selected() handle = self.first_selected()
if handle: if handle:
place = self.dbstate.db.get_place_from_handle(handle) media_obj = self.dbstate.db.get_object_from_handle(handle)
#EditPlace.EditPlace(place,self.dbstate, self.uistate)
def add(self,obj): def add(self,obj):
"""Add a new media object to the media list""" """Add a new media object to the media list"""