Handle ChildRefType on XML import
svn: r6344
This commit is contained in:
parent
4f42564b0b
commit
f3dbd3471b
@ -1,3 +1,7 @@
|
|||||||
|
2006-04-14 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/GrampsDb/_ReadXML.py: handle ChildRefType
|
||||||
|
* src/GrampsDb/_ConstXML.py: remove unused map
|
||||||
|
|
||||||
2006-04-14 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
2006-04-14 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||||
* src/DataViews/_PedigreeView.py: Fix ChildRef, Show person references
|
* src/DataViews/_PedigreeView.py: Fix ChildRef, Show person references
|
||||||
* src/Editors/_EditFamily.py: Typo
|
* src/Editors/_EditFamily.py: Typo
|
||||||
|
@ -32,15 +32,6 @@ import RelLib
|
|||||||
# Collection of standard types for various kinds of objects
|
# Collection of standard types for various kinds of objects
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
child_relations = (
|
|
||||||
(RelLib.ChildRefType.BIRTH , "Birth"),
|
|
||||||
(RelLib.ChildRefType.ADOPTED , "Adopted"),
|
|
||||||
(RelLib.ChildRefType.STEPCHILD , "Stepchild"),
|
|
||||||
(RelLib.ChildRefType.SPONSORED , "Sponsored"),
|
|
||||||
(RelLib.ChildRefType.FOSTER , "Foster"),
|
|
||||||
(RelLib.ChildRefType.UNKNOWN , "Unknown"),
|
|
||||||
)
|
|
||||||
|
|
||||||
events = (
|
events = (
|
||||||
# Family events
|
# Family events
|
||||||
(RelLib.Event.UNKNOWN , "Unknown"),
|
(RelLib.Event.UNKNOWN , "Unknown"),
|
||||||
@ -175,7 +166,6 @@ url_types = (
|
|||||||
|
|
||||||
# mapping from the tuple collection to the appropriate CUSTOM integer
|
# mapping from the tuple collection to the appropriate CUSTOM integer
|
||||||
custom_types = {
|
custom_types = {
|
||||||
child_relations : RelLib.ChildRefType.CUSTOM,
|
|
||||||
events : RelLib.Event.CUSTOM,
|
events : RelLib.Event.CUSTOM,
|
||||||
attributes : RelLib.Attribute.CUSTOM,
|
attributes : RelLib.Attribute.CUSTOM,
|
||||||
family_relations : RelLib.Family.CUSTOM,
|
family_relations : RelLib.Family.CUSTOM,
|
||||||
|
@ -77,6 +77,15 @@ except:
|
|||||||
|
|
||||||
personRE = re.compile(r"\s*\<person\s(.*)$")
|
personRE = re.compile(r"\s*\<person\s(.*)$")
|
||||||
|
|
||||||
|
crel_map = {
|
||||||
|
"Birth" : RelLib.ChildRefType(RelLib.ChildRefType.BIRTH),
|
||||||
|
"Adopted" : RelLib.ChildRefType(RelLib.ChildRefType.ADOPTED),
|
||||||
|
"Stepchild" : RelLib.ChildRefType(RelLib.ChildRefType.STEPCHILD),
|
||||||
|
"Sponsored" : RelLib.ChildRefType(RelLib.ChildRefType.SPONSORED),
|
||||||
|
"Foster" : RelLib.ChildRefType(RelLib.ChildRefType.FOSTER),
|
||||||
|
"Unknown" : RelLib.ChildRefType(RelLib.ChildRefType.UNKNOWN),
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Importing data into the currently open database.
|
# Importing data into the currently open database.
|
||||||
@ -912,13 +921,11 @@ class GrampsParser:
|
|||||||
family = self.find_family_by_gramps_id(self.map_fid(attrs["ref"]))
|
family = self.find_family_by_gramps_id(self.map_fid(attrs["ref"]))
|
||||||
handle = family.handle
|
handle = family.handle
|
||||||
|
|
||||||
mrel = _ConstXML.tuple_from_xml(_ConstXML.child_relations,
|
mrel = crel_map.get(attrs.get('mrel'),RelLib.ChildRefType())
|
||||||
attrs.get('mrel','Birth'))
|
frel = crel_map.get(attrs.get('frel'),RelLib.ChildRefType())
|
||||||
frel = _ConstXML.tuple_from_xml(_ConstXML.child_relations,
|
|
||||||
attrs.get('frel','Birth'))
|
|
||||||
|
|
||||||
if mrel != RelLib.ChildRefType.CHILD_BIRTH or \
|
if mrel != RelLib.ChildRefType.BIRTH or \
|
||||||
frel != RelLib.ChildRefType.CHILD_BIRTH:
|
frel != RelLib.ChildRefType.BIRTH:
|
||||||
childref = RelLib.ChildRef()
|
childref = RelLib.ChildRef()
|
||||||
childref.ref = self.person.handle
|
childref.ref = self.person.handle
|
||||||
childref.set_mother_relation(mrel)
|
childref.set_mother_relation(mrel)
|
||||||
@ -938,8 +945,8 @@ class GrampsParser:
|
|||||||
def start_name(self,attrs):
|
def start_name(self,attrs):
|
||||||
if not self.in_witness:
|
if not self.in_witness:
|
||||||
self.name = RelLib.Name()
|
self.name = RelLib.Name()
|
||||||
self.name.type =_ConstXML.tuple_from_xml(
|
self.name.type.set(_ConstXML.tuple_from_xml(
|
||||||
_ConstXML.name_types,attrs.get('type','Birth Name'))
|
_ConstXML.name_types,attrs.get('type','Birth Name')))
|
||||||
self.name.sort_as = int(attrs.get("sort",RelLib.Name.DEF))
|
self.name.sort_as = int(attrs.get("sort",RelLib.Name.DEF))
|
||||||
self.name.display_as = int(attrs.get("display",RelLib.Name.DEF))
|
self.name.display_as = int(attrs.get("display",RelLib.Name.DEF))
|
||||||
self.name.conf = int(attrs.get("conf",2))
|
self.name.conf = int(attrs.get("conf",2))
|
||||||
|
Loading…
Reference in New Issue
Block a user