Cleanup libnarrate.
svn: r13487
This commit is contained in:
parent
99499779dc
commit
3141ed0e71
@ -2,7 +2,7 @@
|
|||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||||
# Copyright (C) 2007-2008 Brian G. Matherly
|
# Copyright (C) 2007-2009 Brian G. Matherly
|
||||||
# Copyright (C) 2008 James Friedmann <jfriedmannj@gmail.com>
|
# Copyright (C) 2008 James Friedmann <jfriedmannj@gmail.com>
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -194,37 +194,6 @@ def get_death_or_fallback(database, person):
|
|||||||
return event
|
return event
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def old_calc_age(database, person):
|
|
||||||
"""
|
|
||||||
Calculate age.
|
|
||||||
|
|
||||||
Returns a date difference span.
|
|
||||||
"""
|
|
||||||
birth_ref = person.get_birth_ref()
|
|
||||||
if birth_ref:
|
|
||||||
birth = database.get_event_from_handle(birth_ref.ref).get_date_object()
|
|
||||||
birth_year_valid = birth.get_year_valid()
|
|
||||||
else:
|
|
||||||
birth_year_valid = None
|
|
||||||
death_ref = person.get_death_ref()
|
|
||||||
if death_ref:
|
|
||||||
death = database.get_event_from_handle(death_ref.ref).get_date_object()
|
|
||||||
death_year_valid = death.get_year_valid()
|
|
||||||
else:
|
|
||||||
death_year_valid = None
|
|
||||||
|
|
||||||
# wihtout at least a year for each event we're clueless
|
|
||||||
if not (birth_year_valid and death_year_valid):
|
|
||||||
return None
|
|
||||||
|
|
||||||
return death - birth
|
|
||||||
|
|
||||||
def common_name(person, use_call=False):
|
|
||||||
if use_call and person.get_primary_name().get_call_name():
|
|
||||||
return person.get_primary_name().get_call_name()
|
|
||||||
else:
|
|
||||||
return person.get_primary_name().get_first_name()
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Indexing function
|
# Indexing function
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||||
# Copyright (C) 2007-2008 Brian G. Matherly
|
# Copyright (C) 2007-2009 Brian G. Matherly
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -218,16 +218,11 @@ class AncestorReport(Report):
|
|||||||
if self.opt_namebrk:
|
if self.opt_namebrk:
|
||||||
self.doc.write_text('\n')
|
self.doc.write_text('\n')
|
||||||
|
|
||||||
# Write the birth, death, and buried strings by calling the standard
|
self.__narrator.set_subject(person)
|
||||||
# functions in ReportUtils
|
self.doc.write_text(self.__narrator.get_born_string())
|
||||||
|
self.doc.write_text(self.__narrator.get_baptized_string())
|
||||||
primary_name = person.get_primary_name()
|
self.doc.write_text(self.__narrator.get_died_string())
|
||||||
first = primary_name.get_first_name()
|
self.doc.write_text(self.__narrator.get_buried_string())
|
||||||
|
|
||||||
self.doc.write_text(self.__narrator.born_str(person, first))
|
|
||||||
self.doc.write_text(self.__narrator.baptised_str( person, 0))
|
|
||||||
self.doc.write_text(self.__narrator.died_str(person, 0))
|
|
||||||
self.doc.write_text(self.__narrator.buried_str(person, 0))
|
|
||||||
|
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2000-2002 Bruce J. DeGrasse
|
# Copyright (C) 2000-2002 Bruce J. DeGrasse
|
||||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||||
# Copyright (C) 2007-2008 Brian G. Matherly
|
# Copyright (C) 2007-2009 Brian G. Matherly
|
||||||
# Copyright (C) 2008 James Friedmann <jfriedmannj@gmail.com>
|
# Copyright (C) 2008 James Friedmann <jfriedmannj@gmail.com>
|
||||||
# Copyright (C) 2009 Benny Malengier <benny.malengier@gramps-project.org>
|
# Copyright (C) 2009 Benny Malengier <benny.malengier@gramps-project.org>
|
||||||
#
|
#
|
||||||
@ -104,7 +104,7 @@ class DetAncestorReport(Report):
|
|||||||
self.fulldate = menu.get_option_by_name('fulldates').get_value()
|
self.fulldate = menu.get_option_by_name('fulldates').get_value()
|
||||||
self.listchildren = menu.get_option_by_name('listc').get_value()
|
self.listchildren = menu.get_option_by_name('listc').get_value()
|
||||||
self.includenotes = menu.get_option_by_name('incnotes').get_value()
|
self.includenotes = menu.get_option_by_name('incnotes').get_value()
|
||||||
self.usecall = menu.get_option_by_name('usecall').get_value()
|
use_call = menu.get_option_by_name('usecall').get_value()
|
||||||
blankplace = menu.get_option_by_name('repplace').get_value()
|
blankplace = menu.get_option_by_name('repplace').get_value()
|
||||||
blankdate = menu.get_option_by_name('repdate').get_value()
|
blankdate = menu.get_option_by_name('repdate').get_value()
|
||||||
self.calcageflag = menu.get_option_by_name('computeage').get_value()
|
self.calcageflag = menu.get_option_by_name('computeage').get_value()
|
||||||
@ -136,12 +136,12 @@ class DetAncestorReport(Report):
|
|||||||
else:
|
else:
|
||||||
empty_place = ""
|
empty_place = ""
|
||||||
|
|
||||||
self.__narrator = Narrator(self.database, self.verbose,
|
self.__narrator = Narrator(self.database, self.verbose, use_call,
|
||||||
empty_date, empty_place)
|
empty_date, empty_place, self.endnotes)
|
||||||
|
|
||||||
self.bibli = Bibliography(Bibliography.MODE_PAGE)
|
self.bibli = Bibliography(Bibliography.MODE_PAGE)
|
||||||
|
|
||||||
def apply_filter(self,person_handle,index):
|
def apply_filter(self, person_handle, index):
|
||||||
if (not person_handle) or (index >= 2**self.max_generations):
|
if (not person_handle) or (index >= 2**self.max_generations):
|
||||||
return
|
return
|
||||||
self.map[index] = person_handle
|
self.map[index] = person_handle
|
||||||
@ -150,21 +150,20 @@ class DetAncestorReport(Report):
|
|||||||
family_handle = person.get_main_parents_family_handle()
|
family_handle = person.get_main_parents_family_handle()
|
||||||
if family_handle:
|
if family_handle:
|
||||||
family = self.database.get_family_from_handle(family_handle)
|
family = self.database.get_family_from_handle(family_handle)
|
||||||
self.apply_filter(family.get_father_handle(),index*2)
|
self.apply_filter(family.get_father_handle(), index*2)
|
||||||
self.apply_filter(family.get_mother_handle(),(index*2)+1)
|
self.apply_filter(family.get_mother_handle(), (index*2)+1)
|
||||||
|
|
||||||
def write_report(self):
|
def write_report(self):
|
||||||
self.apply_filter(self.center_person.get_handle(),1)
|
self.apply_filter(self.center_person.get_handle(), 1)
|
||||||
|
|
||||||
name = _nd.display_name(self.center_person.get_primary_name())
|
name = _nd.display_name(self.center_person.get_primary_name())
|
||||||
self.doc.start_paragraph("DAR-Title")
|
self.doc.start_paragraph("DAR-Title")
|
||||||
title = _("Ancestral Report for %s") % name
|
title = _("Ancestral Report for %s") % name
|
||||||
mark = IndexMark(title,INDEX_TYPE_TOC,1)
|
mark = IndexMark(title, INDEX_TYPE_TOC, 1)
|
||||||
self.doc.write_text(title,mark)
|
self.doc.write_text(title, mark)
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
generation = 0
|
generation = 0
|
||||||
need_header = 1
|
|
||||||
|
|
||||||
for key in sorted(self.map):
|
for key in sorted(self.map):
|
||||||
if generation == 0 or key >= 2**generation:
|
if generation == 0 or key >= 2**generation:
|
||||||
@ -209,10 +208,11 @@ class DetAncestorReport(Report):
|
|||||||
person_handle = self.map[key]
|
person_handle = self.map[key]
|
||||||
person = self.database.get_person_from_handle(person_handle)
|
person = self.database.get_person_from_handle(person_handle)
|
||||||
plist = person.get_media_list()
|
plist = person.get_media_list()
|
||||||
|
self.__narrator.set_subject(person)
|
||||||
|
|
||||||
if self.addimages and len(plist) > 0:
|
if self.addimages and len(plist) > 0:
|
||||||
photo = plist[0]
|
photo = plist[0]
|
||||||
ReportUtils.insert_image(self.database,self.doc,photo)
|
ReportUtils.insert_image(self.database, self.doc, photo)
|
||||||
|
|
||||||
self.doc.start_paragraph("DAR-First-Entry","%s." % str(key))
|
self.doc.start_paragraph("DAR-First-Entry","%s." % str(key))
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ class DetAncestorReport(Report):
|
|||||||
mark = ReportUtils.get_person_mark(self.database, person)
|
mark = ReportUtils.get_person_mark(self.database, person)
|
||||||
|
|
||||||
self.doc.start_bold()
|
self.doc.start_bold()
|
||||||
self.doc.write_text(name,mark)
|
self.doc.write_text(name, mark)
|
||||||
if name[-1:] == '.':
|
if name[-1:] == '.':
|
||||||
self.doc.write_text_citation("%s " % self.endnotes(person))
|
self.doc.write_text_citation("%s " % self.endnotes(person))
|
||||||
else:
|
else:
|
||||||
@ -238,51 +238,32 @@ class DetAncestorReport(Report):
|
|||||||
{ 'name' : '', 'id_str' : str(dkey) })
|
{ 'name' : '', 'id_str' : str(dkey) })
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
return 1 # Duplicate person
|
return 1 # Duplicate person
|
||||||
|
|
||||||
# Check birth record
|
|
||||||
|
|
||||||
first = ReportUtils.common_name(person,self.usecall)
|
|
||||||
|
|
||||||
if not self.verbose:
|
if not self.verbose:
|
||||||
self.write_parents(person, first)
|
self.write_parents(person)
|
||||||
|
|
||||||
text = self.__narrator.born_str(person, first)
|
text = self.__narrator.get_born_string()
|
||||||
if text:
|
if text:
|
||||||
birth_ref = person.get_birth_ref()
|
|
||||||
if birth_ref:
|
|
||||||
birth = self.database.get_event_from_handle(birth_ref.ref)
|
|
||||||
text = text.rstrip(". ")
|
|
||||||
text = text + self.endnotes(birth) + ". "
|
|
||||||
self.doc.write_text_citation(text)
|
self.doc.write_text_citation(text)
|
||||||
first = 0
|
|
||||||
|
|
||||||
text = self.__narrator.baptised_str(person, first, self.endnotes)
|
text = self.__narrator.get_baptized_string()
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text_citation(text)
|
self.doc.write_text_citation(text)
|
||||||
|
|
||||||
text = self.__narrator.christened_str(person, first, self.endnotes)
|
text = self.__narrator.get_christened_string()
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text_citation(text)
|
self.doc.write_text_citation(text)
|
||||||
|
|
||||||
span = self.calc_age(person)
|
text = self.__narrator.get_died_string(self.calcageflag)
|
||||||
text = self.__narrator.died_str(person, first, span)
|
|
||||||
if text:
|
|
||||||
death_ref = person.get_death_ref()
|
|
||||||
if death_ref:
|
|
||||||
death = self.database.get_event_from_handle(death_ref.ref)
|
|
||||||
text = text.rstrip(". ")
|
|
||||||
text = text + self.endnotes(death) + ". "
|
|
||||||
self.doc.write_text_citation(text)
|
|
||||||
first = 0
|
|
||||||
|
|
||||||
text = self.__narrator.buried_str(person, first, self.endnotes)
|
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text_citation(text)
|
self.doc.write_text_citation(text)
|
||||||
|
|
||||||
first = ReportUtils.common_name(person, self.usecall)
|
text = self.__narrator.get_buried_string()
|
||||||
|
if text:
|
||||||
|
self.doc.write_text_citation(text)
|
||||||
|
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
self.write_parents(person, first)
|
self.write_parents(person)
|
||||||
|
|
||||||
if not key % 2 or key == 1:
|
if not key % 2 or key == 1:
|
||||||
self.write_marriage(person)
|
self.write_marriage(person)
|
||||||
@ -437,7 +418,7 @@ class DetAncestorReport(Report):
|
|||||||
self.doc.write_styled_note(note.get_styledtext(),
|
self.doc.write_styled_note(note.get_styledtext(),
|
||||||
note.get_format(),"DAR-MoreDetails")
|
note.get_format(),"DAR-MoreDetails")
|
||||||
|
|
||||||
def write_parents(self, person, firstName):
|
def write_parents(self, person):
|
||||||
family_handle = person.get_main_parents_family_handle()
|
family_handle = person.get_main_parents_family_handle()
|
||||||
if family_handle:
|
if family_handle:
|
||||||
family = self.database.get_family_from_handle(family_handle)
|
family = self.database.get_family_from_handle(family_handle)
|
||||||
@ -458,14 +439,13 @@ class DetAncestorReport(Report):
|
|||||||
father_name = ""
|
father_name = ""
|
||||||
father_mark = ""
|
father_mark = ""
|
||||||
|
|
||||||
text = self.__narrator.child_str(person, father_name, mother_name,
|
text = self.__narrator.get_child_string(father_name, mother_name)
|
||||||
firstName)
|
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text(text)
|
self.doc.write_text(text)
|
||||||
if father_mark:
|
if father_mark:
|
||||||
self.doc.write_text("",father_mark)
|
self.doc.write_text("", father_mark)
|
||||||
if mother_mark:
|
if mother_mark:
|
||||||
self.doc.write_text("",mother_mark)
|
self.doc.write_text("", mother_mark)
|
||||||
|
|
||||||
def write_marriage(self, person):
|
def write_marriage(self, person):
|
||||||
"""
|
"""
|
||||||
@ -479,8 +459,7 @@ class DetAncestorReport(Report):
|
|||||||
text = ""
|
text = ""
|
||||||
spouse_mark = ReportUtils.get_person_mark(self.database, spouse)
|
spouse_mark = ReportUtils.get_person_mark(self.database, spouse)
|
||||||
|
|
||||||
text = self.__narrator.married_str(person, family, self.endnotes,
|
text = self.__narrator.get_married_string(family, is_first)
|
||||||
is_first)
|
|
||||||
|
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text_citation(text, spouse_mark)
|
self.doc.write_text_citation(text, spouse_mark)
|
||||||
@ -519,22 +498,24 @@ class DetAncestorReport(Report):
|
|||||||
child_handle = child_ref.ref
|
child_handle = child_ref.ref
|
||||||
child = self.database.get_person_from_handle(child_handle)
|
child = self.database.get_person_from_handle(child_handle)
|
||||||
child_name = _nd.display(child)
|
child_name = _nd.display(child)
|
||||||
child_mark = ReportUtils.get_person_mark(self.database,child)
|
child_mark = ReportUtils.get_person_mark(self.database, child)
|
||||||
|
|
||||||
if self.childref and self.prev_gen_handles.get(child_handle):
|
if self.childref and self.prev_gen_handles.get(child_handle):
|
||||||
value = str(self.prev_gen_handles.get(child_handle))
|
value = str(self.prev_gen_handles.get(child_handle))
|
||||||
child_name += " [%s]" % value
|
child_name += " [%s]" % value
|
||||||
|
|
||||||
self.doc.start_paragraph("DAR-ChildList",ReportUtils.roman(cnt).lower() + ".")
|
self.doc.start_paragraph("DAR-ChildList",
|
||||||
|
ReportUtils.roman(cnt).lower() + ".")
|
||||||
cnt += 1
|
cnt += 1
|
||||||
|
|
||||||
self.doc.write_text("%s. " % child_name,child_mark)
|
self.__narrator.set_subject(child)
|
||||||
self.doc.write_text(self.__narrator.born_str(child))
|
self.doc.write_text("%s. " % child_name, child_mark)
|
||||||
self.doc.write_text(self.__narrator.died_str(child))
|
self.doc.write_text(self.__narrator.get_born_string())
|
||||||
|
self.doc.write_text(self.__narrator.get_died_string())
|
||||||
|
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
def write_family_events(self,family):
|
def write_family_events(self, family):
|
||||||
|
|
||||||
if not family.get_event_ref_list():
|
if not family.get_event_ref_list():
|
||||||
return
|
return
|
||||||
@ -620,61 +601,32 @@ class DetAncestorReport(Report):
|
|||||||
|
|
||||||
self.doc.start_paragraph("DAR-Entry")
|
self.doc.start_paragraph("DAR-Entry")
|
||||||
|
|
||||||
first_name = ReportUtils.common_name(ind, self.usecall)
|
self.__narrator.set_subject(ind)
|
||||||
print_name = first_name
|
|
||||||
|
|
||||||
text = self.__narrator.born_str(ind, print_name)
|
text = self.__narrator.get_born_string()
|
||||||
if text:
|
|
||||||
self.doc.write_text(text)
|
|
||||||
print_name = 0
|
|
||||||
|
|
||||||
text = self.__narrator.baptised_str(ind, print_name,
|
|
||||||
self.endnotes)
|
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text_citation(text)
|
self.doc.write_text_citation(text)
|
||||||
print_name = 0
|
|
||||||
|
|
||||||
text = self.__narrator.christened_str(ind, print_name,
|
text = self.__narrator.get_baptized_string()
|
||||||
self.endnotes)
|
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text_citation(text)
|
self.doc.write_text_citation(text)
|
||||||
print_name = 0
|
|
||||||
|
|
||||||
span = self.calc_age(ind)
|
text = self.__narrator.get_christened_string()
|
||||||
text = self.__narrator.died_str(ind, print_name, span)
|
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text(text)
|
self.doc.write_text_citation(text)
|
||||||
print_name = 0
|
|
||||||
|
text = self.__narrator.get_died_string(self.calcageflag)
|
||||||
text = self.__narrator.buried_str(ind, print_name,
|
if text:
|
||||||
self.endnotes)
|
self.doc.write_text_citation(text)
|
||||||
|
|
||||||
|
text = self.__narrator.get_buried_string()
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text_citation(text)
|
self.doc.write_text_citation(text)
|
||||||
print_name = 0
|
|
||||||
|
|
||||||
if print_name == 0:
|
self.write_parents(ind)
|
||||||
print_name = first_name
|
|
||||||
self.write_parents(ind, print_name)
|
|
||||||
|
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
def calc_age(self,ind):
|
|
||||||
"""
|
|
||||||
Calulate age.
|
|
||||||
|
|
||||||
Returns a tuple (age,units) where units is an integer representing
|
|
||||||
time units:
|
|
||||||
no age info: 0
|
|
||||||
years: 1
|
|
||||||
months: 2
|
|
||||||
days: 3
|
|
||||||
"""
|
|
||||||
if self.calcageflag:
|
|
||||||
return ReportUtils.old_calc_age(self.database,ind)
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def endnotes(self, obj):
|
def endnotes(self, obj):
|
||||||
if not obj or not self.inc_sources:
|
if not obj or not self.inc_sources:
|
||||||
return ""
|
return ""
|
||||||
@ -729,8 +681,8 @@ class DetAncestorOptions(MenuReportOptions):
|
|||||||
listc.set_help(_("Whether to list children."))
|
listc.set_help(_("Whether to list children."))
|
||||||
menu.add_option(category_name,"listc",listc)
|
menu.add_option(category_name,"listc",listc)
|
||||||
|
|
||||||
computeage = BooleanOption(_("Compute age"),True)
|
computeage = BooleanOption(_("Compute death age"),True)
|
||||||
computeage.set_help(_("Whether to compute age."))
|
computeage.set_help(_("Whether to compute a person's age at death."))
|
||||||
menu.add_option(category_name,"computeage",computeage)
|
menu.add_option(category_name,"computeage",computeage)
|
||||||
|
|
||||||
omitda = BooleanOption(_("Omit duplicate ancestors"),True)
|
omitda = BooleanOption(_("Omit duplicate ancestors"),True)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright (C) 2000-2002 Bruce J. DeGrasse
|
# Copyright (C) 2000-2002 Bruce J. DeGrasse
|
||||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||||
# Copyright (C) 2007-2008 Brian G. Matherly
|
# Copyright (C) 2007-2009 Brian G. Matherly
|
||||||
# Copyright (C) 2007 Robert Cawley <rjc@cawley.id.au>
|
# Copyright (C) 2007 Robert Cawley <rjc@cawley.id.au>
|
||||||
# Copyright (C) 2008-2009 James Friedmann <jfriedmannj@gmail.com>
|
# Copyright (C) 2008-2009 James Friedmann <jfriedmannj@gmail.com>
|
||||||
# Copyright (C) 2009 Benny Malengier <benny.malengier@gramps-project.org>
|
# Copyright (C) 2009 Benny Malengier <benny.malengier@gramps-project.org>
|
||||||
@ -50,7 +50,6 @@ from gen.plug.docgen import (IndexMark, FontStyle, ParagraphStyle,
|
|||||||
from ReportBase import (Report, ReportUtils, MenuReportOptions,
|
from ReportBase import (Report, ReportUtils, MenuReportOptions,
|
||||||
Bibliography, Endnotes)
|
Bibliography, Endnotes)
|
||||||
import DateHandler
|
import DateHandler
|
||||||
import Utils
|
|
||||||
|
|
||||||
from libnarrate import Narrator
|
from libnarrate import Narrator
|
||||||
|
|
||||||
@ -110,7 +109,7 @@ class DetDescendantReport(Report):
|
|||||||
self.fulldate = menu.get_option_by_name('fulldates').get_value()
|
self.fulldate = menu.get_option_by_name('fulldates').get_value()
|
||||||
self.listchildren = menu.get_option_by_name('listc').get_value()
|
self.listchildren = menu.get_option_by_name('listc').get_value()
|
||||||
self.inc_notes = menu.get_option_by_name('incnotes').get_value()
|
self.inc_notes = menu.get_option_by_name('incnotes').get_value()
|
||||||
self.usecall = menu.get_option_by_name('usecall').get_value()
|
use_call = menu.get_option_by_name('usecall').get_value()
|
||||||
blankplace = menu.get_option_by_name('repplace').get_value()
|
blankplace = menu.get_option_by_name('repplace').get_value()
|
||||||
blankdate = menu.get_option_by_name('repdate').get_value()
|
blankdate = menu.get_option_by_name('repdate').get_value()
|
||||||
self.calcageflag = menu.get_option_by_name('computeage').get_value()
|
self.calcageflag = menu.get_option_by_name('computeage').get_value()
|
||||||
@ -147,8 +146,8 @@ class DetDescendantReport(Report):
|
|||||||
else:
|
else:
|
||||||
empty_place = ""
|
empty_place = ""
|
||||||
|
|
||||||
self.__narrator = Narrator(self.database, self.verbose,
|
self.__narrator = Narrator(self.database, self.verbose, use_call,
|
||||||
empty_date, empty_place)
|
empty_date, empty_place, self.endnotes)
|
||||||
|
|
||||||
self.bibli = Bibliography(Bibliography.MODE_PAGE)
|
self.bibli = Bibliography(Bibliography.MODE_PAGE)
|
||||||
|
|
||||||
@ -214,7 +213,7 @@ class DetDescendantReport(Report):
|
|||||||
ix = max(self.map)
|
ix = max(self.map)
|
||||||
self.apply_mod_reg_filter_aux(child_ref.ref, ix+1, cur_gen+1)
|
self.apply_mod_reg_filter_aux(child_ref.ref, ix+1, cur_gen+1)
|
||||||
|
|
||||||
def apply_mod_reg_filter(self,person_handle):
|
def apply_mod_reg_filter(self, person_handle):
|
||||||
self.apply_mod_reg_filter_aux(person_handle, 1, 1)
|
self.apply_mod_reg_filter_aux(person_handle, 1, 1)
|
||||||
mod_reg_number = 1
|
mod_reg_number = 1
|
||||||
for generation in xrange(len(self.gen_keys)):
|
for generation in xrange(len(self.gen_keys)):
|
||||||
@ -246,7 +245,6 @@ class DetDescendantReport(Report):
|
|||||||
self.doc.write_text(title, mark)
|
self.doc.write_text(title, mark)
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
keys = sorted(self.map)
|
|
||||||
generation = 0
|
generation = 0
|
||||||
|
|
||||||
for generation in xrange(len(self.gen_keys)):
|
for generation in xrange(len(self.gen_keys)):
|
||||||
@ -414,7 +412,7 @@ class DetDescendantReport(Report):
|
|||||||
self.doc.write_styled_note(note.get_styledtext(),
|
self.doc.write_styled_note(note.get_styledtext(),
|
||||||
note.get_format(),"DDR-MoreDetails")
|
note.get_format(),"DDR-MoreDetails")
|
||||||
|
|
||||||
def write_parents(self, person, firstName):
|
def __write_parents(self, person):
|
||||||
family_handle = person.get_main_parents_family_handle()
|
family_handle = person.get_main_parents_family_handle()
|
||||||
if family_handle:
|
if family_handle:
|
||||||
family = self.database.get_family_from_handle(family_handle)
|
family = self.database.get_family_from_handle(family_handle)
|
||||||
@ -434,8 +432,7 @@ class DetDescendantReport(Report):
|
|||||||
else:
|
else:
|
||||||
father_name = ""
|
father_name = ""
|
||||||
father_mark = ""
|
father_mark = ""
|
||||||
text = self.__narrator.child_str(person, father_name, mother_name,
|
text = self.__narrator.get_child_string(father_name, mother_name)
|
||||||
firstName)
|
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text(text)
|
self.doc.write_text(text)
|
||||||
if father_mark:
|
if father_mark:
|
||||||
@ -455,8 +452,7 @@ class DetDescendantReport(Report):
|
|||||||
text = ""
|
text = ""
|
||||||
spouse_mark = ReportUtils.get_person_mark(self.database, spouse)
|
spouse_mark = ReportUtils.get_person_mark(self.database, spouse)
|
||||||
|
|
||||||
text = self.__narrator.married_str(person, family, self.endnotes,
|
text = self.__narrator.get_married_string(family, is_first)
|
||||||
is_first)
|
|
||||||
|
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text_citation(text, spouse_mark)
|
self.doc.write_text_citation(text, spouse_mark)
|
||||||
@ -540,9 +536,9 @@ class DetDescendantReport(Report):
|
|||||||
cnt += 1
|
cnt += 1
|
||||||
|
|
||||||
self.doc.write_text("%s. " % child_name, child_mark)
|
self.doc.write_text("%s. " % child_name, child_mark)
|
||||||
|
self.__narrator.set_subject(child)
|
||||||
self.doc.write_text(self.__narrator.born_str(child, 0))
|
self.doc.write_text_citation(self.__narrator.get_born_string())
|
||||||
self.doc.write_text(self.__narrator.died_str(child, 0))
|
self.doc.write_text_citation(self.__narrator.get_died_string())
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
def __write_family_events(self, family):
|
def __write_family_events(self, family):
|
||||||
@ -580,6 +576,7 @@ class DetDescendantReport(Report):
|
|||||||
|
|
||||||
def write_person_info(self, person):
|
def write_person_info(self, person):
|
||||||
name = _nd.display_formal(person)
|
name = _nd.display_formal(person)
|
||||||
|
self.__narrator.set_subject(person)
|
||||||
|
|
||||||
plist = person.get_media_list()
|
plist = person.get_media_list()
|
||||||
if self.addimages and len(plist) > 0:
|
if self.addimages and len(plist) > 0:
|
||||||
@ -587,49 +584,32 @@ class DetDescendantReport(Report):
|
|||||||
ReportUtils.insert_image(self.database, self.doc, photo)
|
ReportUtils.insert_image(self.database, self.doc, photo)
|
||||||
|
|
||||||
self.doc.start_paragraph("DDR-Entry")
|
self.doc.start_paragraph("DDR-Entry")
|
||||||
# Check birth record
|
|
||||||
first = ReportUtils.common_name(person, self.usecall)
|
|
||||||
|
|
||||||
if not self.verbose:
|
if not self.verbose:
|
||||||
self.write_parents(person, first)
|
self.__write_parents(person)
|
||||||
|
|
||||||
text = self.__narrator.born_str(person, first)
|
text = self.__narrator.get_born_string()
|
||||||
if text:
|
if text:
|
||||||
birth_ref = person.get_birth_ref()
|
|
||||||
if birth_ref:
|
|
||||||
birth = self.database.get_event_from_handle(birth_ref.ref)
|
|
||||||
text = text.rstrip(". ")
|
|
||||||
text = text + self.endnotes(birth) + ". "
|
|
||||||
self.doc.write_text_citation(text)
|
self.doc.write_text_citation(text)
|
||||||
first = 0
|
|
||||||
|
|
||||||
text = self.__narrator.baptised_str(person, first, self.endnotes)
|
text = self.__narrator.get_baptized_string()
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text_citation(text)
|
self.doc.write_text_citation(text)
|
||||||
|
|
||||||
text = self.__narrator.christened_str(person, first, self.endnotes)
|
text = self.__narrator.get_christened_string()
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text_citation(text)
|
self.doc.write_text_citation(text)
|
||||||
|
|
||||||
span = self.calc_age(person)
|
text = self.__narrator.get_died_string(self.calcageflag)
|
||||||
text = self.__narrator.died_str(person, first, span)
|
|
||||||
if text:
|
|
||||||
death_ref = person.get_death_ref()
|
|
||||||
if death_ref:
|
|
||||||
death = self.database.get_event_from_handle(death_ref.ref)
|
|
||||||
text = text.rstrip(". ")
|
|
||||||
text = text + self.endnotes(death) + ". "
|
|
||||||
self.doc.write_text_citation(text)
|
|
||||||
first = 0
|
|
||||||
|
|
||||||
text = self.__narrator.buried_str(person, first, self.endnotes)
|
|
||||||
if text:
|
if text:
|
||||||
self.doc.write_text_citation(text)
|
self.doc.write_text_citation(text)
|
||||||
|
|
||||||
first = ReportUtils.common_name(person, self.usecall)
|
text = self.__narrator.get_buried_string()
|
||||||
|
if text:
|
||||||
|
self.doc.write_text_citation(text)
|
||||||
|
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
self.write_parents(person, first)
|
self.__write_parents(person)
|
||||||
self.write_marriage(person)
|
self.write_marriage(person)
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
@ -710,22 +690,6 @@ class DetDescendantReport(Report):
|
|||||||
self.doc.write_text_citation( text )
|
self.doc.write_text_citation( text )
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
def calc_age(self,ind):
|
|
||||||
"""
|
|
||||||
Calulate age.
|
|
||||||
|
|
||||||
Returns a tuple (age,units) where units is an integer representing
|
|
||||||
time units:
|
|
||||||
no age info: 0
|
|
||||||
years: 1
|
|
||||||
months: 2
|
|
||||||
days: 3
|
|
||||||
"""
|
|
||||||
if self.calcageflag:
|
|
||||||
return ReportUtils.old_calc_age(self.database, ind)
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def endnotes(self, obj):
|
def endnotes(self, obj):
|
||||||
if not obj or not self.inc_sources:
|
if not obj or not self.inc_sources:
|
||||||
return ""
|
return ""
|
||||||
@ -793,8 +757,8 @@ class DetDescendantOptions(MenuReportOptions):
|
|||||||
listc.set_help(_("Whether to list children."))
|
listc.set_help(_("Whether to list children."))
|
||||||
menu.add_option(category_name, "listc", listc)
|
menu.add_option(category_name, "listc", listc)
|
||||||
|
|
||||||
computeage = BooleanOption(_("Compute age"), True)
|
computeage = BooleanOption(_("Compute death age"),True)
|
||||||
computeage.set_help(_("Whether to compute age."))
|
computeage.set_help(_("Whether to compute a person's age at death."))
|
||||||
menu.add_option(category_name, "computeage", computeage)
|
menu.add_option(category_name, "computeage", computeage)
|
||||||
|
|
||||||
omitda = BooleanOption(_("Omit duplicate ancestors"), True)
|
omitda = BooleanOption(_("Omit duplicate ancestors"), True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user