Handle media files on Save As...

svn: r1514
This commit is contained in:
Alex Roitman 2003-05-12 03:30:30 +00:00
parent ab2caa2422
commit 6e4c5462d5

View File

@ -836,11 +836,26 @@ class Gramps:
filename = os.path.normpath(os.path.abspath(filename)) filename = os.path.normpath(os.path.abspath(filename))
if filename: if filename:
Utils.destroy_passed_object(obj) Utils.destroy_passed_object(obj)
self.save_media(filename)
if GrampsCfg.usevc and GrampsCfg.vc_comment: if GrampsCfg.usevc and GrampsCfg.vc_comment:
self.display_comment_box(filename) self.display_comment_box(filename)
else: else:
self.save_file(filename,_("No Comment Provided")) 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): def save_file(self,filename,comment):
path = filename path = filename