* src/RelLib.py: gramps id fixes.
* src/ReadXML.py: gramps id fixes. * src/plugins/ReadGedcom.py: gramps id fixes. svn: r3243
This commit is contained in:
parent
5976ec97ef
commit
11bc557be3
@ -7,6 +7,10 @@
|
|||||||
* src/plugins/WebPage.py (IndividualPage.write_urls):
|
* src/plugins/WebPage.py (IndividualPage.write_urls):
|
||||||
Add function; (IndividualPage.create_page): use write_urls().
|
Add function; (IndividualPage.create_page): use write_urls().
|
||||||
|
|
||||||
|
* src/RelLib.py: gramps id fixes.
|
||||||
|
* src/ReadXML.py: gramps id fixes.
|
||||||
|
* src/plugins/ReadGedcom.py: gramps id fixes.
|
||||||
|
|
||||||
2004-06-27 Don Allingham <dallingham@users.sourceforge.net>
|
2004-06-27 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
* src/gramps_main.py: fix import problem
|
* src/gramps_main.py: fix import problem
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ class GrampsParser:
|
|||||||
self.db.set_researcher(self.owner)
|
self.db.set_researcher(self.owner)
|
||||||
if self.tempDefault != None:
|
if self.tempDefault != None:
|
||||||
id = self.tempDefault
|
id = self.tempDefault
|
||||||
person = self.db.try_to_find_person_from_gramps_id(id)
|
person = self.db.find_person_from_gramps_id(id,self.trans)
|
||||||
if person:
|
if person:
|
||||||
self.db.set_default_person_id(person.get_id())
|
self.db.set_default_person_id(person.get_id())
|
||||||
|
|
||||||
@ -597,15 +597,15 @@ class GrampsParser:
|
|||||||
self.tempDefault = attrs["default"]
|
self.tempDefault = attrs["default"]
|
||||||
|
|
||||||
def start_father(self,attrs):
|
def start_father(self,attrs):
|
||||||
person = self.db.try_to_find_person_from_gramps_id(self.map_gid(attrs["ref"]))
|
person = self.db.find_person_from_gramps_id(self.map_gid(attrs["ref"]),self.trans)
|
||||||
self.family.set_father_id(person.get_id())
|
self.family.set_father_id(person.get_id())
|
||||||
|
|
||||||
def start_mother(self,attrs):
|
def start_mother(self,attrs):
|
||||||
person = self.db.try_to_find_person_from_gramps_id(self.map_gid(attrs["ref"]))
|
person = self.db.find_person_from_gramps_id(self.map_gid(attrs["ref"]),self.trans)
|
||||||
self.family.set_mother_id(person.get_id())
|
self.family.set_mother_id(person.get_id())
|
||||||
|
|
||||||
def start_child(self,attrs):
|
def start_child(self,attrs):
|
||||||
person = self.db.try_to_find_person_from_gramps_id(self.map_gid(attrs["ref"]))
|
person = self.db.find_person_from_gramps_id(self.map_gid(attrs["ref"]),self.trans)
|
||||||
self.family.add_child_id(person.get_id())
|
self.family.add_child_id(person.get_id())
|
||||||
|
|
||||||
def start_url(self,attrs):
|
def start_url(self,attrs):
|
||||||
|
@ -2984,17 +2984,20 @@ class GrampsDB:
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def try_to_find_person_from_gramps_id(self,val):
|
def find_person_from_gramps_id(self,val,trans):
|
||||||
"""finds a Person in the database from the passed gramps' ID.
|
"""finds a Person in the database from the passed gramps' ID.
|
||||||
If no such Person exists, a new Person is added to the database."""
|
If no such Person exists, a new Person is added to the database."""
|
||||||
|
|
||||||
|
person = Person()
|
||||||
data = self.idtrans.get(str(val))
|
data = self.idtrans.get(str(val))
|
||||||
if data:
|
if data:
|
||||||
person = Person()
|
|
||||||
person.unserialize(cPickle.loads(data))
|
person.unserialize(cPickle.loads(data))
|
||||||
return person
|
|
||||||
else:
|
else:
|
||||||
return None
|
intid = Utils.create_id()
|
||||||
|
person.set_id(intid)
|
||||||
|
person.set_gramps_id(val)
|
||||||
|
self.add_person_as(person,trans)
|
||||||
|
return person
|
||||||
|
|
||||||
def find_person_from_id(self,val,trans):
|
def find_person_from_id(self,val,trans):
|
||||||
"""finds a Person in the database from the passed gramps' ID.
|
"""finds a Person in the database from the passed gramps' ID.
|
||||||
|
@ -228,9 +228,9 @@ class GedcomParser:
|
|||||||
|
|
||||||
self.geddir = os.path.dirname(os.path.normpath(os.path.abspath(file)))
|
self.geddir = os.path.dirname(os.path.normpath(os.path.abspath(file)))
|
||||||
|
|
||||||
self.trans = string.maketrans('','')
|
self.transtable = string.maketrans('','')
|
||||||
self.delc = self.trans[0:31]
|
self.delc = self.transtable[0:31]
|
||||||
self.trans2 = self.trans[0:128] + ('?' * 128)
|
self.transtable2 = self.transtable[0:128] + ('?' * 128)
|
||||||
|
|
||||||
self.window = window
|
self.window = window
|
||||||
if window:
|
if window:
|
||||||
@ -334,14 +334,14 @@ class GedcomParser:
|
|||||||
if self.backoff == 0:
|
if self.backoff == 0:
|
||||||
next_line = self.f.readline()
|
next_line = self.f.readline()
|
||||||
try:
|
try:
|
||||||
self.text = string.translate(next_line.strip(),self.trans,self.delc)
|
self.text = string.translate(next_line.strip(),self.transtable,self.delc)
|
||||||
except:
|
except:
|
||||||
self.text = next_line.strip()
|
self.text = next_line.strip()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.text = self.cnv(self.text)
|
self.text = self.cnv(self.text)
|
||||||
except:
|
except:
|
||||||
self.text = string.translate(self.text,self.trans2)
|
self.text = string.translate(self.text,self.transtable2)
|
||||||
|
|
||||||
self.index += 1
|
self.index += 1
|
||||||
l = string.split(self.text, None, 2)
|
l = string.split(self.text, None, 2)
|
||||||
@ -552,7 +552,7 @@ class GedcomParser:
|
|||||||
return self.idswap[id]
|
return self.idswap[id]
|
||||||
|
|
||||||
def find_or_create_person(self,id):
|
def find_or_create_person(self,id):
|
||||||
person = self.db.try_to_find_person_from_gramps_id(self.map_gid(id))
|
person = self.db.find_person_from_gramps_id(self.map_gid(id),self.trans)
|
||||||
return person
|
return person
|
||||||
|
|
||||||
def parse_cause(self,event,level):
|
def parse_cause(self,event,level):
|
||||||
|
Loading…
Reference in New Issue
Block a user