def run(database, document, person): """ Loops through the person events and the family events of any family in which the person is a parent (to catch Marriage events), displaying the basic details of the event """ sdb = SimpleAccess(database) sdoc = SimpleDoc(document) stab = QuickTable(sdb) # get the personal events event_list = sdb.events(person) # get the events of each family in which the person is # a parent for family in sdb.parent_in(person): event_list += sdb.events(family) # Sort the events by their date event_list.sort(key=lambda x: x.get_date_object()) # display the results # feature request 2356: avoid genitive form sdoc.title(_("Sorted events of %s") % sdb.name(person)) sdoc.paragraph("") stab.columns(_("Event Type"), _("Event Date"), _("Event Place")) document.has_data = False for event in event_list: stab.row(event, sdb.event_date_obj(event), sdb.event_place(event)) document.has_data = True stab.write(sdoc)
def get_sources(database, person): """ Create list of sources for person's events """ sources = list() sa = SimpleAccess(database) events = sa.events(person) # Get family events also for family in sa.parent_in(person): for event in sa.events(family): events.append(event) for event in events: for handle in event.citation_list: citation = database.get_citation_from_handle(handle) page = citation.page source = database.get_source_from_handle(citation.source_handle) title = source.title author = source.author if author: source_desc = '* {}, {} - {}'.format(author, title, page) else: source_desc = '* {} - {}'.format(title, page) if source_desc not in sources: sources.append(source_desc) return sources
def get_sources(database, person): """ Create list of sources for person's events """ sources = list() sa = SimpleAccess(database) events = sa.events(person) # Get family events also for family in sa.parent_in(person): for event in sa.events(family): events.append(event) for event in events: for handle in event.citation_list: citation = database.get_citation_from_handle(handle) page = citation.page source = database.get_source_from_handle(citation.source_handle) title = source.title author = source.author if author: source_desc = '* {}, {} - {}'.format(author, title, page) else: source_desc = '* {} - {}'.format(title, page) if source_desc not in sources: sources.append(source_desc) return sources
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)
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)
def run(database, document, person): """ Loops through the person events and the family events of any family in which the person is a parent (to catch Marriage events), displaying the basic details of the event """ sdb = SimpleAccess(database) sdoc = SimpleDoc(document) stab = QuickTable(sdb) # get the personal events event_list = sdb.events(person) # get the events of each family in which the person is # a parent for family in sdb.parent_in(person): event_list += sdb.events(family) # Sort the events by their date event_list.sort(key=lambda x: x.get_date_object()) # display the results # feature request 2356: avoid genitive form sdoc.title(_("Sorted events of %s") % sdb.name(person)) sdoc.paragraph("") stab.columns(_("Event Type"), _("Event Date"), _("Event Place")) document.has_data = False for event in event_list: stab.row(event, sdb.event_date_obj(event), sdb.event_place(event)) document.has_data = True if document.has_data: stab.write(sdoc) else: sdoc.header1(_("Not found"))