本文整理汇总了Python中gramps.plugins.lib.libnarrate.Narrator.get_born_string方法的典型用法代码示例。如果您正苦于以下问题:Python Narrator.get_born_string方法的具体用法?Python Narrator.get_born_string怎么用?Python Narrator.get_born_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gramps.plugins.lib.libnarrate.Narrator
的用法示例。
在下文中一共展示了Narrator.get_born_string方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from gramps.plugins.lib.libnarrate import Narrator [as 别名]
# 或者: from gramps.plugins.lib.libnarrate.Narrator import get_born_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_born_string [as 别名]
#.........这里部分代码省略.........
if not child_name:
child_name = self._("Unknown")
child_mark = ReportUtils.get_person_mark(self.db, child)
if self.childref and self.prev_gen_handles.get(child_handle):
value = str(self.prev_gen_handles.get(child_handle))
child_name += " [%s]" % value
if self.inc_ssign:
prefix = " "
for family_handle in child.get_family_handle_list():
family = self.db.get_family_from_handle(family_handle)
if family.get_child_ref_list():
prefix = "+ "
break
else:
prefix = ""
if child_handle in self.dnumber:
self.doc.start_paragraph("DDR-ChildList",
prefix
+ str(self.dnumber[child_handle])
+ " "
+ ReportUtils.roman(cnt).lower()
+ ".")
else:
self.doc.start_paragraph("DDR-ChildList",
prefix + ReportUtils.roman(cnt).lower() + ".")
cnt += 1
self.doc.write_text("%s. " % child_name, child_mark)
self.__narrator.set_subject(child)
self.doc.write_text_citation(
self.__narrator.get_born_string() or
self.__narrator.get_christened_string() or
self.__narrator.get_baptised_string())
self.doc.write_text_citation(
self.__narrator.get_died_string() or
self.__narrator.get_buried_string())
self.doc.end_paragraph()
def __write_family_notes(self, family):
"""
Write the notes for the given family.
"""
notelist = family.get_note_list()
if len(notelist) > 0:
mother_name, father_name = self.__get_mate_names(family)
self.doc.start_paragraph("DDR-NoteHeader")
self.doc.write_text(
self._('Notes for %(mother_name)s and %(father_name)s:') % {
'mother_name' : mother_name,
'father_name' : father_name })
self.doc.end_paragraph()
for notehandle in notelist:
note = self.db.get_note_from_handle(notehandle)
self.doc.write_styled_note(note.get_styledtext(),
note.get_format(),"DDR-Entry")
def __write_family_events(self, family):
"""
List the events for the given family.
"""
if not family.get_event_ref_list():
return
示例3: AncestorReport
# 需要导入模块: from gramps.plugins.lib.libnarrate import Narrator [as 别名]
# 或者: from gramps.plugins.lib.libnarrate.Narrator import get_born_string [as 别名]
#.........这里部分代码省略.........
ref = [ c for c in family.get_child_ref_list()
if c.get_reference_handle() == person_handle]
if ref:
# If the father_handle is not defined and the relationship is
# BIRTH, then we have found the birth father. Same applies to
# the birth mother. If for some reason, the we have multiple
# people defined as the birth parents, we will select based on
# priority in the list
if not father_handle and \
ref[0].get_father_relation() == ChildRefType.BIRTH:
father_handle = family.get_father_handle()
if not mother_handle and \
ref[0].get_mother_relation() == ChildRefType.BIRTH:
mother_handle = family.get_mother_handle()
# Recursively call the function. It is okay if the handle is None,
# since routine handles a handle of None
self.apply_filter(father_handle, index*2, generation+1)
self.apply_filter(mother_handle, (index*2)+1, generation+1)
def write_report(self):
"""
The routine the actually creates the report. At this point, the document
is opened and ready for writing.
"""
# Call apply_filter to build the self.map array of people in the
# database that match the ancestry.
self.apply_filter(self.center_person.get_handle(), 1)
# Write the title line. Set in INDEX marker so that this section will be
# identified as a major category if this is included in a Book report.
name = self._name_display.display_formal(self.center_person)
# feature request 2356: avoid genitive form
title = self._("Ahnentafel Report for %s") % name
mark = IndexMark(title, INDEX_TYPE_TOC, 1)
self.doc.start_paragraph("AHN-Title")
self.doc.write_text(title, mark)
self.doc.end_paragraph()
# get the entries out of the map, and sort them.
generation = 0
for key in sorted(self.map):
# check the index number to see if we need to start a new generation
if generation == log2(key):
# generate a page break if requested
if self.pgbrk and generation > 0:
self.doc.page_break()
generation += 1
# Create the Generation title, set an index marker
gen_text = self._("Generation %d") % generation
mark = None # don't need any with no page breaks
if self.pgbrk:
mark = IndexMark(gen_text, INDEX_TYPE_TOC, 2)
self.doc.start_paragraph("AHN-Generation")
self.doc.write_text(gen_text, mark)
self.doc.end_paragraph()
# Build the entry
self.doc.start_paragraph("AHN-Entry","%d." % key)
person = self.database.get_person_from_handle(self.map[key])
name = self._name_display.display(person)
mark = ReportUtils.get_person_mark(self.database, person)
# write the name in bold
self.doc.start_bold()
self.doc.write_text(name.strip(), mark)
self.doc.end_bold()
# terminate with a period if it is not already terminated.
# This can happen if the person's name ends with something 'Jr.'
if name[-1:] == '.':
self.doc.write_text(" ")
else:
self.doc.write_text(". ")
# Add a line break if requested (not implemented yet)
if self.opt_namebrk:
self.doc.write_text('\n')
self.__narrator.set_subject(person)
self.doc.write_text(self.__narrator.get_born_string())
self.doc.write_text(self.__narrator.get_baptised_string())
self.doc.write_text(self.__narrator.get_christened_string())
self.doc.write_text(self.__narrator.get_died_string())
self.doc.write_text(self.__narrator.get_buried_string())
self.doc.end_paragraph()
示例4: DetAncestorReport
# 需要导入模块: from gramps.plugins.lib.libnarrate import Narrator [as 别名]
# 或者: from gramps.plugins.lib.libnarrate.Narrator import get_born_string [as 别名]
#.........这里部分代码省略.........
self.doc.start_paragraph("DAR-First-Entry", "%d." % self._get_s_s(key))
name = self._nd.display(person)
if not name:
name = self._("Unknown")
mark = utils.get_person_mark(self._db, person)
self.doc.start_bold()
self.doc.write_text(name, mark)
if name[-1:] == '.':
self.doc.write_text_citation("%s " % self.endnotes(person))
elif name:
self.doc.write_text_citation("%s. " % self.endnotes(person))
self.doc.end_bold()
if self.want_ids:
self.doc.write_text('(%s) ' % person.get_gramps_id())
if self.dupperson:
# Check for duplicate record (result of distant cousins marrying)
for dkey in sorted(self.map):
if dkey >= key:
break
if self.map[key] == self.map[dkey]:
self.doc.write_text(
self._("%(name)s is the same person as [%(id_str)s]."
) % {'name' : '', 'id_str' : str(dkey)})
self.doc.end_paragraph()
return 1 # Duplicate person
if not self.verbose:
self.write_parents(person)
text = self.__narrator.get_born_string()
if text:
self.doc.write_text_citation(text)
text = self.__narrator.get_baptised_string()
if text:
self.doc.write_text_citation(text)
text = self.__narrator.get_christened_string()
if text:
self.doc.write_text_citation(text)
text = self.__narrator.get_died_string(self.calcageflag)
if text:
self.doc.write_text_citation(text)
text = self.__narrator.get_buried_string()
if text:
self.doc.write_text_citation(text)
if self.verbose:
self.write_parents(person)
if not key % 2 or key == 1:
self.write_marriage(person)
self.doc.end_paragraph()
if key == 1:
self.write_mate(person)
notelist = person.get_note_list()
if len(notelist) > 0 and self.includenotes:
self.doc.start_paragraph("DAR-NoteHeader")