本文整理汇总了Python中gramps.gen.simple.SimpleAccess.surname方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleAccess.surname方法的具体用法?Python SimpleAccess.surname怎么用?Python SimpleAccess.surname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gramps.gen.simple.SimpleAccess
的用法示例。
在下文中一共展示了SimpleAccess.surname方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from gramps.gen.simple import SimpleAccess [as 别名]
# 或者: from gramps.gen.simple.SimpleAccess import surname [as 别名]
def run(database, document, person):
"""
Loops through the families that the person is a child in, and displays
the information about the other children.
"""
# setup the simple access functions
sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
stab = QuickTable(sdb)
if isinstance(person, Person):
surname = sdb.surname(person)
rsurname = person.get_primary_name().get_group_name()
else:
surname = person
rsurname = person
# display the title
sdoc.title(_("People sharing the surname '%s'") % surname)
sdoc.paragraph("")
stab.columns(_("Person"), _("Birth Date"), _("Name type"))
filter = GenericFilterFactory('Person')()
if rsurname != '':
rule = SameSurname([rsurname])
else:
rule = IncompleteSurname([])
filter.add_rule(rule)
people = filter.apply(database,
database.iter_person_handles())
matches = 0
for person_handle in people:
person = database.get_person_from_handle(person_handle)
stab.row(person, sdb.birth_or_fallback(person),
str(person.get_primary_name().get_type()))
matches += 1
document.has_data = matches > 0
sdoc.paragraph(
# translators: leave all/any {...} untranslated
ngettext("There is {number_of} person "
"with a matching name, or alternate name.\n",
"There are {number_of} people "
"with a matching name, or alternate name.\n", matches
).format(number_of=matches) )
stab.write(sdoc)