2006-04-28 Don Allingham <don@gramps-project.org>
* src/AddMedia.py: assign handle to notes svn: r6494
This commit is contained in:
parent
58a6f62125
commit
84e1f06b4e
@ -1,3 +1,6 @@
|
|||||||
|
2006-04-28 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/AddMedia.py: assign handle to notes
|
||||||
|
|
||||||
2006-04-28 Brian Matherly <brian@gramps-project.org>
|
2006-04-28 Brian Matherly <brian@gramps-project.org>
|
||||||
* src/docgen/ODSDoc.py: Add Open Document Spreadsheet document
|
* src/docgen/ODSDoc.py: Add Open Document Spreadsheet document
|
||||||
* src/plugins/EventCmp.py: Use ODSDoc instead of OpenSpreadSheet
|
* src/plugins/EventCmp.py: Use ODSDoc instead of OpenSpreadSheet
|
||||||
|
@ -110,7 +110,7 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
|
|||||||
GrampsDisplay.help('gramps-edit-quick')
|
GrampsDisplay.help('gramps-edit-quick')
|
||||||
self.val = self.window.run()
|
self.val = self.window.run()
|
||||||
|
|
||||||
def on_savephoto_clicked(self):
|
def save(self):
|
||||||
"""
|
"""
|
||||||
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.
|
||||||
@ -120,6 +120,7 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
|
|||||||
if self.internal.get_active():
|
if self.internal.get_active():
|
||||||
mobj = RelLib.MediaObject()
|
mobj = RelLib.MediaObject()
|
||||||
mobj.set_description(description)
|
mobj.set_description(description)
|
||||||
|
mobj.set_handle(Utils.create_id())
|
||||||
mobj.set_mime_type(None)
|
mobj.set_mime_type(None)
|
||||||
else:
|
else:
|
||||||
filename = self.file_text.get_filename()
|
filename = self.file_text.get_filename()
|
||||||
@ -141,12 +142,14 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
|
|||||||
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)
|
||||||
|
|
||||||
|
mobj.set_handle(Utils.create_id())
|
||||||
|
if not mobj.get_gramps_id():
|
||||||
|
mobj.set_gramps_id(self.db.find_next_object_gramps_id())
|
||||||
trans = self.db.transaction_begin()
|
trans = self.db.transaction_begin()
|
||||||
self.object = mobj
|
self.object = mobj
|
||||||
self.db.commit_media_object(mobj,trans)
|
self.db.commit_media_object(mobj,trans)
|
||||||
@ -181,7 +184,7 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
|
|||||||
val = self.window.run()
|
val = self.window.run()
|
||||||
|
|
||||||
if val == gtk.RESPONSE_OK:
|
if val == gtk.RESPONSE_OK:
|
||||||
self.on_savephoto_clicked()
|
self.save()
|
||||||
self.close()
|
self.close()
|
||||||
return self.object
|
return self.object
|
||||||
elif val == gtk.RESPONSE_HELP:
|
elif val == gtk.RESPONSE_HELP:
|
||||||
|
Loading…
Reference in New Issue
Block a user