* src/GrampsParser.py (start_childof): Call add_parent_family_id()
with three arguments, instead of a tuple. * src/ReadXML.py: Comment out renaming lost media objects for now. * src/RelLib.py (find_place_no_conflicts, find_family_no_conflicts): Use str(idVal). svn: r2926
This commit is contained in:
parent
93542c93f5
commit
9b0827745c
@ -1,3 +1,10 @@
|
||||
2004-02-28 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||
* src/GrampsParser.py (start_childof): Call add_parent_family_id()
|
||||
with three arguments, instead of a tuple.
|
||||
* src/ReadXML.py: Comment out renaming lost media objects for now.
|
||||
* src/RelLib.py (find_place_no_conflicts,
|
||||
find_family_no_conflicts): Use str(idVal).
|
||||
|
||||
2004-02-28 Don Allingham <dallingham@users.sourceforge.net>
|
||||
* src/gramps_main.py: switch to DB as default, remove save option
|
||||
* src/RelLib.py: setup DB environment better
|
||||
|
@ -946,7 +946,7 @@ class GrampsImportParser(GrampsParser):
|
||||
frel = attrs["frel"]
|
||||
else:
|
||||
frel = "Birth"
|
||||
self.person.add_parent_family_id((family.get_id(),mrel,frel))
|
||||
self.person.add_parent_family_id(family.get_id(),mrel,frel)
|
||||
|
||||
def start_parentin(self,attrs):
|
||||
self.person.add_family_id(attrs["ref"])
|
||||
|
@ -203,44 +203,44 @@ def importData(database, filename, callback,cl=0):
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
# Rename media files if they were conflicting with existing ones
|
||||
ObjectMap = database.get_object_map()
|
||||
newpath = database.get_save_path()
|
||||
for OldMediaID in parser.MediaFileMap.keys():
|
||||
NewMediaID = parser.MediaFileMap[OldMediaID]
|
||||
oldfile = ObjectMap[NewMediaID].get_path()
|
||||
(junk,oldext) = os.path.splitext(os.path.basename(oldfile))
|
||||
oldfile = os.path.join(basefile,OldMediaID+oldext)
|
||||
newfile = os.path.join(newpath,NewMediaID+oldext)
|
||||
ObjectMap[NewMediaID].set_path(newfile)
|
||||
ObjectMap[NewMediaID].setLocal(1)
|
||||
try:
|
||||
shutil.copyfile(oldfile,newfile)
|
||||
try:
|
||||
shutil.copystat(oldfile,newfile)
|
||||
except:
|
||||
pass
|
||||
except:
|
||||
if cl:
|
||||
print "Warning: media file %s was not found," \
|
||||
% os.path.basename(oldfile), "so it was ignored."
|
||||
else:
|
||||
# File is lost => ask what to do (if we were not told yet)
|
||||
if missmedia_action == 0:
|
||||
mmd = MissingMediaDialog(_("Media object could not be found"),
|
||||
_("%(file_name)s is referenced in the database, but no longer exists. "
|
||||
"The file may have been deleted or moved to a different location. "
|
||||
"You may choose to either remove the reference from the database, "
|
||||
"keep the reference to the missing file, or select a new file."
|
||||
) % { 'file_name' : oldfile },
|
||||
remove_clicked, leave_clicked, select_clicked)
|
||||
missmedia_action = mmd.default_action
|
||||
elif missmedia_action == 1:
|
||||
remove_clicked()
|
||||
elif missmedia_action == 2:
|
||||
leave_clicked()
|
||||
elif missmedia_action == 3:
|
||||
select_clicked()
|
||||
# # Rename media files if they were conflicting with existing ones
|
||||
# ObjectMap = database.get_object_map()
|
||||
# newpath = database.get_save_path()
|
||||
# for OldMediaID in parser.MediaFileMap.keys():
|
||||
# NewMediaID = parser.MediaFileMap[OldMediaID]
|
||||
# oldfile = ObjectMap[NewMediaID].get_path()
|
||||
# (junk,oldext) = os.path.splitext(os.path.basename(oldfile))
|
||||
# oldfile = os.path.join(basefile,OldMediaID+oldext)
|
||||
# newfile = os.path.join(newpath,NewMediaID+oldext)
|
||||
# ObjectMap[NewMediaID].set_path(newfile)
|
||||
# ObjectMap[NewMediaID].setLocal(1)
|
||||
# try:
|
||||
# shutil.copyfile(oldfile,newfile)
|
||||
# try:
|
||||
# shutil.copystat(oldfile,newfile)
|
||||
# except:
|
||||
# pass
|
||||
# except:
|
||||
# if cl:
|
||||
# print "Warning: media file %s was not found," \
|
||||
# % os.path.basename(oldfile), "so it was ignored."
|
||||
# else:
|
||||
# # File is lost => ask what to do (if we were not told yet)
|
||||
# if missmedia_action == 0:
|
||||
# mmd = MissingMediaDialog(_("Media object could not be found"),
|
||||
# _("%(file_name)s is referenced in the database, but no longer exists. "
|
||||
# "The file may have been deleted or moved to a different location. "
|
||||
# "You may choose to either remove the reference from the database, "
|
||||
# "keep the reference to the missing file, or select a new file."
|
||||
# ) % { 'file_name' : oldfile },
|
||||
# remove_clicked, leave_clicked, select_clicked)
|
||||
# missmedia_action = mmd.default_action
|
||||
# elif missmedia_action == 1:
|
||||
# remove_clicked()
|
||||
# elif missmedia_action == 2:
|
||||
# leave_clicked()
|
||||
# elif missmedia_action == 3:
|
||||
# select_clicked()
|
||||
|
||||
del parser
|
||||
return 1
|
||||
|
@ -2899,17 +2899,17 @@ class GrampsDB:
|
||||
idVal - external ID number
|
||||
map - map build by findPlace of external to gramp's IDs"""
|
||||
|
||||
if map.has_key(idVal):
|
||||
if map.has_key(str(idVal)):
|
||||
place = Place()
|
||||
data = self.place_map[map[idVal]]
|
||||
data = self.place_map[map[str(idVal)]]
|
||||
place.unserialize(data)
|
||||
else:
|
||||
place = Place()
|
||||
if self.place_map.has_key(idVal):
|
||||
map[idVal] = self.add_place(place)
|
||||
if self.place_map.has_key(str(idVal)):
|
||||
map[str(idVal)] = self.add_place(place)
|
||||
else:
|
||||
place.set_id(idVal)
|
||||
map[idVal] = self.add_place_as(place)
|
||||
place.set_id(str(idVal))
|
||||
map[str(idVal)] = self.add_place_as(place)
|
||||
self.place_map.put(str(idVal),place.serialize())
|
||||
return place
|
||||
|
||||
@ -3082,7 +3082,7 @@ class GrampsDB:
|
||||
|
||||
person = Person()
|
||||
if map.has_key(idVal):
|
||||
person.serialize(self.person_map.get(str(map[idVal])))
|
||||
person.unserialize(self.person_map.get(str(map[idVal])))
|
||||
else:
|
||||
if self.person_map.get(str(idVal)):
|
||||
map[idVal] = self.add_person(person)
|
||||
@ -3100,15 +3100,15 @@ class GrampsDB:
|
||||
idVal - external ID number
|
||||
map - map build by findFamily of external to gramp's IDs"""
|
||||
|
||||
if map.has_key(idVal):
|
||||
if map.has_key(str(idVal)):
|
||||
family = Family()
|
||||
family.unserialize(self.family_map.get(str(map[idVal])))
|
||||
family.unserialize(self.family_map.get(str(map[str(idVal)])))
|
||||
else:
|
||||
if self.family_map.has_key(idVal):
|
||||
if self.family_map.has_key(str(idVal)):
|
||||
family = self.new_family()
|
||||
else:
|
||||
family = self.new_family_no_map(idVal)
|
||||
map[idVal] = family.get_id()
|
||||
family = self.new_family_no_map(str(idVal))
|
||||
map[str(idVal)] = family.get_id()
|
||||
return family
|
||||
|
||||
def find_source_no_conflicts(self,idVal,map):
|
||||
|
Loading…
Reference in New Issue
Block a user