From 84e1f06b4e1d53aae9f5b8d3644d3967cd701a97 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sat, 29 Apr 2006 02:13:47 +0000 Subject: [PATCH] 2006-04-28 Don Allingham * src/AddMedia.py: assign handle to notes svn: r6494 --- ChangeLog | 3 +++ src/AddMedia.py | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8fb0d4b72..a01184a8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2006-04-28 Don Allingham + * src/AddMedia.py: assign handle to notes + 2006-04-28 Brian Matherly * src/docgen/ODSDoc.py: Add Open Document Spreadsheet document * src/plugins/EventCmp.py: Use ODSDoc instead of OpenSpreadSheet diff --git a/src/AddMedia.py b/src/AddMedia.py index 651403653..bfdaaa8ed 100644 --- a/src/AddMedia.py +++ b/src/AddMedia.py @@ -110,7 +110,7 @@ class AddMediaObject(ManagedWindow.ManagedWindow): GrampsDisplay.help('gramps-edit-quick') self.val = self.window.run() - def on_savephoto_clicked(self): + def save(self): """ Callback function called with the save button is pressed. A new media object is created, and added to the database. @@ -120,6 +120,7 @@ class AddMediaObject(ManagedWindow.ManagedWindow): if self.internal.get_active(): mobj = RelLib.MediaObject() mobj.set_description(description) + mobj.set_handle(Utils.create_id()) mobj.set_mime_type(None) else: filename = self.file_text.get_filename() @@ -141,12 +142,14 @@ class AddMediaObject(ManagedWindow.ManagedWindow): 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) + 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() self.object = mobj self.db.commit_media_object(mobj,trans) @@ -181,7 +184,7 @@ class AddMediaObject(ManagedWindow.ManagedWindow): val = self.window.run() if val == gtk.RESPONSE_OK: - self.on_savephoto_clicked() + self.save() self.close() return self.object elif val == gtk.RESPONSE_HELP: