* src/ReportUtils.py: More report-related methods.
* src/plugins/DetAncestralReport.py: Use ReportUtils methods. * src/plugins/DetDescendantReport.py: Use ReportUtils methods. svn: r4011
This commit is contained in:
parent
966e045bfc
commit
7c272cbb34
@ -2,6 +2,10 @@
|
|||||||
* src/RelLib.py: Finish up with actual MALE, FEMALE, and UNKNOWN
|
* src/RelLib.py: Finish up with actual MALE, FEMALE, and UNKNOWN
|
||||||
attributes of the Person class.
|
attributes of the Person class.
|
||||||
|
|
||||||
|
* src/ReportUtils.py: More report-related methods.
|
||||||
|
* src/plugins/DetAncestralReport.py: Use ReportUtils methods.
|
||||||
|
* src/plugins/DetDescendantReport.py: Use ReportUtils methods.
|
||||||
|
|
||||||
2005-01-31 Don Allingham <dallingham@users.sourceforge.net>
|
2005-01-31 Don Allingham <dallingham@users.sourceforge.net>
|
||||||
* various: Change Person.male, Person.female, and Person.unkwown
|
* various: Change Person.male, Person.female, and Person.unkwown
|
||||||
to Person.MALE, Person.FEMALE and Person.UNKNOWN
|
to Person.MALE, Person.FEMALE and Person.UNKNOWN
|
||||||
|
@ -386,7 +386,7 @@ def insert_images(database, doc, person, w_cm=4.0, h_cm=4.0):
|
|||||||
# Strings commonly used in reports
|
# Strings commonly used in reports
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def empty_notes():
|
def empty_notes(whatever):
|
||||||
# Empty stab function for when endnotes are not needed
|
# Empty stab function for when endnotes are not needed
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@ -726,7 +726,8 @@ def born_died_str(database,person,endnotes=None,name_object=None,person_name=Non
|
|||||||
text = text + " "
|
text = text + " "
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def married_str(database,person,spouse,event,endnotes=None):
|
def married_str(database,person,spouse,event,endnotes=None,
|
||||||
|
empty_date="",empty_place="",is_first=True):
|
||||||
"""
|
"""
|
||||||
Composes a string describing marriage of a person.
|
Composes a string describing marriage of a person.
|
||||||
|
|
||||||
@ -754,16 +755,19 @@ def married_str(database,person,spouse,event,endnotes=None):
|
|||||||
if not endnotes:
|
if not endnotes:
|
||||||
endnotes = empty_notes
|
endnotes = empty_notes
|
||||||
|
|
||||||
|
date = empty_date
|
||||||
|
place = empty_place
|
||||||
spouse_name = _nd.display(spouse)
|
spouse_name = _nd.display(spouse)
|
||||||
|
|
||||||
date = event.get_date()
|
mdate = event.get_date()
|
||||||
|
if mdate:
|
||||||
|
date = mdate
|
||||||
place_handle = event.get_place_handle()
|
place_handle = event.get_place_handle()
|
||||||
if place_handle:
|
if place_handle:
|
||||||
place = database.get_place_from_handle(place_handle).get_title()
|
place = database.get_place_from_handle(place_handle).get_title()
|
||||||
else:
|
|
||||||
place = ""
|
|
||||||
|
|
||||||
text = ""
|
text = ""
|
||||||
|
if is_first:
|
||||||
if date and place:
|
if date and place:
|
||||||
if person.get_gender() == RelLib.Person.MALE:
|
if person.get_gender() == RelLib.Person.MALE:
|
||||||
text = _('He married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % {
|
text = _('He married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % {
|
||||||
@ -808,6 +812,87 @@ def married_str(database,person,spouse,event,endnotes=None):
|
|||||||
text = _('She married %(spouse)s%(endnotes)s.') % {
|
text = _('She married %(spouse)s%(endnotes)s.') % {
|
||||||
'spouse' : spouse_name,
|
'spouse' : spouse_name,
|
||||||
'endnotes' : endnotes(event)}
|
'endnotes' : endnotes(event)}
|
||||||
|
else:
|
||||||
|
if date and place:
|
||||||
|
if person.get_gender() == RelLib.Person.MALE:
|
||||||
|
text = _('He also married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % {
|
||||||
|
'spouse' : spouse_name,
|
||||||
|
'endnotes' : endnotes(event),
|
||||||
|
'date' : date,
|
||||||
|
'place' : place}
|
||||||
|
else:
|
||||||
|
text = _('She also married %(spouse)s %(date)s in %(place)s%(endnotes)s.') % {
|
||||||
|
'spouse' : spouse_name,
|
||||||
|
'date' : date,
|
||||||
|
'endnotes' : endnotes(event),
|
||||||
|
'place' : place}
|
||||||
|
elif date:
|
||||||
|
if person.get_gender() == RelLib.Person.MALE:
|
||||||
|
text = _('He also married %(spouse)s %(date)s%(endnotes)s.') % {
|
||||||
|
'spouse' : spouse_name,
|
||||||
|
'endnotes' : endnotes(event),
|
||||||
|
'date' : date,}
|
||||||
|
else:
|
||||||
|
text = _('She also married %(spouse)s in %(place)s%(endnotes)s.') % {
|
||||||
|
'spouse' : spouse_name,
|
||||||
|
'endnotes' : endnotes(event),
|
||||||
|
'place' : place,}
|
||||||
|
elif place:
|
||||||
|
if person.get_gender() == RelLib.Person.MALE:
|
||||||
|
text = _('He also married %(spouse)s in %(place)s%(endnotes)s.') % {
|
||||||
|
'spouse' : spouse_name,
|
||||||
|
'endnotes' : endnotes(event),
|
||||||
|
'place' : place}
|
||||||
|
else:
|
||||||
|
text = _('She also married %(spouse)s in %(place)s%(endnotes)s.') % {
|
||||||
|
'spouse' : spouse_name,
|
||||||
|
'endnotes' : endnotes(event),
|
||||||
|
'place' : place}
|
||||||
|
else:
|
||||||
|
if person.get_gender() == RelLib.Person.MALE:
|
||||||
|
text = _('He also married %(spouse)s%(endnotes)s.') % {
|
||||||
|
'spouse' : spouse_name,
|
||||||
|
'endnotes' : endnotes(event) }
|
||||||
|
else:
|
||||||
|
text = _('She also married %(spouse)s%(endnotes)s.') % {
|
||||||
|
'spouse' : spouse_name,
|
||||||
|
'endnotes' : endnotes(event)}
|
||||||
|
|
||||||
|
if text:
|
||||||
|
text = text + " "
|
||||||
|
return text
|
||||||
|
|
||||||
|
def married_rel_str(database,person,family,is_first=True):
|
||||||
|
spouse_handle = find_spouse(person,family)
|
||||||
|
spouse = database.get_person_from_handle(spouse_handle)
|
||||||
|
spouse_name = _nd.display(spouse)
|
||||||
|
|
||||||
|
if is_first:
|
||||||
|
if family.get_relationship() == RelLib.Family.MARRIED:
|
||||||
|
if person.get_gender() == RelLib.Person.MALE:
|
||||||
|
text = _('He married %(spouse)s.') % { 'spouse' : spouse_name }
|
||||||
|
else:
|
||||||
|
text = _('She married %(spouse)s.') % { 'spouse' : spouse_name }
|
||||||
|
else:
|
||||||
|
if person.get_gender() == RelLib.Person.MALE:
|
||||||
|
text = _('He had relationship with %(spouse)s.') % {
|
||||||
|
'spouse' : spouse_name }
|
||||||
|
else:
|
||||||
|
text = _('She had relationship with %(spouse)s.') % {
|
||||||
|
'spouse' : spouse_name }
|
||||||
|
else:
|
||||||
|
if family.get_relationship() == RelLib.Family.MARRIED:
|
||||||
|
if person.get_gender() == RelLib.Person.MALE:
|
||||||
|
text = _('He also married %(spouse)s.') % { 'spouse' : spouse_name }
|
||||||
|
else:
|
||||||
|
text = _('She also married %(spouse)s.') % { 'spouse' : spouse_name }
|
||||||
|
else:
|
||||||
|
if person.get_gender() == RelLib.Person.MALE:
|
||||||
|
text = _('He also had relationship with %(spouse)s.') % {
|
||||||
|
'spouse' : spouse_name }
|
||||||
|
else:
|
||||||
|
text = _('She also had relationship with %(spouse)s.') % {
|
||||||
|
'spouse' : spouse_name }
|
||||||
if text:
|
if text:
|
||||||
text = text + " "
|
text = text + " "
|
||||||
return text
|
return text
|
||||||
@ -890,6 +975,8 @@ def child_str(person,person_name=0,father_name="",mother_name="",dead=0):
|
|||||||
else:
|
else:
|
||||||
text = _("She is the daughter of %(father)s.") % {
|
text = _("She is the daughter of %(father)s.") % {
|
||||||
'father' : father_name, }
|
'father' : father_name, }
|
||||||
|
if text:
|
||||||
|
text = text + " "
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def find_spouse(person,family):
|
def find_spouse(person,family):
|
||||||
@ -898,10 +985,13 @@ def find_spouse(person,family):
|
|||||||
else:
|
else:
|
||||||
spouse_id = family.get_mother_handle()
|
spouse_id = family.get_mother_handle()
|
||||||
return spouse_id
|
return spouse_id
|
||||||
if text:
|
|
||||||
text = text + " "
|
|
||||||
return text
|
|
||||||
|
|
||||||
|
def find_marriage(database,family):
|
||||||
|
for event_handle in family.get_event_list():
|
||||||
|
event = database.get_event_from_handle(event_handle)
|
||||||
|
if event and event.get_name() == "Marriage":
|
||||||
|
return event
|
||||||
|
return None
|
||||||
|
|
||||||
def born_str(database,person,person_name=None,empty_date="",empty_place=""):
|
def born_str(database,person,person_name=None,empty_date="",empty_place=""):
|
||||||
"""
|
"""
|
||||||
@ -1392,7 +1482,7 @@ def buried_str(database,person,person_name=None,empty_date="",empty_place=""):
|
|||||||
text = text + " "
|
text = text + " "
|
||||||
return text
|
return text
|
||||||
|
|
||||||
_rtyle = {
|
_rtype = {
|
||||||
RelLib.Family.MARRIED : _("Married"),
|
RelLib.Family.MARRIED : _("Married"),
|
||||||
RelLib.Family.UNMARRIED : _("Unmarried"),
|
RelLib.Family.UNMARRIED : _("Unmarried"),
|
||||||
RelLib.Family.CIVIL_UNION : _("Civil Union"),
|
RelLib.Family.CIVIL_UNION : _("Civil Union"),
|
||||||
@ -1400,5 +1490,5 @@ _rtyle = {
|
|||||||
RelLib.Family.OTHER : _("Other"),
|
RelLib.Family.OTHER : _("Other"),
|
||||||
}
|
}
|
||||||
|
|
||||||
def relationship_name(type):
|
def relationship_name(rtype):
|
||||||
return _rtype.get(type)
|
return _rtype.get(rtype)
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2004 Bruce J. DeGrasse
|
# Copyright (C) 2000-2002 Bruce J. DeGrasse
|
||||||
|
# Copyright (C) 2000-2005 Donald N. Allingham
|
||||||
#
|
#
|
||||||
# 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
|
||||||
@ -42,14 +43,15 @@ import gtk
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import RelLib
|
import RelLib
|
||||||
import Errors
|
|
||||||
from QuestionDialog import ErrorDialog
|
|
||||||
import Report
|
import Report
|
||||||
import BaseDoc
|
import BaseDoc
|
||||||
import ReportOptions
|
import ReportOptions
|
||||||
import const
|
import const
|
||||||
|
import ReportUtils
|
||||||
from DateHandler import displayer as _dd
|
from DateHandler import displayer as _dd
|
||||||
|
from NameDisplay import displayer as _nd
|
||||||
|
|
||||||
|
EMPTY_ENTRY = "_____________"
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -101,8 +103,18 @@ class DetAncestorReport(Report.Report):
|
|||||||
self.childRef = options_class.handler.options_dict['desref']
|
self.childRef = options_class.handler.options_dict['desref']
|
||||||
self.addImages = options_class.handler.options_dict['incphotos']
|
self.addImages = options_class.handler.options_dict['incphotos']
|
||||||
|
|
||||||
self.genIDs = {}
|
self.gen_handles = {}
|
||||||
self.prevGenIDs= {}
|
self.prev_gen_hanldes= {}
|
||||||
|
|
||||||
|
if self.blankDate:
|
||||||
|
self.EMPTY_DATE = EMPTY_ENTRY
|
||||||
|
else:
|
||||||
|
self.EMPTY_DATE = ""
|
||||||
|
|
||||||
|
if self.blankPlace:
|
||||||
|
self.EMPTY_PLACE = EMPTY_ENTRY
|
||||||
|
else:
|
||||||
|
self.EMPTY_PLACE = ""
|
||||||
|
|
||||||
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):
|
||||||
@ -116,60 +128,162 @@ class DetAncestorReport(Report.Report):
|
|||||||
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 calcAge(self, ind):
|
def write_report(self):
|
||||||
""" Calulate age
|
self.apply_filter(self.start_person.get_handle(),1)
|
||||||
APHRASE=
|
|
||||||
at the age of NUMBER UNIT(S)
|
|
||||||
UNIT= year | month | day
|
|
||||||
UNITS= years | months | days
|
|
||||||
null
|
|
||||||
"""
|
|
||||||
|
|
||||||
birth_handle = ind.get_birth_handle()
|
name = self.start_person.get_primary_name().get_regular_name()
|
||||||
|
self.doc.start_paragraph("DAR-Title")
|
||||||
|
title = _("Detailed Ancestral Report for %s") % name
|
||||||
|
self.doc.write_text(title)
|
||||||
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
|
keys = self.map.keys()
|
||||||
|
keys.sort()
|
||||||
|
generation = 0
|
||||||
|
need_header = 1
|
||||||
|
|
||||||
|
for key in keys :
|
||||||
|
if generation == 0 or key >= 2**generation:
|
||||||
|
if self.pgbrk and generation > 0:
|
||||||
|
self.doc.page_break()
|
||||||
|
self.doc.start_paragraph("DAR-Generation")
|
||||||
|
t = _("%s Generation") % DetAncestorReport.gen[generation+1]
|
||||||
|
self.doc.write_text(t)
|
||||||
|
self.doc.end_paragraph()
|
||||||
|
generation = generation + 1
|
||||||
|
if self.childRef:
|
||||||
|
self.prev_gen_hanldes= self.gen_handles.copy()
|
||||||
|
self.gen_handles.clear()
|
||||||
|
|
||||||
|
person_handle = self.map[key]
|
||||||
|
person = self.database.get_person_from_handle(person_handle)
|
||||||
|
self.gen_handles[person_handle]= key
|
||||||
|
dupPerson = self.write_person(key)
|
||||||
|
if dupPerson == 0: # Is this a duplicate ind record
|
||||||
|
if person.get_gender() == RelLib.Person.FEMALE and \
|
||||||
|
self.listChildren:
|
||||||
|
for family_handle in person.get_family_handle_list():
|
||||||
|
family = self.database.get_family_from_handle(family_handle)
|
||||||
|
self.write_children(family)
|
||||||
|
|
||||||
|
def write_person(self, key):
|
||||||
|
"""Output birth, death, parentage, marriage and notes information """
|
||||||
|
|
||||||
|
person_handle = self.map[key]
|
||||||
|
person = self.database.get_person_from_handle(person_handle)
|
||||||
|
if self.addImages:
|
||||||
|
ReportUtils.insert_images(self.database,self.doc,person)
|
||||||
|
|
||||||
|
self.doc.start_paragraph("DAR-First-Entry","%s." % str(key))
|
||||||
|
|
||||||
|
name = _nd.display(person)
|
||||||
|
|
||||||
|
if self.firstName:
|
||||||
|
firstName = person.get_primary_name().get_first_name()
|
||||||
|
elif person.get_gender() == RelLib.Person.MALE:
|
||||||
|
firstName = _("He")
|
||||||
|
else:
|
||||||
|
firstName = _("She")
|
||||||
|
|
||||||
|
self.doc.start_bold()
|
||||||
|
self.doc.write_text(name)
|
||||||
|
self.doc.end_bold()
|
||||||
|
|
||||||
|
if self.dupPerson:
|
||||||
|
# Check for duplicate record (result of distant cousins marrying)
|
||||||
|
keys = self.map.keys()
|
||||||
|
keys.sort()
|
||||||
|
for dkey in keys:
|
||||||
|
if dkey >= key:
|
||||||
|
break
|
||||||
|
if self.map[key] == self.map[dkey]:
|
||||||
|
self.doc.write_text(_("%(name)s is the same person as [%(id_str)s].") %
|
||||||
|
{ 'name' : '', 'id_str' : str(dkey) })
|
||||||
|
self.doc.end_paragraph()
|
||||||
|
return 1 # Duplicate person
|
||||||
|
|
||||||
|
# Check birth record
|
||||||
|
birth_handle = person.get_birth_handle()
|
||||||
if birth_handle:
|
if birth_handle:
|
||||||
birth = self.database.get_event_from_handle(birth_handle).get_date_object()
|
text = ReportUtils.born_str(self.database,person,"",
|
||||||
birth_year_valid = birth.get_year_valid()
|
self.EMPTY_DATE,self.EMPTY_PLACE)
|
||||||
|
if text:
|
||||||
|
self.doc.write_text(text)
|
||||||
|
|
||||||
|
if person.get_death_handle():
|
||||||
|
age,units = self.calc_age(person)
|
||||||
|
text = ReportUtils.died_str(self.database,person,firstName,
|
||||||
|
self.EMPTY_DATE,self.EMPTY_PLACE,age,units)
|
||||||
|
if text:
|
||||||
|
self.doc.write_text(text)
|
||||||
|
|
||||||
|
text = ReportUtils.buried_str(self.database,person,firstName,
|
||||||
|
self.EMPTY_DATE,self.EMPTY_PLACE)
|
||||||
|
if text:
|
||||||
|
self.doc.write_text(text)
|
||||||
|
|
||||||
|
self.write_parents(person, firstName)
|
||||||
|
self.write_marriage(person)
|
||||||
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
|
if key == 1:
|
||||||
|
self.write_mate(person)
|
||||||
|
|
||||||
|
if person.get_note() != "" and self.includeNotes:
|
||||||
|
self.doc.start_paragraph("DAR-NoteHeader")
|
||||||
|
self.doc.start_bold()
|
||||||
|
self.doc.write_text(_("Notes for %(name)s" % { 'name': name } ))
|
||||||
|
self.doc.end_bold()
|
||||||
|
self.doc.end_paragraph()
|
||||||
|
self.doc.write_note(person.get_note(),person.get_note_format(),"DAR-Entry")
|
||||||
|
|
||||||
|
return 0 # Not duplicate person
|
||||||
|
|
||||||
|
def write_parents(self, person, firstName):
|
||||||
|
family_handle = person.get_main_parents_family_handle()
|
||||||
|
if family_handle:
|
||||||
|
family = self.database.get_family_from_handle(family_handle)
|
||||||
|
mother_handle = family.get_mother_handle()
|
||||||
|
father_handle = family.get_father_handle()
|
||||||
|
if mother_handle:
|
||||||
|
mother = self.database.get_person_from_handle(mother_handle)
|
||||||
|
mother_name = mother.get_primary_name().get_regular_name()
|
||||||
else:
|
else:
|
||||||
birth_year_valid = None
|
mother_name = ""
|
||||||
death_handle = ind.get_death_handle()
|
if father_handle:
|
||||||
if death_handle:
|
father = self.database.get_person_from_handle(father_handle)
|
||||||
death = self.database.get_event_from_handle(death_handle).get_date_object()
|
father_name = father.get_primary_name().get_regular_name()
|
||||||
death_year_valid = death.get_year_valid()
|
|
||||||
else:
|
else:
|
||||||
death_year_valid = None
|
father_name = ""
|
||||||
the_text = ""
|
|
||||||
if birth_year_valid and death_year_valid:
|
text = ReportUtils.child_str(person,firstName,
|
||||||
age = death.get_year() - birth.get_year()
|
father_name,mother_name,
|
||||||
units = 3 # year
|
bool(person.get_death_handle()))
|
||||||
if birth.get_month_valid() and death.get_month_valid():
|
if text:
|
||||||
if birth.get_month() > death.get_month():
|
self.doc.write_text(text)
|
||||||
age = age -1
|
|
||||||
if birth.get_day_valid() and death.get_day_valid():
|
def write_marriage(self, person):
|
||||||
if birth.get_month() == death.get_month() and birth.get_day() > death.get_day():
|
"""
|
||||||
age = age -1
|
Output marriage sentence.
|
||||||
if age == 0:
|
"""
|
||||||
age = death.get_month() - birth.get_month() # calc age in months
|
is_first = True
|
||||||
if birth.get_day() > death.get_day():
|
for family_handle in person.get_family_handle_list():
|
||||||
age = age - 1
|
family = self.database.get_family_from_handle(family_handle)
|
||||||
units = 2 # month
|
spouse_handle = ReportUtils.find_spouse(person,family)
|
||||||
if age == 0:
|
spouse = self.database.get_person_from_handle(spouse_handle)
|
||||||
age = death.get-day() + 31 - birth.get_day() # calc age in days
|
marriage_event = ReportUtils.find_marriage(self.database,family)
|
||||||
units = 1 # day
|
text = ""
|
||||||
if age > 1:
|
if marriage_event:
|
||||||
if units == 1:
|
text = ReportUtils.married_str(self.database,person,spouse,
|
||||||
the_text = _(" at the age of %d days") % age
|
marriage_event,None,
|
||||||
elif units == 2:
|
self.EMPTY_DATE,self.EMPTY_PLACE,
|
||||||
the_text = _(" at the age of %d months") % age
|
is_first)
|
||||||
else:
|
else:
|
||||||
the_text = _(" at the age of %d years") % age
|
text = ReportUtils.married_rel_str(self.database,person,family,
|
||||||
else:
|
is_first)
|
||||||
if units == 1:
|
if text:
|
||||||
the_text = _(" at the age of %d day") % age
|
self.doc.write_text(text)
|
||||||
elif units == 2:
|
is_first = False
|
||||||
the_text = _(" at the age of %d month") % age
|
|
||||||
else:
|
|
||||||
the_text = _(" at the age of %d year") % age
|
|
||||||
return the_text
|
|
||||||
|
|
||||||
def write_children(self, family):
|
def write_children(self, family):
|
||||||
""" List children
|
""" List children
|
||||||
@ -227,8 +341,8 @@ class DetAncestorReport(Report.Report):
|
|||||||
death_handle = child.get_death_handle()
|
death_handle = child.get_death_handle()
|
||||||
|
|
||||||
if self.childRef:
|
if self.childRef:
|
||||||
if self.prevGenIDs.get(child_handle) != None:
|
if self.prev_gen_hanldes.get(child_handle) != None:
|
||||||
name= "[" + str(self.prevGenIDs.get(child_handle)) + "] "+ name
|
name= "[" + str(self.prev_gen_hanldes.get(child_handle)) + "] "+ name
|
||||||
|
|
||||||
if birth_handle:
|
if birth_handle:
|
||||||
birth = self.database.get_event_from_handle(birth_handle)
|
birth = self.database.get_event_from_handle(birth_handle)
|
||||||
@ -315,348 +429,6 @@ class DetAncestorReport(Report.Report):
|
|||||||
|
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
def write_person(self, key):
|
|
||||||
"""Output birth, death, parentage, marriage and notes information """
|
|
||||||
|
|
||||||
person_handle = self.map[key]
|
|
||||||
person = self.database.get_person_from_handle(person_handle)
|
|
||||||
if self.addImages:
|
|
||||||
self.insert_images(person)
|
|
||||||
|
|
||||||
self.doc.start_paragraph("DAR-First-Entry","%s." % str(key))
|
|
||||||
|
|
||||||
name = person.get_primary_name().get_regular_name()
|
|
||||||
|
|
||||||
if self.firstName:
|
|
||||||
firstName = person.get_primary_name().get_first_name()
|
|
||||||
elif person.get_gender() == RelLib.Person.MALE:
|
|
||||||
firstName = _("He")
|
|
||||||
else:
|
|
||||||
firstName = _("She")
|
|
||||||
|
|
||||||
self.doc.start_bold()
|
|
||||||
self.doc.write_text(name)
|
|
||||||
self.doc.end_bold()
|
|
||||||
|
|
||||||
if self.dupPerson:
|
|
||||||
# Check for duplicate record (result of distant cousins marrying)
|
|
||||||
keys = self.map.keys()
|
|
||||||
keys.sort()
|
|
||||||
for dkey in keys:
|
|
||||||
if dkey >= key:
|
|
||||||
break
|
|
||||||
if self.map[key] == self.map[dkey]:
|
|
||||||
self.doc.write_text(_(" is the same person as [%s].") % str(dkey))
|
|
||||||
self.doc.end_paragraph()
|
|
||||||
return 1 # Duplicate person
|
|
||||||
|
|
||||||
# Check birth record
|
|
||||||
birth_handle = person.get_birth_handle()
|
|
||||||
if birth_handle:
|
|
||||||
self.write_birth(person)
|
|
||||||
if person.get_death_handle():
|
|
||||||
self.write_death(person, firstName)
|
|
||||||
self.write_parents(person, firstName)
|
|
||||||
self.write_marriage(person)
|
|
||||||
self.doc.end_paragraph()
|
|
||||||
|
|
||||||
if key == 1: self.write_mate(person)
|
|
||||||
|
|
||||||
if person.get_note() != "" and self.includeNotes:
|
|
||||||
self.doc.start_paragraph("DAR-NoteHeader")
|
|
||||||
self.doc.start_bold()
|
|
||||||
self.doc.write_text(_("Notes for %s" % name))
|
|
||||||
self.doc.end_bold()
|
|
||||||
self.doc.end_paragraph()
|
|
||||||
self.doc.write_note(person.get_note(),person.get_note_format(),"DAR-Entry")
|
|
||||||
|
|
||||||
return 0 # Not duplicate person
|
|
||||||
|
|
||||||
def write_birth(self, person):
|
|
||||||
""" Check birth record
|
|
||||||
Statement formats name precedes this
|
|
||||||
was born on DATE.
|
|
||||||
was born on ________.
|
|
||||||
was born on Date in Place.
|
|
||||||
was born on ________ in PLACE.
|
|
||||||
was born in ____________.
|
|
||||||
was born in the year YEAR.
|
|
||||||
was born in PLACE.
|
|
||||||
was born in ____________.
|
|
||||||
"""
|
|
||||||
|
|
||||||
birth_handle = person.get_birth_handle()
|
|
||||||
if birth_handle:
|
|
||||||
birth = self.database.get_event_from_handle(birth_handle)
|
|
||||||
date = birth.get_date_object()
|
|
||||||
if birth.get_place_handle():
|
|
||||||
place = self.database.get_place_from_handle(birth.get_place_handle()).get_title()
|
|
||||||
if place[-1:] == '.':
|
|
||||||
place = place[:-1]
|
|
||||||
elif self.blankDate:
|
|
||||||
place= "______________"
|
|
||||||
else: place= ""
|
|
||||||
|
|
||||||
if _dd.display(date) != "":
|
|
||||||
if date.get_day_valid() and date.get_month_valid() and \
|
|
||||||
self.fullDate:
|
|
||||||
if place:
|
|
||||||
self.doc.write_text(_(" was born on %s in %s.") % (_dd.display(date), place))
|
|
||||||
else:
|
|
||||||
self.doc.write_text(_(" was born on %s.") % _dd.display(date))
|
|
||||||
elif place:
|
|
||||||
self.doc.write_text(_(" was born in the year %s in %s.") % \
|
|
||||||
(date.get_year(), place))
|
|
||||||
else:
|
|
||||||
self.doc.write_text(_(" was born in the year %s.") % date.get_year())
|
|
||||||
elif place:
|
|
||||||
self.doc.write_text(_(" was born in %s.") % place)
|
|
||||||
else:
|
|
||||||
self.doc.write_text(_("."))
|
|
||||||
|
|
||||||
return
|
|
||||||
self.doc.write_text(_("."))
|
|
||||||
return
|
|
||||||
|
|
||||||
def write_death(self, person, firstName):
|
|
||||||
""" Write obit sentence
|
|
||||||
Statement format: DPHRASE APHRASE BPHRASE
|
|
||||||
DPHRASE=
|
|
||||||
FIRSTNAME died on FULLDATE in PLACE
|
|
||||||
FIRSTNAME died on FULLDATE
|
|
||||||
FIRSTNAME died in PLACE
|
|
||||||
FIRSTNAME died on FULLDATE in PLACE
|
|
||||||
FIRSTNAME died in YEAR in PLACE
|
|
||||||
FIRSTNAME died in YEAR
|
|
||||||
|
|
||||||
APHRASE= see calcAge
|
|
||||||
at the age of NUMBER UNIT(S)
|
|
||||||
null
|
|
||||||
|
|
||||||
where
|
|
||||||
UNIT= year | month | day
|
|
||||||
UNITS= years | months | days
|
|
||||||
|
|
||||||
BPHRASE=
|
|
||||||
, and was buried on FULLDATE in PLACE.
|
|
||||||
, and was buried on FULLDATE.
|
|
||||||
, and was buried in PLACE.
|
|
||||||
.
|
|
||||||
"""
|
|
||||||
t= ""
|
|
||||||
death_handle = person.get_death_handle()
|
|
||||||
if death_handle:
|
|
||||||
death = self.database.get_event_from_handle(death_handle)
|
|
||||||
date = death.get_date_object()
|
|
||||||
if death.get_place_handle():
|
|
||||||
place = self.database.get_place_from_handle(death.get_place_handle()).get_title()
|
|
||||||
if place[-1:] == '.':
|
|
||||||
place = place[:-1]
|
|
||||||
elif self.blankPlace:
|
|
||||||
place= "_____________"
|
|
||||||
else:
|
|
||||||
place = ""
|
|
||||||
|
|
||||||
if _dd.display(date):
|
|
||||||
if date.get_day() and date.get_month() and self.fullDate:
|
|
||||||
fulldate = _dd.display(date)
|
|
||||||
elif date.get_month() and self.fullDate:
|
|
||||||
fulldate= "%s %s" % (date.get_month(), date.get_year())
|
|
||||||
else: fulldate= ""
|
|
||||||
elif self.blankDate:
|
|
||||||
fulldate= "_____________"
|
|
||||||
else: fulldate= ""
|
|
||||||
|
|
||||||
if fulldate:
|
|
||||||
if place:
|
|
||||||
t= _(" %s died on %s in %s") % (firstName, fulldate, place)
|
|
||||||
else: t= _(" %s died on %s") % (firstName, fulldate)
|
|
||||||
elif date.get_year() > 0:
|
|
||||||
if place:
|
|
||||||
t= _(" %s died in %s in %s") % (firstName, date.get_year(), place)
|
|
||||||
else: t= _(" %s died in %s") % (firstName, date.get_year())
|
|
||||||
elif place:
|
|
||||||
t= _(" %s died in %s") % (firstName, place)
|
|
||||||
|
|
||||||
if self.calcAgeFlag:
|
|
||||||
t= t + self.calcAge(person)
|
|
||||||
|
|
||||||
if t != "":
|
|
||||||
self.doc.write_text(t)
|
|
||||||
else:
|
|
||||||
return
|
|
||||||
|
|
||||||
t= ""
|
|
||||||
famList = person.get_family_handle_list()
|
|
||||||
if len(famList) > 0:
|
|
||||||
for fam_id in famList:
|
|
||||||
fam = self.database.get_family_from_handle(fam_id)
|
|
||||||
buried = None
|
|
||||||
if buried:
|
|
||||||
date = buried.get_date_object()
|
|
||||||
place = buried.get_place_name()
|
|
||||||
if place[-1:] == '.':
|
|
||||||
place = place[:-1]
|
|
||||||
fulldate= ""
|
|
||||||
if date.get_date() != "":
|
|
||||||
if date.getDayValid() and date.getMonthValid() and \
|
|
||||||
self.fullDate:
|
|
||||||
fulldate= date.get_date()
|
|
||||||
elif self.blankDate:
|
|
||||||
fulldate= "___________"
|
|
||||||
|
|
||||||
if fulldate != "" and place != "":
|
|
||||||
t= _(" And %s was buried on %s in %s.") % (firstName, fulldate, place)
|
|
||||||
elif fulldate != "" and place == "":
|
|
||||||
t= _(" And %s was buried on %s.") % (firstName, fulldate)
|
|
||||||
elif fulldate == "" and place != "":
|
|
||||||
t= _(" And %s was buried in %s.") % (firstName, place)
|
|
||||||
|
|
||||||
if t != "":
|
|
||||||
self.doc.write_text(t)
|
|
||||||
else: self.doc.write_text(".")
|
|
||||||
|
|
||||||
def write_parents(self, person, firstName):
|
|
||||||
""" Ouptut parents sentence
|
|
||||||
Statement format:
|
|
||||||
|
|
||||||
FIRSTNAME is the son of FATHER and MOTHER.
|
|
||||||
FIRSTNAME is the son of FATHER.
|
|
||||||
FIRSTNAME is the son of MOTHER.
|
|
||||||
FIRSTNAME is the daughter of FATHER and MOTHER.
|
|
||||||
FIRSTNAME is the daughter of FATHER.
|
|
||||||
FIRSTNAME is the daughter of MOTHER.
|
|
||||||
"""
|
|
||||||
ext_family_handle = person.get_main_parents_family_handle()
|
|
||||||
if ext_family_handle:
|
|
||||||
ext_family = self.database.get_family_from_handle(ext_family_handle)
|
|
||||||
if ext_family.get_father_handle():
|
|
||||||
father_obj = self.database.get_person_from_handle(ext_family.get_father_handle())
|
|
||||||
father = father_obj.get_primary_name().get_regular_name()
|
|
||||||
else:
|
|
||||||
father= ""
|
|
||||||
if ext_family.get_mother_handle():
|
|
||||||
mother_obj = self.database.get_person_from_handle(ext_family.get_mother_handle())
|
|
||||||
mother = mother_obj.get_primary_name().get_regular_name()
|
|
||||||
else:
|
|
||||||
mother= ""
|
|
||||||
|
|
||||||
if father or mother:
|
|
||||||
if person.get_gender() == RelLib.Person.MALE:
|
|
||||||
if father:
|
|
||||||
if mother:
|
|
||||||
self.doc.write_text(_(" %s is the son of %s and %s.") % \
|
|
||||||
(firstName, father, mother))
|
|
||||||
else:
|
|
||||||
self.doc.write_text(_(" %s is the son of %s.") % \
|
|
||||||
(firstName, father))
|
|
||||||
else:
|
|
||||||
self.doc.write_text(_(" %s is the son of %s.") % \
|
|
||||||
(firstName, mother))
|
|
||||||
else:
|
|
||||||
if father:
|
|
||||||
if mother:
|
|
||||||
self.doc.write_text(_(" %s is the daughter of %s and %s.") % \
|
|
||||||
(firstName, father, mother))
|
|
||||||
else:
|
|
||||||
self.doc.write_text(_(" %s is the daughter of %s.") % \
|
|
||||||
(firstName, father))
|
|
||||||
else:
|
|
||||||
self.doc.write_text(_(" %s is the daughter of %s.") % \
|
|
||||||
(firstName, mother))
|
|
||||||
|
|
||||||
|
|
||||||
def write_marriage(self, person):
|
|
||||||
""" Output marriage sentence
|
|
||||||
HE/SHE married SPOUSE on FULLDATE in PLACE.
|
|
||||||
HE/SHE married SPOUSE on FULLDATE.
|
|
||||||
HE/SHE married SPOUSE in PLACE.
|
|
||||||
HE/SHE married SPOUSE
|
|
||||||
HE/SHE married on FULLDATE in PLACE.
|
|
||||||
HE/SHE married on FULLDATE.
|
|
||||||
HE/SHE married in PLACE.
|
|
||||||
"""
|
|
||||||
famList= person.get_family_handle_list()
|
|
||||||
if len(famList) > 0:
|
|
||||||
fam_num= 0
|
|
||||||
endOfSent= ""
|
|
||||||
for fam_id in famList:
|
|
||||||
fam = self.database.get_family_from_handle(fam_id)
|
|
||||||
fam_num= fam_num + 1
|
|
||||||
spouse= ""
|
|
||||||
t= ""
|
|
||||||
if person.get_gender() == RelLib.Person.MALE:
|
|
||||||
if fam.get_mother_handle():
|
|
||||||
mother = self.database.get_person_from_handle(fam.get_mother_handle())
|
|
||||||
spouse = mother.get_primary_name().get_regular_name()
|
|
||||||
if fam_num == 1:
|
|
||||||
heshe = _("He")
|
|
||||||
elif fam_num < len(famList):
|
|
||||||
heshe = _(",")
|
|
||||||
else: heshe = _("and he")
|
|
||||||
else:
|
|
||||||
if fam_num == 1:
|
|
||||||
heshe = _("She")
|
|
||||||
elif fam_num < len(famList):
|
|
||||||
heshe = _(",")
|
|
||||||
else: heshe = _("and she")
|
|
||||||
|
|
||||||
if fam.get_father_handle():
|
|
||||||
father = self.database.get_person_from_handle(fam.get_father_handle())
|
|
||||||
spouse = father.get_primary_name().get_regular_name()
|
|
||||||
|
|
||||||
for event_handle in fam.get_event_list():
|
|
||||||
if event_handle:
|
|
||||||
event = self.database.get_event_from_handle(event_handle)
|
|
||||||
if event.get_name() == "Marriage":
|
|
||||||
marriage = event
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
marriage = None
|
|
||||||
|
|
||||||
fulldate = ""
|
|
||||||
place = ""
|
|
||||||
if marriage:
|
|
||||||
if marriage.get_place_handle():
|
|
||||||
place = self.database.get_place_from_handle(marriage.get_place_handle()).get_title()
|
|
||||||
elif self.blankPlace:
|
|
||||||
place= "____________"
|
|
||||||
|
|
||||||
date = marriage.get_date_object()
|
|
||||||
if date:
|
|
||||||
if date.get_year_valid():
|
|
||||||
if date.get_day_valid() and date.get_month_valid() and \
|
|
||||||
self.fullDate:
|
|
||||||
fulldate = _dd.display(date)
|
|
||||||
elif self.blankDate:
|
|
||||||
fulldate= "__________"
|
|
||||||
|
|
||||||
if spouse:
|
|
||||||
if not fulldate and not place:
|
|
||||||
t= _(" %s married %s") % (heshe, spouse)
|
|
||||||
elif not fulldate and place:
|
|
||||||
t= _(" %s married %s in %s") % (heshe, spouse, place)
|
|
||||||
elif fulldate and not place:
|
|
||||||
t= _(" %s married %s on %s") % (heshe, spouse, fulldate)
|
|
||||||
else:
|
|
||||||
t= _(" %s married %s on %s in %s") % \
|
|
||||||
(heshe, spouse, fulldate, place)
|
|
||||||
else:
|
|
||||||
if not fulldate and not place:
|
|
||||||
t= _(" %s married") % heshe
|
|
||||||
elif not fulldate and place:
|
|
||||||
t= _(" %s married in %s") % (heshe, place)
|
|
||||||
elif fulldate and not place:
|
|
||||||
t= _(" %s married on %s") % (heshe, fulldate)
|
|
||||||
elif fulldate and place:
|
|
||||||
t= _(" %s married on %s in %s") % \
|
|
||||||
(heshe, fulldate, place)
|
|
||||||
|
|
||||||
if t != "":
|
|
||||||
self.doc.write_text(t)
|
|
||||||
endOfSent= "."
|
|
||||||
if fam_num == len(famList): self.doc.write_text(endOfSent)
|
|
||||||
|
|
||||||
def write_mate(self, mate):
|
def write_mate(self, mate):
|
||||||
"""Output birth, death, parentage, marriage and notes information """
|
"""Output birth, death, parentage, marriage and notes information """
|
||||||
|
|
||||||
@ -682,7 +454,7 @@ class DetAncestorReport(Report.Report):
|
|||||||
|
|
||||||
if person:
|
if person:
|
||||||
if self.addImages:
|
if self.addImages:
|
||||||
self.insert_images(ind)
|
ReportUtils.insert_images(self.database,self.doc,ind)
|
||||||
|
|
||||||
self.doc.start_paragraph("DAR-Entry")
|
self.doc.start_paragraph("DAR-Entry")
|
||||||
|
|
||||||
@ -691,9 +463,21 @@ class DetAncestorReport(Report.Report):
|
|||||||
|
|
||||||
self.doc.write_text(person)
|
self.doc.write_text(person)
|
||||||
|
|
||||||
self.write_birth(ind)
|
text = ReportUtils.born_str(self.database,ind,"",
|
||||||
|
self.EMPTY_DATE,self.EMPTY_PLACE)
|
||||||
|
if text:
|
||||||
|
self.doc.write_text(text)
|
||||||
|
|
||||||
self.write_death(ind, firstName)
|
age,units = self.calc_age(ind)
|
||||||
|
text = ReportUtils.died_str(self.database,ind,heshe,
|
||||||
|
self.EMPTY_DATE,self.EMPTY_PLACE,age,units)
|
||||||
|
if text:
|
||||||
|
self.doc.write_text(text)
|
||||||
|
|
||||||
|
text = ReportUtils.buried_str(self.database,ind,heshe,
|
||||||
|
self.EMPTY_DATE,self.EMPTY_PLACE)
|
||||||
|
if text:
|
||||||
|
self.doc.write_text(text)
|
||||||
|
|
||||||
self.write_parents(ind, firstName)
|
self.write_parents(ind, firstName)
|
||||||
|
|
||||||
@ -703,64 +487,54 @@ class DetAncestorReport(Report.Report):
|
|||||||
and mate.get_gender() == RelLib.Person.MALE:
|
and mate.get_gender() == RelLib.Person.MALE:
|
||||||
self.write_children(fam)
|
self.write_children(fam)
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
def calc_age(self, ind):
|
||||||
#
|
"""
|
||||||
#
|
Calulate age.
|
||||||
#
|
|
||||||
#--------------------------------------------------------------------
|
|
||||||
def insert_images(self, person):
|
|
||||||
|
|
||||||
photos = person.get_media_list()
|
Returns a tuple (age,units) where units is an integer representing
|
||||||
for photo in photos :
|
time units:
|
||||||
object_handle = photo.get_reference_handle()
|
no age info: 0
|
||||||
object = self.database.get_object_from_handle(object_handle)
|
years: 1
|
||||||
if object.get_mime_type()[0:5] == "image":
|
months: 2
|
||||||
file = object.get_path()
|
days: 3
|
||||||
self.doc.add_media_object(file,"row",4.0,4.0)
|
"""
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
age = 0
|
||||||
#
|
units = 0
|
||||||
#
|
if not self.calcAgeFlag:
|
||||||
#
|
return (age,units)
|
||||||
#--------------------------------------------------------------------
|
|
||||||
def write_report(self):
|
|
||||||
self.apply_filter(self.start_person.get_handle(),1)
|
|
||||||
|
|
||||||
name = self.start_person.get_primary_name().get_regular_name()
|
birth_handle = ind.get_birth_handle()
|
||||||
self.doc.start_paragraph("DAR-Title")
|
if birth_handle:
|
||||||
title = _("Detailed Ancestral Report for %s") % name
|
birth = self.database.get_event_from_handle(birth_handle).get_date_object()
|
||||||
self.doc.write_text(title)
|
birth_year_valid = birth.get_year_valid()
|
||||||
self.doc.end_paragraph()
|
else:
|
||||||
|
birth_year_valid = None
|
||||||
|
death_handle = ind.get_death_handle()
|
||||||
|
if death_handle:
|
||||||
|
death = self.database.get_event_from_handle(death_handle).get_date_object()
|
||||||
|
death_year_valid = death.get_year_valid()
|
||||||
|
else:
|
||||||
|
death_year_valid = None
|
||||||
|
|
||||||
keys = self.map.keys()
|
if birth_year_valid and death_year_valid:
|
||||||
keys.sort()
|
age = death.get_year() - birth.get_year()
|
||||||
generation = 0
|
units = 1 # year
|
||||||
need_header = 1
|
if birth.get_month_valid() and death.get_month_valid():
|
||||||
|
if birth.get_month() > death.get_month():
|
||||||
for key in keys :
|
age = age -1
|
||||||
if generation == 0 or key >= 2**generation:
|
if birth.get_day_valid() and death.get_day_valid():
|
||||||
if self.pgbrk and generation > 0:
|
if birth.get_month() == death.get_month() and birth.get_day() > death.get_day():
|
||||||
self.doc.page_break()
|
age = age -1
|
||||||
self.doc.start_paragraph("DAR-Generation")
|
if age == 0:
|
||||||
t = _("%s Generation") % DetAncestorReport.gen[generation+1]
|
age = death.get_month() - birth.get_month() # calc age in months
|
||||||
self.doc.write_text(t)
|
if birth.get_day() > death.get_day():
|
||||||
self.doc.end_paragraph()
|
age = age - 1
|
||||||
generation = generation + 1
|
units = 2 # month
|
||||||
if self.childRef:
|
if age == 0:
|
||||||
self.prevGenIDs= self.genIDs.copy()
|
age = death.get-day() + 31 - birth.get_day() # calc age in days
|
||||||
self.genIDs.clear()
|
units = 3 # day
|
||||||
|
return (age,units)
|
||||||
person_handle = self.map[key]
|
|
||||||
person = self.database.get_person_from_handle(person_handle)
|
|
||||||
self.genIDs[person_handle]= key
|
|
||||||
dupPerson= self.write_person(key)
|
|
||||||
if dupPerson == 0: # Is this a duplicate ind record
|
|
||||||
if person.get_gender() == RelLib.Person.FEMALE and \
|
|
||||||
self.listChildren and \
|
|
||||||
len(person.get_family_handle_list()) > 0:
|
|
||||||
family_handle = person.get_family_handle_list()[0]
|
|
||||||
family = self.database.get_family_from_handle(family_handle)
|
|
||||||
self.write_children(family)
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2004 Bruce J. DeGrasse
|
# Copyright (C) 2000-2002 Bruce J. DeGrasse
|
||||||
|
# Copyright (C) 2000-2005 Donald N. Allingham
|
||||||
#
|
#
|
||||||
# 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
|
||||||
@ -443,7 +444,7 @@ class DetDescendantReport(Report.Report):
|
|||||||
, and was buried in PLACE.
|
, and was buried in PLACE.
|
||||||
.
|
.
|
||||||
"""
|
"""
|
||||||
t= ""
|
t1 = ""
|
||||||
death_handle = person.get_death_handle()
|
death_handle = person.get_death_handle()
|
||||||
if death_handle:
|
if death_handle:
|
||||||
death = self.database.get_event_from_handle(death_handle)
|
death = self.database.get_event_from_handle(death_handle)
|
||||||
@ -474,53 +475,60 @@ class DetDescendantReport(Report.Report):
|
|||||||
|
|
||||||
if fulldate:
|
if fulldate:
|
||||||
if place:
|
if place:
|
||||||
t = _(" %s died on %s in %s") % (firstName, fulldate, place)
|
t1 = _(" %s died on %s in %s") % (firstName, fulldate, place)
|
||||||
else:
|
else:
|
||||||
t = _(" %s died on %s") % (firstName, fulldate)
|
t1 = _(" %s died on %s") % (firstName, fulldate)
|
||||||
elif date_obj.get_year() > 0:
|
elif date_obj.get_year() > 0:
|
||||||
if place:
|
if place:
|
||||||
t = _(" %s died in %s in %s") % (firstName, date_obj.get_year(), place)
|
t1 = _(" %s died in %s in %s") % (firstName, date_obj.get_year(), place)
|
||||||
else:
|
else:
|
||||||
t = _(" %s died in %s") % (firstName, date_obj.get_year())
|
t1 = _(" %s died in %s") % (firstName, date_obj.get_year())
|
||||||
elif place:
|
elif place:
|
||||||
t = _(" %s died in %s") % (firstName, place)
|
t1 = _(" %s died in %s") % (firstName, place)
|
||||||
|
|
||||||
if self.calcAgeFlag:
|
if self.calcAgeFlag:
|
||||||
t = t + self.calcAge(person)
|
t1 = t1 + self.calcAge(person)
|
||||||
|
|
||||||
if t:
|
t2 = ""
|
||||||
self.doc.write_text(t)
|
event_list = person.get_event_list()
|
||||||
|
for event_handle in event_list:
|
||||||
|
if event_handle:
|
||||||
|
event = self.database.get_event_from_handle(event_handle)
|
||||||
|
if event.get_name() == "Burial":
|
||||||
|
burial = event
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
burial = None
|
||||||
|
|
||||||
|
if burial:
|
||||||
|
place = ""
|
||||||
|
if burial.get_place_handle():
|
||||||
|
place = self.database.get_place_from_handle(burial.get_place_handle())
|
||||||
|
elif self.blankPlace:
|
||||||
|
place = "____________"
|
||||||
|
|
||||||
t = ""
|
|
||||||
famList = person.get_family_handle_list()
|
|
||||||
if len(famList):
|
|
||||||
for fam_id in famList:
|
|
||||||
fam = self.database.get_family_from_handle(fam_id)
|
|
||||||
buried = None
|
|
||||||
if buried:
|
|
||||||
date_obj = buried.get_date_object()
|
|
||||||
date_txt = buried.get_date()
|
|
||||||
place = buried.get_place_name()
|
|
||||||
if place[-1:] == '.':
|
if place[-1:] == '.':
|
||||||
place = place[:-1]
|
place = place[:-1]
|
||||||
|
|
||||||
fulldate = ""
|
fulldate = ""
|
||||||
if date_txt:
|
date_obj = burial.get_date_object()
|
||||||
|
if date_obj:
|
||||||
if date_obj.get_day_valid() and date_obj.get_month_valid() and \
|
if date_obj.get_day_valid() and date_obj.get_month_valid() and \
|
||||||
self.fullDate:
|
self.fullDate:
|
||||||
fulldate = date_txt
|
fulldate = burial.get_date()
|
||||||
elif self.blankDate:
|
elif self.blankDate:
|
||||||
fulldate= "___________"
|
fulldate= "___________"
|
||||||
|
|
||||||
if fulldate and place:
|
if fulldate and place:
|
||||||
t = _(" And %s was buried on %s in %s.") % (firstName, fulldate, place)
|
t2 = _(" and %s was buried on %s in %s") % (firstName, fulldate, place)
|
||||||
elif fulldate and not place:
|
elif fulldate and not place:
|
||||||
t = _(" And %s was buried on %s.") % (firstName, fulldate)
|
t2 = _(" and %s was buried on %s") % (firstName, fulldate)
|
||||||
elif not fulldate and place:
|
elif not fulldate and place:
|
||||||
t = _(" And %s was buried in %s.") % (firstName, place)
|
t2 = _(" and %s was buried in %s") % (firstName, place)
|
||||||
|
|
||||||
|
t = t1 + t2
|
||||||
if t:
|
if t:
|
||||||
self.doc.write_text(t)
|
self.doc.write_text(t)
|
||||||
else:
|
|
||||||
self.doc.write_text(".")
|
self.doc.write_text(".")
|
||||||
|
|
||||||
def write_parents(self, person, firstName):
|
def write_parents(self, person, firstName):
|
||||||
@ -581,26 +589,25 @@ class DetDescendantReport(Report.Report):
|
|||||||
HE/SHE married SPOUSE
|
HE/SHE married SPOUSE
|
||||||
"""
|
"""
|
||||||
famList = person.get_family_handle_list()
|
famList = person.get_family_handle_list()
|
||||||
if len(famList):
|
for fam_num in range(len(famList)):
|
||||||
fam_num= 0
|
fam_id = famList[fam_num]
|
||||||
for fam_id in famList:
|
|
||||||
fam = self.database.get_family_from_handle(fam_id)
|
fam = self.database.get_family_from_handle(fam_id)
|
||||||
fam_num= fam_num + 1
|
|
||||||
spouse = ""
|
spouse = ""
|
||||||
|
t = ""
|
||||||
if person.get_gender() == RelLib.Person.MALE:
|
if person.get_gender() == RelLib.Person.MALE:
|
||||||
mother_handle = fam.get_mother_handle()
|
mother_handle = fam.get_mother_handle()
|
||||||
if mother_handle:
|
if mother_handle:
|
||||||
spouse = self.database.get_person_from_handle(mother_handle).get_primary_name().get_regular_name()
|
spouse = self.database.get_person_from_handle(mother_handle).get_primary_name().get_regular_name()
|
||||||
if fam_num == 1:
|
if fam_num == 0:
|
||||||
heshe = _(" He")
|
heshe = _(" He")
|
||||||
elif fam_num < len(famList):
|
elif fam_num < len(famList)-1:
|
||||||
heshe = _(",")
|
heshe = _(",")
|
||||||
else:
|
else:
|
||||||
heshe = _(" and he")
|
heshe = _(" and he")
|
||||||
else:
|
else:
|
||||||
if fam_num == 1:
|
if fam_num == 0:
|
||||||
heshe = _(" She")
|
heshe = _(" She")
|
||||||
elif fam_num < len(famList):
|
elif fam_num < len(famList)-1:
|
||||||
heshe = _(",")
|
heshe = _(",")
|
||||||
else:
|
else:
|
||||||
heshe = _(" and she")
|
heshe = _(" and she")
|
||||||
@ -635,6 +642,7 @@ class DetDescendantReport(Report.Report):
|
|||||||
elif self.blankDate:
|
elif self.blankDate:
|
||||||
fulldate = "__________"
|
fulldate = "__________"
|
||||||
|
|
||||||
|
if fam.get_relationship() == RelLib.Family.MARRIED:
|
||||||
if spouse:
|
if spouse:
|
||||||
if not fulldate and not place:
|
if not fulldate and not place:
|
||||||
t = _("%s married %s") % (heshe, spouse)
|
t = _("%s married %s") % (heshe, spouse)
|
||||||
@ -655,10 +663,15 @@ class DetDescendantReport(Report.Report):
|
|||||||
else:
|
else:
|
||||||
t = _("%s married on %s in %s") % \
|
t = _("%s married on %s in %s") % \
|
||||||
(heshe, fulldate, place)
|
(heshe, fulldate, place)
|
||||||
|
else: # Not a marriage
|
||||||
|
if spouse != "":
|
||||||
|
t = _("%s had a relationship with %s") % (heshe, spouse)
|
||||||
|
else:
|
||||||
|
t = _("%s had a relationship with") % heshe
|
||||||
|
|
||||||
if t:
|
if t != "":
|
||||||
self.doc.write_text(t)
|
self.doc.write_text(t)
|
||||||
if fam_num == len(famList):
|
if fam_num == len(famList)-1:
|
||||||
self.doc.write_text(".")
|
self.doc.write_text(".")
|
||||||
|
|
||||||
def write_mate(self, person):
|
def write_mate(self, person):
|
||||||
@ -769,9 +782,8 @@ class DetDescendantReport(Report.Report):
|
|||||||
self.genIDs[person_handle]= key
|
self.genIDs[person_handle]= key
|
||||||
dupPerson= self.write_person(key)
|
dupPerson= self.write_person(key)
|
||||||
if dupPerson == 0: # Is this a duplicate ind record
|
if dupPerson == 0: # Is this a duplicate ind record
|
||||||
if self.listChildren and \
|
if self.listChildren:
|
||||||
len(person.get_family_handle_list()) > 0:
|
for family_handle in person.get_family_handle_list():
|
||||||
family_handle = person.get_family_handle_list()[0]
|
|
||||||
family = self.database.get_family_from_handle(family_handle)
|
family = self.database.get_family_from_handle(family_handle)
|
||||||
self.write_children(family)
|
self.write_children(family)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user