本文整理匯總了Python中gramps.gen.lib.Family.get_event_ref_list方法的典型用法代碼示例。如果您正苦於以下問題:Python Family.get_event_ref_list方法的具體用法?Python Family.get_event_ref_list怎麽用?Python Family.get_event_ref_list使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gramps.gen.lib.Family
的用法示例。
在下文中一共展示了Family.get_event_ref_list方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from gramps.gen.lib import Family [as 別名]
# 或者: from gramps.gen.lib.Family import get_event_ref_list [as 別名]
#.........這裏部分代碼省略.........
pref.set_relation(matches.groups()[0])
LOG.warning("TODO: Handle association types properly")
pref.set_reference_handle(asso_p.get_handle())
rel_person.add_person_ref(pref)
self.db.commit_person(rel_person,self.trans)
else:
LOG.warning("Invalid name of person in line %d" % self.lineno)
else:
LOG.warning("Invalid relationship in line %d" % self.lineno)
break
self.current_mode = None
return None
def read_source_line(self,line,fields):
if not self.current_family:
LOG.warning("Unknown family of child in line %d!" % self.lineno)
return None
source = self.get_or_create_source(self.decode(fields[1]))
self.current_family.add_citation(source.get_handle())
self.db.commit_family(self.current_family,self.trans)
return None
def read_witness_line(self,line,fields):
LOG.debug("Witness:")
if fields[1] == "m:":
(idx,wit_p) = self.parse_person(fields,2,Person.MALE,None)
elif fields[1] == "f:":
(idx,wit_p) = self.parse_person(fields,2,Person.FEMALE,None)
else:
(idx,wit_p) = self.parse_person(fields,1,None,None)
if wit_p:
mev = None
# search marriage event
for evr in self.current_family.get_event_ref_list():
ev = self.db.get_event_from_handle(evr.get_reference_handle())
if ev.get_type() == EventType.MARRIAGE:
mev = ev # found.
if not mev: # No marriage event found create a new one
mev = self.create_event(EventType.MARRIAGE, None, None, None, None)
mar_ref = EventRef()
mar_ref.set_reference_handle(mev.get_handle())
self.current_family.add_event_ref(mar_ref)
wit_ref = EventRef()
wit_ref.set_role(EventRoleType(EventRoleType.WITNESS))
wit_ref.set_reference_handle(mev.get_handle())
wit_p.add_event_ref(wit_ref)
self.db.commit_person(wit_p,self.trans)
return None
def read_children_lines(self):
father_surname = "Dummy"
if not self.current_husband_handle:
LOG.warning("Unknown father for child in line %d!" % self.lineno)
return None
husb = self.db.get_person_from_handle(self.current_husband_handle)
father_surname = husb.get_primary_name().get_surname()
if not self.current_family:
LOG.warning("Unknown family of child in line %d!" % self.lineno)
return None
while 1:
line = self.get_next_line()
if line is None:
break
if line == "":
continue