本文整理汇总了Python中gramps.plugins.lib.libnarrate.Narrator.get_child_string方法的典型用法代码示例。如果您正苦于以下问题:Python Narrator.get_child_string方法的具体用法?Python Narrator.get_child_string怎么用?Python Narrator.get_child_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gramps.plugins.lib.libnarrate.Narrator
的用法示例。
在下文中一共展示了Narrator.get_child_string方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_parents_desc
# 需要导入模块: from gramps.plugins.lib.libnarrate import Narrator [as 别名]
# 或者: from gramps.plugins.lib.libnarrate.Narrator import get_child_string [as 别名]
def get_parents_desc(database, person):
"""
Return text describing person's parents
"""
sa = SimpleAccess(database)
narrator = Narrator(database, verbose=True,
use_call_name=True, use_fulldate=True)
narrator.set_subject(person)
family_handle = person.get_main_parents_family_handle()
if family_handle:
family = database.get_family_from_handle(family_handle)
mother_handle = family.get_mother_handle()
father_handle = family.get_father_handle()
if mother_handle:
mother = database.get_person_from_handle(mother_handle)
mother_name = sa.name(mother)
else:
mother_name = ""
if father_handle:
father = database.get_person_from_handle(father_handle)
father_name = sa.name(father)
else:
father_name = ""
return narrator.get_child_string(father_name, mother_name)
示例2: DetDescendantReport
# 需要导入模块: from gramps.plugins.lib.libnarrate import Narrator [as 别名]
# 或者: from gramps.plugins.lib.libnarrate.Narrator import get_child_string [as 别名]
#.........这里部分代码省略.........
if self.inc_notes:
# if the event or event reference has a note attached to it,
# get the text and format it correctly
notelist = event.get_note_list()
notelist.extend(event_ref.get_note_list())
for notehandle in notelist:
note = self.db.get_note_from_handle(notehandle)
self.doc.write_styled_note(note.get_styledtext(),
note.get_format(),"DDR-MoreDetails",
contains_html= note.get_type() == NoteType.HTML_CODE)
def __write_parents(self, person):
family_handle = person.get_main_parents_family_handle()
if family_handle:
family = self.db.get_family_from_handle(family_handle)
mother_handle = family.get_mother_handle()
father_handle = family.get_father_handle()
if mother_handle:
mother = self.db.get_person_from_handle(mother_handle)
mother_name = self._name_display.display_name(
mother.get_primary_name())
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.
"""
示例3: DetAncestorReport
# 需要导入模块: from gramps.plugins.lib.libnarrate import Narrator [as 别名]
# 或者: from gramps.plugins.lib.libnarrate.Narrator import get_child_string [as 别名]
#.........这里部分代码省略.........
notelist = event.get_note_list()
notelist.extend(event_ref.get_note_list())
for notehandle in notelist:
note = self._db.get_note_from_handle(notehandle)
self.doc.write_styled_note(
note.get_styledtext(),
note.get_format(),
"DAR-MoreDetails",
contains_html=(note.get_type() == NoteType.HTML_CODE)
)
def write_parents(self, person):
""" write the parents """
family_handle = person.get_main_parents_family_handle()
if family_handle:
family = self._db.get_family_from_handle(family_handle)
mother_handle = family.get_mother_handle()
father_handle = family.get_father_handle()
if mother_handle:
mother = self._db.get_person_from_handle(mother_handle)
mother_name = self._nd.display_name(mother.get_primary_name())
mother_mark = utils.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._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):
"""