* src/ReadXML.py (import_data), src/WriteXML.py (export_data),
src/RelImage.py (import_media_object), src/gramps_main.py (open_example), src/plugins/Check.py (cleanup_missing_photos), src/plugins/WebPage.py (write_gallery): Change shutil.copy() calls to first call shutil.copyfile() and then try setting up bits. svn: r1652
This commit is contained in:
parent
8eb22a3bd5
commit
4d8789f4ab
@ -185,7 +185,11 @@ def importData(database, filename, callback,cl=0):
|
|||||||
def fs_ok_clicked(obj):
|
def fs_ok_clicked(obj):
|
||||||
name = fs_top.get_filename()
|
name = fs_top.get_filename()
|
||||||
if os.path.isfile(name):
|
if os.path.isfile(name):
|
||||||
shutil.copy2(name,newfile)
|
shutil.copyfile(name,newfile)
|
||||||
|
try:
|
||||||
|
shutil.copystat(name,newfile)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
Utils.destroy_passed_object(fs_top)
|
Utils.destroy_passed_object(fs_top)
|
||||||
|
|
||||||
fs_top = gtk.FileSelection("%s - GRAMPS" % _("Select file"))
|
fs_top = gtk.FileSelection("%s - GRAMPS" % _("Select file"))
|
||||||
@ -210,7 +214,11 @@ def importData(database, filename, callback,cl=0):
|
|||||||
ObjectMap[NewMediaID].setPath(newfile)
|
ObjectMap[NewMediaID].setPath(newfile)
|
||||||
ObjectMap[NewMediaID].setLocal(1)
|
ObjectMap[NewMediaID].setLocal(1)
|
||||||
try:
|
try:
|
||||||
shutil.copy2(oldfile,newfile)
|
shutil.copyfile(oldfile,newfile)
|
||||||
|
try:
|
||||||
|
shutil.copystat(oldfile,newfile)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
except:
|
except:
|
||||||
if cl:
|
if cl:
|
||||||
print "Warning: media file %s was not found," \
|
print "Warning: media file %s was not found," \
|
||||||
|
@ -82,7 +82,11 @@ def import_media_object(filename,path,base):
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
shutil.copy(filename,name)
|
shutil.copyfile(filename,name)
|
||||||
|
try:
|
||||||
|
shutil.copystat(filename,name)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
except IOError,msg:
|
except IOError,msg:
|
||||||
ErrorDialog(_("Error copying %s") % filename,str(msg))
|
ErrorDialog(_("Error copying %s") % filename,str(msg))
|
||||||
return ""
|
return ""
|
||||||
@ -91,7 +95,11 @@ def import_media_object(filename,path,base):
|
|||||||
bname = os.path.basename(filename)
|
bname = os.path.basename(filename)
|
||||||
l = string.split(bname,'.')
|
l = string.split(bname,'.')
|
||||||
name = "%s/%s.%s" % (path,base,l[-1])
|
name = "%s/%s.%s" % (path,base,l[-1])
|
||||||
shutil.copy(filename,name)
|
shutil.copyfile(filename,name)
|
||||||
|
try:
|
||||||
|
shutil.copystat(filename,name)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
@ -65,7 +65,11 @@ except:
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def exportData(database, filename, callback):
|
def exportData(database, filename, callback):
|
||||||
if os.path.isfile(filename):
|
if os.path.isfile(filename):
|
||||||
shutil.copy(filename, filename + ".bak")
|
shutil.copyfile(filename, filename + ".bak")
|
||||||
|
try:
|
||||||
|
shutil.copystat(filename, filename + ".bak")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
compress = GrampsCfg.uncompress == 0 and _gzip_ok == 1
|
compress = GrampsCfg.uncompress == 0 and _gzip_ok == 1
|
||||||
|
|
||||||
@ -78,7 +82,11 @@ def exportData(database, filename, callback):
|
|||||||
DisplayTrace.DisplayTrace()
|
DisplayTrace.DisplayTrace()
|
||||||
ErrorDialog(_("Failure writing %s") % filename,
|
ErrorDialog(_("Failure writing %s") % filename,
|
||||||
_("An attempt is being made to recover the original file"))
|
_("An attempt is being made to recover the original file"))
|
||||||
shutil.copy(filename + ".bak", filename)
|
shutil.copyfile(filename + ".bak", filename)
|
||||||
|
try:
|
||||||
|
shutil.copystat(filename + ".bak", filename)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@ -2024,7 +2024,11 @@ class Gramps:
|
|||||||
try:
|
try:
|
||||||
dir = "%s/share/gramps/example" % const.prefixdir
|
dir = "%s/share/gramps/example" % const.prefixdir
|
||||||
for file in os.listdir(dir):
|
for file in os.listdir(dir):
|
||||||
shutil.copy("%s/%s" % (dir,file), dest)
|
shutil.copyfile("%s/%s" % (dir,file), dest)
|
||||||
|
try:
|
||||||
|
shutil.copystat("%s/%s" % (dir,file), dest)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
except IOError,msg:
|
except IOError,msg:
|
||||||
ErrorDialog(_('Example database not created'),str(msg))
|
ErrorDialog(_('Example database not created'),str(msg))
|
||||||
except OSError,msg:
|
except OSError,msg:
|
||||||
|
@ -142,7 +142,11 @@ class CheckIntegrity:
|
|||||||
def fs_ok_clicked(obj):
|
def fs_ok_clicked(obj):
|
||||||
name = fs_top.get_filename()
|
name = fs_top.get_filename()
|
||||||
if os.path.isfile(name):
|
if os.path.isfile(name):
|
||||||
shutil.copy2(name,photo_name)
|
shutil.copyfile(name,photo_name)
|
||||||
|
try:
|
||||||
|
shutil.copystat(name,photo_name)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
self.replaced_photo.append(ObjectMap[ObjectId])
|
self.replaced_photo.append(ObjectMap[ObjectId])
|
||||||
else:
|
else:
|
||||||
self.bad_photo.append(ObjectMap[ObjectId])
|
self.bad_photo.append(ObjectMap[ObjectId])
|
||||||
|
@ -362,9 +362,17 @@ class IndividualPage:
|
|||||||
base = os.path.basename(src)
|
base = os.path.basename(src)
|
||||||
|
|
||||||
if self.image_dir:
|
if self.image_dir:
|
||||||
shutil.copy(src,"%s/%s/%s" % (self.dir,self.image_dir,base))
|
shutil.copyfile(src,"%s/%s/%s" % (self.dir,self.image_dir,base))
|
||||||
|
try:
|
||||||
|
shutil.copystat(src,"%s/%s/%s" % (self.dir,self.image_dir,base))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
shutil.copy(src,"%s/%s" % (self.dir,base))
|
shutil.copyfile(src,"%s/%s" % (self.dir,base))
|
||||||
|
try:
|
||||||
|
shutil.copystat(src,"%s/%s" % (self.dir,base))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
self.doc.start_row()
|
self.doc.start_row()
|
||||||
self.doc.start_cell("ImageCell")
|
self.doc.start_cell("ImageCell")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user