svn: r7309
This commit is contained in:
parent
0b6095fdc8
commit
61b9f23c9e
@ -742,7 +742,7 @@ class GedcomParser(UpdateCallback):
|
||||
|
||||
def find_file(self,fullname,altpath):
|
||||
tries = []
|
||||
fullname = fullname.replace('\\','/')
|
||||
fullname = fullname.replace('\\',os.path.sep)
|
||||
tries.append(fullname)
|
||||
|
||||
if os.path.isfile(fullname):
|
||||
@ -987,7 +987,7 @@ class GedcomParser(UpdateCallback):
|
||||
(ok,path) = self.find_file(matches[2], self.dir_path)
|
||||
if not ok:
|
||||
self.warn(_("Could not import %s") % filename)
|
||||
path = filename.replace('\\','/')
|
||||
path = filename.replace('\\',os.path.sep)
|
||||
|
||||
def func_obje_ignore(self, matches, media, level):
|
||||
self.ignore_sub_junk(level+1)
|
||||
@ -2663,7 +2663,7 @@ class GedcomParser(UpdateCallback):
|
||||
(ok,path) = self.find_file(filename,self.dir_path)
|
||||
if not ok:
|
||||
self.warn(_("Could not import %s") % filename)
|
||||
path = filename.replace('\\','/')
|
||||
path = filename.replace('\\',os.path.sep)
|
||||
photo_handle = self.media_map.get(path)
|
||||
if photo_handle == None:
|
||||
photo = RelLib.MediaObject()
|
||||
|
@ -170,20 +170,20 @@ def importData(database, filename, callback=None,cl=0,use_trans=False):
|
||||
# copy all local images into <database>.images directory
|
||||
db_dir = os.path.abspath(os.path.dirname(database.get_save_path()))
|
||||
db_base = os.path.basename(database.get_save_path())
|
||||
img_dir = "%s/%s.images" % (db_dir,db_base)
|
||||
img_dir = "%s%s%s.images" % (db_dir,os.path.sep,db_base)
|
||||
first = not os.path.exists(img_dir)
|
||||
|
||||
for m_id in database.get_media_object_handles():
|
||||
mobject = database.get_object_from_handle(m_id)
|
||||
oldfile = mobject.get_path()
|
||||
if oldfile and oldfile[0] != '/':
|
||||
if oldfile and oldfile[0] != '//':
|
||||
if first:
|
||||
os.mkdir(img_dir)
|
||||
first = 0
|
||||
newfile = "%s/%s" % (img_dir,oldfile)
|
||||
newfile = "%s%s%s" % (img_dir,os.path.sep,oldfile)
|
||||
|
||||
try:
|
||||
oldfilename = "%s/%s" % (basefile,oldfile)
|
||||
oldfilename = "%s%s%s" % (basefile,os.path.sep,oldfile)
|
||||
shutil.copyfile(oldfilename,newfile)
|
||||
try:
|
||||
shutil.copystat(oldfilename,newfile)
|
||||
@ -1002,9 +1002,9 @@ class GrampsParser(UpdateCallback):
|
||||
self.object.desc = attrs['description']
|
||||
src = attrs["src"]
|
||||
if src:
|
||||
if src[0] != '/':
|
||||
if src[0] != os.path.sep:
|
||||
fullpath = os.path.abspath(self.filename)
|
||||
src = os.path.dirname(fullpath) + '/' + src
|
||||
src = os.path.dirname(fullpath) + os.path.sep + src
|
||||
self.object.path = src
|
||||
|
||||
def start_childof(self,attrs):
|
||||
@ -1181,9 +1181,9 @@ class GrampsParser(UpdateCallback):
|
||||
self.object.desc = attrs.get('description','')
|
||||
src = attrs.get("src",'')
|
||||
if src:
|
||||
if src[0] != '/':
|
||||
if src[0] != os.path.sep:
|
||||
fullpath = os.path.abspath(self.filename)
|
||||
src = os.path.dirname(fullpath) + '/' + src
|
||||
src = os.path.dirname(fullpath) + os.path.sep + src
|
||||
self.object.path = src
|
||||
|
||||
def start_repo(self,attrs):
|
||||
@ -1227,8 +1227,8 @@ class GrampsParser(UpdateCallback):
|
||||
self.pref.set_privacy(int(attrs[key]))
|
||||
elif key == "src":
|
||||
src = attrs["src"]
|
||||
if src[0] != '/':
|
||||
self.photo.set_path("%s/%s" % (self.base,src))
|
||||
if src[0] != os.path.sep:
|
||||
self.photo.set_path("%s%s%s"%(self.base,os.path.sep,src))
|
||||
else:
|
||||
self.photo.set_path(src)
|
||||
else:
|
||||
|
@ -792,7 +792,7 @@ class ViewManager:
|
||||
self.state.db.set_save_path(filename)
|
||||
|
||||
# Update window title
|
||||
if filename[-1] == '/':
|
||||
if filename[-1] == os.path.sep:
|
||||
filename = filename[:-1]
|
||||
name = os.path.basename(filename)
|
||||
if self.state.db.readonly:
|
||||
|
Loading…
Reference in New Issue
Block a user