Patch from James Friedmann <jfriedmannj@gmail.com> to include a heading for spouses. Code cleanup.
svn: r11798
This commit is contained in:
parent
49f941720b
commit
a4ce178893
@ -5,7 +5,7 @@
|
||||
# Copyright (C) 2000-2007 Donald N. Allingham
|
||||
# Copyright (C) 2007-2008 Brian G. Matherly
|
||||
# Copyright (C) 2007 Robert Cawley <rjc@cawley.id.au>
|
||||
# Copyright (C) 2008 James Friedmann <jfriedmannj@gmail.com>
|
||||
# Copyright (C) 2008-2009 James Friedmann <jfriedmannj@gmail.com>
|
||||
#
|
||||
# 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
|
||||
@ -187,8 +187,10 @@ class DetDescendantReport(Report):
|
||||
self.henry[person_handle] = mod_reg_number
|
||||
mod_reg_number += 1
|
||||
|
||||
|
||||
def write_report(self):
|
||||
"""
|
||||
This function is called by the report system and writes the report.
|
||||
"""
|
||||
if self.record_num:
|
||||
self.mod_reg_filter(self.center_person.get_handle())
|
||||
else:
|
||||
@ -196,19 +198,6 @@ class DetDescendantReport(Report):
|
||||
|
||||
name = _nd.display_name(self.center_person.get_primary_name())
|
||||
|
||||
spouseName = ""
|
||||
nspouses = 0
|
||||
for family_handle in self.center_person.get_family_handle_list():
|
||||
family = self.database.get_family_from_handle(family_handle)
|
||||
if self.center_person.get_gender() == gen.lib.Person.MALE:
|
||||
spouse_handle = family.get_mother_handle()
|
||||
else:
|
||||
spouse_handle = family.get_father_handle()
|
||||
if spouse_handle:
|
||||
nspouses += 1
|
||||
spouse = self.database.get_person_from_handle(spouse_handle)
|
||||
spouseName = _nd.display(spouse)
|
||||
|
||||
self.doc.start_paragraph("DDR-Title")
|
||||
|
||||
title = _("Descendant Report for %(person_name)s") % {
|
||||
@ -220,7 +209,6 @@ class DetDescendantReport(Report):
|
||||
keys = self.map.keys()
|
||||
keys.sort()
|
||||
generation = 0
|
||||
need_header = 1
|
||||
|
||||
for generation in xrange(len(self.gen_keys)):
|
||||
if self.pgbrk and generation > 0:
|
||||
@ -236,7 +224,6 @@ class DetDescendantReport(Report):
|
||||
|
||||
for key in self.gen_keys[generation]:
|
||||
person_handle = self.map[key]
|
||||
person = self.database.get_person_from_handle(person_handle)
|
||||
self.gen_handles[person_handle] = key
|
||||
self.write_person(key)
|
||||
|
||||
@ -284,17 +271,11 @@ class DetDescendantReport(Report):
|
||||
for family_handle in person.get_family_handle_list():
|
||||
family = self.database.get_family_from_handle(family_handle)
|
||||
if self.inc_mates:
|
||||
if person.get_gender() == gen.lib.Person.MALE:
|
||||
mate_handle = family.get_mother_handle()
|
||||
else:
|
||||
mate_handle = family.get_father_handle()
|
||||
if mate_handle:
|
||||
mate = self.database.get_person_from_handle(mate_handle)
|
||||
self.write_person_info(mate)
|
||||
self.__write_mate(person, family)
|
||||
if self.listchildren:
|
||||
self.write_children(family)
|
||||
self.__write_children(family)
|
||||
if self.inc_events:
|
||||
self.write_family_events(family)
|
||||
self.__write_family_events(family)
|
||||
|
||||
def write_event(self, event_ref):
|
||||
text = ""
|
||||
@ -307,7 +288,7 @@ class DetDescendantReport(Report):
|
||||
place = u''
|
||||
|
||||
self.doc.start_paragraph('DDR-MoreDetails')
|
||||
evtName = str( event.get_type() )
|
||||
event_name = str( event.get_type() )
|
||||
if date and place:
|
||||
text += _('%(date)s, %(place)s') % {
|
||||
'date' : date, 'place' : place }
|
||||
@ -327,7 +308,7 @@ class DetDescendantReport(Report):
|
||||
text += ". "
|
||||
|
||||
text = _('%(event_name)s: %(event_text)s') % {
|
||||
'event_name' : _(evtName),
|
||||
'event_name' : _(event_name),
|
||||
'event_text' : text }
|
||||
|
||||
self.doc.write_text(text)
|
||||
@ -412,10 +393,36 @@ class DetDescendantReport(Report):
|
||||
self.doc.write_text(text, spouse_mark)
|
||||
is_first = False
|
||||
|
||||
def write_children(self, family):
|
||||
""" List children.
|
||||
def __write_mate(self, person, family):
|
||||
"""
|
||||
Write information about the person's spouse/mate.
|
||||
"""
|
||||
if person.get_gender() == gen.lib.Person.MALE:
|
||||
mate_handle = family.get_mother_handle()
|
||||
else:
|
||||
mate_handle = family.get_father_handle()
|
||||
|
||||
if mate_handle:
|
||||
mate = self.database.get_person_from_handle(mate_handle)
|
||||
|
||||
self.doc.start_paragraph("DDR-MoreHeader")
|
||||
name = _nd.display_formal(mate)
|
||||
mark = ReportUtils.get_person_mark(self.database, mate)
|
||||
if family.get_relationship() == gen.lib.FamilyRelType.MARRIED:
|
||||
self.doc.write_text(_("Spouse: %s") % name, mark)
|
||||
else:
|
||||
self.doc.write_text(_("Relationship with: %s") % name, mark)
|
||||
if name[-1:] != '.':
|
||||
self.doc.write_text(".")
|
||||
self.doc.write_text(self.endnotes(mate))
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.write_person_info(mate)
|
||||
|
||||
def __write_children(self, family):
|
||||
"""
|
||||
List the children for the given family.
|
||||
"""
|
||||
if not family.get_child_ref_list():
|
||||
return
|
||||
|
||||
@ -469,8 +476,10 @@ class DetDescendantReport(Report):
|
||||
self.verbose, self.EMPTY_DATE, self.EMPTY_PLACE))
|
||||
self.doc.end_paragraph()
|
||||
|
||||
def write_family_events(self,family):
|
||||
|
||||
def __write_family_events(self, family):
|
||||
"""
|
||||
List the events for the given family.
|
||||
"""
|
||||
if not family.get_event_ref_list():
|
||||
return
|
||||
|
||||
@ -526,13 +535,15 @@ class DetDescendantReport(Report):
|
||||
self.doc.write_text(text)
|
||||
first = 0
|
||||
|
||||
text = ReportUtils.baptised_str(self.database, person, first, self.verbose,
|
||||
self.endnotes, self.EMPTY_DATE,self.EMPTY_PLACE)
|
||||
text = ReportUtils.baptised_str(self.database, person, first,
|
||||
self.verbose, self.endnotes,
|
||||
self.EMPTY_DATE, self.EMPTY_PLACE)
|
||||
if text:
|
||||
self.doc.write_text(text)
|
||||
|
||||
text = ReportUtils.christened_str(self.database, person, first, self.verbose,
|
||||
self.endnotes, self.EMPTY_DATE, self.EMPTY_PLACE)
|
||||
text = ReportUtils.christened_str(self.database, person, first,
|
||||
self.verbose, self.endnotes,
|
||||
self.EMPTY_DATE, self.EMPTY_PLACE)
|
||||
if text:
|
||||
self.doc.write_text(text)
|
||||
|
||||
@ -548,8 +559,9 @@ class DetDescendantReport(Report):
|
||||
self.doc.write_text(text)
|
||||
first = 0
|
||||
|
||||
text = ReportUtils.buried_str(self.database, person, first, self.verbose,
|
||||
self.endnotes, self.EMPTY_DATE,self.EMPTY_PLACE)
|
||||
text = ReportUtils.buried_str(self.database, person, first,
|
||||
self.verbose, self.endnotes,
|
||||
self.EMPTY_DATE, self.EMPTY_PLACE)
|
||||
if text:
|
||||
self.doc.write_text(text)
|
||||
|
||||
@ -685,18 +697,21 @@ class DetDescendantOptions(MenuReportOptions):
|
||||
pid.set_help(_("The center person for the report"))
|
||||
menu.add_option(category_name, "pid", pid)
|
||||
|
||||
gen = NumberOption(_("Generations"),10,1,100)
|
||||
gen.set_help(_("The number of generations to include in the report"))
|
||||
menu.add_option(category_name,"gen",gen)
|
||||
generations = NumberOption(_("Generations"), 10, 1, 100)
|
||||
generations.set_help(_("The number of generations to include in the " \
|
||||
"report"))
|
||||
menu.add_option(category_name, "gen", generations)
|
||||
|
||||
pagebbg = BooleanOption(_("Page break between generations"), False)
|
||||
pagebbg.set_help(
|
||||
_("Whether to start a new page after each generation."))
|
||||
menu.add_option(category_name, "pagebbg", pagebbg)
|
||||
|
||||
record_num = BooleanOption(_("Use Record-style (Modified Register) numbering"),False)
|
||||
record_num.set_help(
|
||||
_("Whether to use Record-style numbering instead of Henry-style."))
|
||||
record_num = BooleanOption(_("Use Record-style (Modified Register) " \
|
||||
"numbering"),
|
||||
False)
|
||||
record_num.set_help(_("Whether to use Record-style numbering instead" \
|
||||
" of Henry-style."))
|
||||
menu.add_option(category_name, "record_num", record_num)
|
||||
|
||||
category_name = _("Content")
|
||||
@ -705,8 +720,8 @@ class DetDescendantOptions(MenuReportOptions):
|
||||
usecall.set_help(_("Whether to use the call name as the first name."))
|
||||
menu.add_option(category_name, "usecall", usecall)
|
||||
|
||||
fulldates = BooleanOption(
|
||||
_("Use full dates instead of only the year"),True)
|
||||
fulldates = BooleanOption(_("Use full dates instead of only the year"),
|
||||
True)
|
||||
fulldates.set_help(_("Whether to use full dates instead of just year."))
|
||||
menu.add_option(category_name, "fulldates", fulldates)
|
||||
|
||||
@ -727,7 +742,8 @@ class DetDescendantOptions(MenuReportOptions):
|
||||
_("Whether to use complete sentences or succinct language."))
|
||||
menu.add_option(category_name, "verbose", verbose)
|
||||
|
||||
desref = BooleanOption(_("Add descendant reference in child list"),True)
|
||||
desref = BooleanOption(_("Add descendant reference in child list"),
|
||||
True)
|
||||
desref.set_help(
|
||||
_("Whether to add descendant references in child list."))
|
||||
menu.add_option(category_name, "desref", desref)
|
||||
|
Loading…
Reference in New Issue
Block a user