本文整理汇总了Python中gramps.gen.simple.SimpleAccess.child_in方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleAccess.child_in方法的具体用法?Python SimpleAccess.child_in怎么用?Python SimpleAccess.child_in使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gramps.gen.simple.SimpleAccess
的用法示例。
在下文中一共展示了SimpleAccess.child_in方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from gramps.gen.simple import SimpleAccess [as 别名]
# 或者: from gramps.gen.simple.SimpleAccess import child_in [as 别名]
def run(database, document, person):
"""
Loops through the families that the person is a child in, and display
the information about the other children.
"""
# setup the simple access functions
sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
stab = QuickTable(sdb)
rel_class = get_relationship_calculator(glocale)
# display the title
# feature request 2356: avoid genitive form
sdoc.title(_("Siblings of %s") % sdb.name(person))
sdoc.paragraph("")
stab.columns(_("Sibling"), _("Gender"), _("Birth Date"), _("Type"))
# grab our current id (self):
gid = sdb.gid(person)
# loop through each family in which the person is a child
document.has_data = False
for family in sdb.child_in(person):
# loop through each child in the family
for child in sdb.children(family):
# only display if this child is not the active person
if sdb.gid(child) != gid:
rel_str = rel_class.get_sibling_relationship_string(
rel_class.get_sibling_type(database, person, child),
person.get_gender(), child.get_gender())
else:
rel_str = _('self')
# pass row the child object to make link:
stab.row(child,
sdb.gender(child),
sdb.birth_or_fallback(child),
rel_str)
document.has_data = True
if document.has_data:
stab.write(sdoc)
else:
sdoc.header1(_("Not found") + "\n")