From 6e4c5462d569b238ab32017428e2ea6054000890 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Mon, 12 May 2003 03:30:30 +0000 Subject: [PATCH] Handle media files on Save As... svn: r1514 --- gramps2/src/gramps_main.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 03817a6a9..5c3d46d41 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -836,11 +836,26 @@ class Gramps: filename = os.path.normpath(os.path.abspath(filename)) if filename: Utils.destroy_passed_object(obj) + self.save_media(filename) if GrampsCfg.usevc and GrampsCfg.vc_comment: self.display_comment_box(filename) else: self.save_file(filename,_("No Comment Provided")) + def save_media(self,filename): + import RelImage + ObjectMap = self.db.getObjectMap() + for ObjectId in ObjectMap.keys(): + if ObjectMap[ObjectId].getLocal(): + oldfile = ObjectMap[ObjectId].getPath() + (base,ext) = os.path.splitext(os.path.basename(oldfile)) + newfile = os.path.join(filename,os.path.basename(oldfile)) + try: + RelImage.import_media_object(oldfile,filename,base) + ObjectMap[ObjectId].setPath(newfile) + except: + pass + def save_file(self,filename,comment): path = filename