本文整理汇总了Python中gramps.plugins.lib.libnarrate.Narrator.get_married_string方法的典型用法代码示例。如果您正苦于以下问题:Python Narrator.get_married_string方法的具体用法?Python Narrator.get_married_string怎么用?Python Narrator.get_married_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gramps.plugins.lib.libnarrate.Narrator
的用法示例。
在下文中一共展示了Narrator.get_married_string方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from gramps.plugins.lib.libnarrate import Narrator [as 别名]
# 或者: from gramps.plugins.lib.libnarrate.Narrator import get_married_string [as 别名]
def run(database, document, person):
"""
Output a text biography of active person
"""
sa = SimpleAccess(database)
sd = SimpleDoc(document)
sd.title("Biography for %s" % sa.name(person))
sd.paragraph('')
narrator = Narrator(database, verbose=True,
use_call_name=True, use_fulldate=True)
narrator.set_subject(person)
# Birth Details
text = narrator.get_born_string()
if text:
sd.paragraph(text)
text = narrator.get_baptised_string()
if text:
sd.paragraph(text)
text = narrator.get_christened_string()
if text:
sd.paragraph(text)
text = get_parents_desc(database, person)
if text:
sd.paragraph(text)
sd.paragraph('')
# Family Details
for family in sa.parent_in(person):
text = narrator.get_married_string(family)
if text:
sd.paragraph(text)
sd.paragraph('')
# Death Details
text = narrator.get_died_string(True)
if text:
sd.paragraph(text)
text = narrator.get_buried_string()
if text:
sd.paragraph(text)
sd.paragraph('')
# Sources
sd.header1('Sources')
for source in get_sources(database, person):
sd.paragraph(source)
示例2: DetDescendantReport
# 需要导入模块: from gramps.plugins.lib.libnarrate import Narrator [as 别名]
# 或者: from gramps.plugins.lib.libnarrate.Narrator import get_married_string [as 别名]
#.........这里部分代码省略.........
mother_mark = ReportUtils.get_person_mark(self.db, mother)
else:
mother_name = ""
mother_mark = ""
if father_handle:
father = self.db.get_person_from_handle(father_handle)
father_name = self._name_display.display_name(
father.get_primary_name())
father_mark = ReportUtils.get_person_mark(self.db, father)
else:
father_name = ""
father_mark = ""
text = self.__narrator.get_child_string(father_name, mother_name)
if text:
self.doc.write_text(text)
if father_mark:
self.doc.write_text("", father_mark)
if mother_mark:
self.doc.write_text("", mother_mark)
def write_marriage(self, person):
"""
Output marriage sentence.
"""
is_first = True
for family_handle in person.get_family_handle_list():
family = self.db.get_family_from_handle(family_handle)
spouse_handle = ReportUtils.find_spouse(person, family)
spouse = self.db.get_person_from_handle(spouse_handle)
text = ""
spouse_mark = ReportUtils.get_person_mark(self.db, spouse)
text = self.__narrator.get_married_string(family,
is_first,
self._name_display)
if text:
self.doc.write_text_citation(text, spouse_mark)
is_first = False
def __write_mate(self, person, family):
"""
Write information about the person's spouse/mate.
"""
if person.get_gender() == Person.MALE:
mate_handle = family.get_mother_handle()
else:
mate_handle = family.get_father_handle()
if mate_handle:
mate = self.db.get_person_from_handle(mate_handle)
self.doc.start_paragraph("DDR-MoreHeader")
name = self._name_display.display(mate)
if not name:
name = self._("Unknown")
mark = ReportUtils.get_person_mark(self.db, mate)
if family.get_relationship() == FamilyRelType.MARRIED:
self.doc.write_text(self._("Spouse: %s") % name, mark)
else:
self.doc.write_text(self._("Relationship with: %s")
% name, mark)
if name[-1:] != '.':
self.doc.write_text(".")
self.doc.write_text_citation(self.endnotes(mate))
示例3: DetAncestorReport
# 需要导入模块: from gramps.plugins.lib.libnarrate import Narrator [as 别名]
# 或者: from gramps.plugins.lib.libnarrate.Narrator import get_married_string [as 别名]
#.........这里部分代码省略.........
else:
mother_name = ""
mother_mark = ""
if father_handle:
father = self._db.get_person_from_handle(father_handle)
father_name = self._nd.display_name(father.get_primary_name())
father_mark = utils.get_person_mark(self._db, father)
else:
father_name = ""
father_mark = ""
text = self.__narrator.get_child_string(father_name, mother_name)
if text:
self.doc.write_text(text)
if father_mark:
self.doc.write_text("", father_mark)
if mother_mark:
self.doc.write_text("", mother_mark)
def write_marriage(self, person):
"""
Output marriage sentence.
"""
is_first = True
for family_handle in person.get_family_handle_list():
family = self._db.get_family_from_handle(family_handle)
spouse_handle = utils.find_spouse(person, family)
if spouse_handle:
spouse = self._db.get_person_from_handle(spouse_handle)
spouse_mark = utils.get_person_mark(self._db, spouse)
else:
spouse_mark = None
text = self.__narrator.get_married_string(family,
is_first,
self._nd)
if text:
self.doc.write_text_citation(text, spouse_mark)
if self.want_ids:
self.doc.write_text(' (%s)' % family.get_gramps_id())
is_first = False
def write_children(self, family):
"""
List children.
:param family: Family
:return:
"""
if not family.get_child_ref_list():
return
mother_handle = family.get_mother_handle()
if mother_handle:
mother = self._db.get_person_from_handle(mother_handle)
mother_name = self._nd.display(mother)
if not mother_name:
mother_name = self._("Unknown")
else:
mother_name = self._("Unknown")
father_handle = family.get_father_handle()
if father_handle:
father = self._db.get_person_from_handle(father_handle)
father_name = self._nd.display(father)
if not father_name: