Handle media files on Save As...
svn: r1514
This commit is contained in:
parent
ab2caa2422
commit
6e4c5462d5
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user