2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2005-02-01 10:38:16 +05:30
|
|
|
# Copyright (C) 2000-2002 Bruce J. DeGrasse
|
|
|
|
# Copyright (C) 2000-2005 Donald N. Allingham
|
2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# 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
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
2003-12-15 09:48:51 +05:30
|
|
|
# $Id$
|
|
|
|
|
2003-06-03 00:14:39 +05:30
|
|
|
"Generate files/Detailed Descendant Report"
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# standard python modules
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
from gettext import gettext as _
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Gnome/GTK modules
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
import gtk
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GRAMPS modules
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2002-10-20 19:55:16 +05:30
|
|
|
import RelLib
|
2003-02-16 04:33:48 +05:30
|
|
|
import Errors
|
|
|
|
from QuestionDialog import ErrorDialog
|
2003-07-07 22:05:32 +05:30
|
|
|
import Report
|
2003-09-02 06:17:09 +05:30
|
|
|
import BaseDoc
|
2005-01-02 01:28:53 +05:30
|
|
|
import ReportOptions
|
|
|
|
import const
|
|
|
|
from DateHandler import displayer as _dd
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2003-07-07 22:05:32 +05:30
|
|
|
class DetDescendantReport(Report.Report):
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
def __init__(self,database,person,options_class):
|
|
|
|
"""
|
|
|
|
Creates the DetDescendantReport object that produces the report.
|
|
|
|
|
|
|
|
The arguments are:
|
|
|
|
|
|
|
|
database - the GRAMPS database instance
|
|
|
|
person - currently selected person
|
|
|
|
options_class - instance of the Options class for this report
|
|
|
|
|
|
|
|
This report needs the following parameters (class variables)
|
|
|
|
that come in the options class.
|
|
|
|
|
|
|
|
gen - Maximum number of generations to include.
|
|
|
|
pagebgg - Whether to include page breaks between generations.
|
|
|
|
firstName - Whether to use first names instead of pronouns.
|
|
|
|
fullDate - Whether to use full dates instead of just year.
|
|
|
|
listChildren - Whether to list children.
|
|
|
|
includeNotes - Whether to include notes.
|
|
|
|
blankPlace - Whether to replace missing Places with ___________.
|
|
|
|
blankDate - Whether to replace missing Dates with ___________.
|
|
|
|
calcAgeFlag - Whether to compute age.
|
|
|
|
dupPerson - Whether to omit duplicate ancestors (e.g. when distant cousins mary).
|
|
|
|
childRef - Whether to add descendant references in child list.
|
|
|
|
addImages - Whether to include images.
|
|
|
|
"""
|
|
|
|
Report.Report.__init__(self,database,person,options_class)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.map = {}
|
2005-01-02 01:28:53 +05:30
|
|
|
|
|
|
|
(self.max_generations,self.pgbrk) \
|
|
|
|
= options_class.get_report_generations()
|
|
|
|
|
|
|
|
self.firstName = options_class.handler.options_dict['firstnameiop']
|
|
|
|
self.fullDate = options_class.handler.options_dict['fulldates']
|
|
|
|
self.listChildren = options_class.handler.options_dict['listc']
|
|
|
|
self.includeNotes = options_class.handler.options_dict['incnotes']
|
|
|
|
self.blankPlace = options_class.handler.options_dict['repplace']
|
|
|
|
self.blankDate = options_class.handler.options_dict['repdate']
|
|
|
|
self.calcAgeFlag = options_class.handler.options_dict['computeage']
|
|
|
|
self.dupPerson = options_class.handler.options_dict['omitda']
|
|
|
|
self.childRef = options_class.handler.options_dict['desref']
|
|
|
|
self.addImages = options_class.handler.options_dict['incphotos']
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.genIDs = {}
|
|
|
|
self.prevGenIDs= {}
|
|
|
|
self.genKeys = []
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
def apply_filter(self,person_handle,index,cur_gen=1):
|
|
|
|
if (not person_handle) or (cur_gen > self.max_generations):
|
2003-06-04 01:18:33 +05:30
|
|
|
return
|
2004-07-28 07:59:07 +05:30
|
|
|
self.map[index] = person_handle
|
2003-06-04 01:18:33 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
if len(self.genKeys) < cur_gen:
|
|
|
|
self.genKeys.append([index])
|
2003-06-04 01:18:33 +05:30
|
|
|
else:
|
|
|
|
self.genKeys[cur_gen-1].append(index)
|
|
|
|
|
2004-08-07 10:46:57 +05:30
|
|
|
person = self.database.get_person_from_handle(person_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
for family_handle in person.get_family_handle_list():
|
2004-08-20 03:05:16 +05:30
|
|
|
family = self.database.get_family_from_handle(family_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
for child_handle in family.get_child_handle_list():
|
2004-08-20 03:05:16 +05:30
|
|
|
child = self.database.get_family_from_handle(child_handle)
|
2003-06-04 01:18:33 +05:30
|
|
|
ix = max(self.map.keys())
|
2004-07-28 07:59:07 +05:30
|
|
|
self.apply_filter(child_handle, ix+1, cur_gen+1)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
def calcAge(self, ind):
|
|
|
|
""" Calulate age
|
|
|
|
APHRASE=
|
|
|
|
at the age of NUMBER UNIT(S)
|
|
|
|
UNIT= year | month | day
|
|
|
|
UNITS= years | months | days
|
|
|
|
null
|
|
|
|
"""
|
|
|
|
|
|
|
|
birth_handle = ind.get_birth_handle()
|
|
|
|
if birth_handle:
|
|
|
|
birth = self.database.get_event_from_handle(birth_handle).get_date_object()
|
|
|
|
birth_year_valid = birth.get_year_valid()
|
|
|
|
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
|
|
|
|
|
|
|
|
the_text = ""
|
|
|
|
if birth_year_valid and death_year_valid:
|
|
|
|
age = death.get_year() - birth.get_year()
|
|
|
|
units = 3 # year
|
|
|
|
if birth.get_month_valid() and death.get_month_valid():
|
|
|
|
if birth.get_month() > death.get_month():
|
|
|
|
age = age -1
|
|
|
|
if birth.get_day_valid() and death.get_day_valid():
|
|
|
|
if birth.get_month() == death.get_month() and birth.get_day() > death.get_day():
|
|
|
|
age = age -1
|
|
|
|
if age == 0:
|
|
|
|
age = death.get_month() - birth.get_month() # calc age in months
|
|
|
|
if birth.get_day() > death.get_day():
|
|
|
|
age = age - 1
|
|
|
|
units = 2 # month
|
|
|
|
if age == 0:
|
|
|
|
age = death.get-day() + 31 - birth.get_day() # calc age in days
|
|
|
|
units = 1 # day
|
|
|
|
if age > 1:
|
|
|
|
if units == 1:
|
|
|
|
the_text = _(" at the age of %d days") % age
|
|
|
|
elif units == 2:
|
|
|
|
the_text = _(" at the age of %d months") % age
|
|
|
|
else:
|
|
|
|
the_text = _(" at the age of %d years") % age
|
|
|
|
else:
|
|
|
|
if units == 1:
|
|
|
|
the_text = _(" at the age of %d day") % age
|
|
|
|
elif units == 2:
|
|
|
|
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):
|
2002-10-20 19:55:16 +05:30
|
|
|
""" List children
|
|
|
|
Statement formats:
|
|
|
|
Child of MOTHER and FATHER is:
|
|
|
|
Children of MOTHER and FATHER are:
|
|
|
|
|
|
|
|
NAME Born: DATE PLACE Died: DATE PLACE f
|
|
|
|
NAME Born: DATE PLACE Died: DATE e
|
|
|
|
NAME Born: DATE PLACE Died: PLACE d
|
|
|
|
NAME Born: DATE PLACE c
|
2003-02-16 04:33:48 +05:30
|
|
|
NAME Born: DATE Died: DATE PLACE b
|
|
|
|
NAME Born: DATE Died: DATE a
|
|
|
|
NAME Born: DATE Died: PLACE 9
|
2002-10-20 19:55:16 +05:30
|
|
|
NAME Born: DATE 8
|
|
|
|
NAME Born: PLACE Died: DATE PLACE 7
|
|
|
|
NAME Born: PLACE Died: DATE 6
|
|
|
|
NAME Born: PLACE Died: PLACE 5
|
|
|
|
NAME Born: PLACE 4
|
|
|
|
NAME Died: DATE 2
|
|
|
|
NAME Died: DATE PLACE 3
|
|
|
|
NAME Died: PLACE 1
|
|
|
|
NAME 0
|
|
|
|
"""
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
num_children = len(family.get_child_handle_list())
|
2004-05-04 06:50:21 +05:30
|
|
|
if num_children:
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph("DDR-ChildTitle")
|
2004-07-28 07:59:07 +05:30
|
|
|
mother_handle = family.get_mother_handle()
|
|
|
|
if mother_handle:
|
2004-08-07 10:46:57 +05:30
|
|
|
mother = self.database.get_person_from_handle(mother_handle).get_primary_name().get_regular_name()
|
2004-05-04 06:50:21 +05:30
|
|
|
else:
|
|
|
|
mother = _("unknown")
|
2004-07-28 07:59:07 +05:30
|
|
|
father_handle = family.get_father_handle()
|
|
|
|
if father_handle:
|
2004-08-07 10:46:57 +05:30
|
|
|
father = self.database.get_person_from_handle(father_handle).get_primary_name().get_regular_name()
|
2004-05-04 06:50:21 +05:30
|
|
|
else:
|
|
|
|
father = _("unknown")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.start_bold()
|
|
|
|
if num_children == 1:
|
|
|
|
self.doc.write_text(_("Child of %s and %s is:") % (mother, father))
|
2004-05-04 06:50:21 +05:30
|
|
|
else:
|
|
|
|
self.doc.write_text(_("Children of %s and %s are:") % (mother, father))
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.end_bold()
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
for child_handle in family.get_child_handle_list():
|
2004-08-07 10:46:57 +05:30
|
|
|
child = self.database.get_person_from_handle(child_handle)
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph("DDR-ChildList")
|
2004-05-04 06:50:21 +05:30
|
|
|
name = child.get_primary_name().get_regular_name()
|
2004-07-28 07:59:07 +05:30
|
|
|
birth_handle = child.get_birth_handle()
|
|
|
|
death_handle = child.get_death_handle()
|
2005-01-02 01:28:53 +05:30
|
|
|
if self.childRef:
|
2004-07-28 07:59:07 +05:30
|
|
|
if self.prevGenIDs.get(child_handle) != None:
|
|
|
|
name= "[" + str(self.prevGenIDs.get(child_handle)) + "] "+ name
|
2004-05-04 06:50:21 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
if birth_handle:
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
birth = self.database.get_event_from_handle(birth_handle)
|
2004-05-04 06:50:21 +05:30
|
|
|
else:
|
|
|
|
birth = None
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
if death_handle:
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
death = self.database.get_event_from_handle(death_handle)
|
2004-05-04 06:50:21 +05:30
|
|
|
else:
|
|
|
|
death = None
|
|
|
|
|
|
|
|
if birth and birth.get_date():
|
2004-07-28 07:59:07 +05:30
|
|
|
if birth.get_place_handle():
|
2004-08-07 10:46:57 +05:30
|
|
|
bplace = self.database.get_place_from_handle(birth.get_place_handle()).get_title()
|
2004-05-04 06:50:21 +05:30
|
|
|
if death and death.get_date():
|
2004-07-28 07:59:07 +05:30
|
|
|
if death.get_place_handle():
|
2004-08-07 10:46:57 +05:30
|
|
|
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \
|
2004-05-04 06:50:21 +05:30
|
|
|
(name, birth.get_date(), bplace,
|
|
|
|
death.get_date(), dplace)) # f
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
self.doc.write_text(_("- %s Born: %s %s Died: %s") % \
|
2004-05-04 06:50:21 +05:30
|
|
|
(name, birth.get_date(), bplace,
|
2004-02-14 11:10:30 +05:30
|
|
|
death.get_date())) # e
|
2004-07-28 07:59:07 +05:30
|
|
|
elif death and death.get_place_handle():
|
2004-08-07 10:46:57 +05:30
|
|
|
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
|
2004-05-04 06:50:21 +05:30
|
|
|
self.doc.write_text(_("- %s Born: %s %s Died: %s") % \
|
|
|
|
(name, birth.get_date(), bplace,
|
|
|
|
dplace)) # d
|
2002-10-20 19:55:16 +05:30
|
|
|
else: self.doc.write_text(_("- %s Born: %s %s") % \
|
2004-05-04 06:50:21 +05:30
|
|
|
(name, birth.get_date(), bplace)) # c
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-05-04 06:50:21 +05:30
|
|
|
if death and death.get_date():
|
2004-07-28 07:59:07 +05:30
|
|
|
if death.get_place_handle():
|
2004-08-07 10:46:57 +05:30
|
|
|
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.write_text(_("- %s Born: %s Died: %s %s") % \
|
2004-02-14 11:10:30 +05:30
|
|
|
(name, birth.get_date(), death.get_date(), \
|
2004-05-04 06:50:21 +05:30
|
|
|
dplace)) # b
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
self.doc.write_text(_("- %s Born: %s Died: %s") % \
|
2004-02-14 11:10:30 +05:30
|
|
|
(name, birth.get_date(), death.get_date())) # a
|
2004-07-28 07:59:07 +05:30
|
|
|
elif death and death.get_place_handle():
|
2004-08-07 10:46:57 +05:30
|
|
|
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
|
2004-05-04 06:50:21 +05:30
|
|
|
self.doc.write_text(_("- %s Born: %s Died: %s") % \
|
|
|
|
(name, birth.get_date(), dplace)) # 9
|
|
|
|
else:
|
|
|
|
self.doc.write_text(_("- %s Born: %s") % \
|
|
|
|
(name, birth.get_date())) # 8
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
if birth and birth.get_place_handle():
|
2004-08-07 10:46:57 +05:30
|
|
|
bplace = self.database.get_place_from_handle(birth.get_place_handle()).get_title()
|
2004-05-04 06:50:21 +05:30
|
|
|
if death and death.get_date():
|
2004-07-28 07:59:07 +05:30
|
|
|
if death.get_place_handle():
|
2004-08-07 10:46:57 +05:30
|
|
|
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.write_text(_("- %s Born: %s Died: %s %s") % \
|
2004-05-04 06:50:21 +05:30
|
|
|
(name, bplace, \
|
|
|
|
death.get_date(), dplace)) # 7
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
self.doc.write_text(_("- %s Born: %s Died: %s") % \
|
2004-05-04 06:50:21 +05:30
|
|
|
(name, bplace, death.get_date())) # 6
|
2004-07-28 07:59:07 +05:30
|
|
|
elif death and death.get_place_handle():
|
2004-08-07 10:46:57 +05:30
|
|
|
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
|
2004-05-04 06:50:21 +05:30
|
|
|
self.doc.write_text(_("- %s Born: %s Died: %s") % \
|
|
|
|
(name, bplace, dplace)) # 5
|
|
|
|
else:
|
|
|
|
self.doc.write_text(_("- %s Born: %s") % \
|
|
|
|
(name, bplace)) # 4
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-05-04 06:50:21 +05:30
|
|
|
if death and death.get_date():
|
2004-07-28 07:59:07 +05:30
|
|
|
if death.get_place_handle():
|
2004-08-07 10:46:57 +05:30
|
|
|
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.write_text(_("- %s Died: %s %s") % \
|
2004-05-04 06:50:21 +05:30
|
|
|
(name, death.get_date(), dplace)) # 3
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
self.doc.write_text(_("- %s Died: %s") % \
|
2004-02-14 11:10:30 +05:30
|
|
|
(name, death.get_date())) # 2
|
2004-07-28 07:59:07 +05:30
|
|
|
elif death and death.get_place_handle():
|
2004-08-07 10:46:57 +05:30
|
|
|
dplace = self.database.get_place_from_handle(death.get_place_handle()).get_title()
|
2004-05-04 06:50:21 +05:30
|
|
|
self.doc.write_text(_("- %s Died: %s") % \
|
|
|
|
(name, dplace)) # 1
|
|
|
|
else:
|
|
|
|
self.doc.write_text(_("- %s") % name) # 0
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
def write_person(self, key):
|
2002-10-20 19:55:16 +05:30
|
|
|
"""Output birth, death, parentage, marriage and notes information """
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
person_handle = self.map[key]
|
2004-08-07 10:46:57 +05:30
|
|
|
person = self.database.get_person_from_handle(person_handle)
|
2005-01-02 01:28:53 +05:30
|
|
|
if self.addImages:
|
2004-01-08 04:10:04 +05:30
|
|
|
self.insert_images(person)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-22 10:47:14 +05:30
|
|
|
self.doc.start_paragraph("DDR-First-Entry","%s." % str(key))
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
name = person.get_primary_name().get_regular_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
if self.firstName:
|
2004-05-04 06:50:21 +05:30
|
|
|
firstName = person.get_primary_name().get_first_name()
|
2005-02-01 09:16:29 +05:30
|
|
|
elif person.get_gender() == RelLib.Person.MALE:
|
2004-05-04 06:50:21 +05:30
|
|
|
firstName = _("He")
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-05-04 06:50:21 +05:30
|
|
|
firstName = _("She")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.doc.start_bold()
|
|
|
|
self.doc.write_text(name)
|
|
|
|
self.doc.end_bold()
|
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
if self.dupPerson:
|
2002-10-20 19:55:16 +05:30
|
|
|
# Check for duplicate record (result of distant cousins marrying)
|
|
|
|
keys = self.map.keys()
|
|
|
|
keys.sort()
|
|
|
|
for dkey in keys:
|
2004-05-04 06:50:21 +05:30
|
|
|
if dkey >= key:
|
|
|
|
break
|
|
|
|
if self.map[key] == self.map[dkey]:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.write_text(_(" is the same person as [%s].") % str(dkey))
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
return 1 # Duplicate person
|
|
|
|
|
|
|
|
# Check birth record
|
2004-07-28 07:59:07 +05:30
|
|
|
birth_handle = person.get_birth_handle()
|
|
|
|
if birth_handle:
|
2005-01-02 01:28:53 +05:30
|
|
|
self.write_birth(person)
|
|
|
|
self.write_death(person, firstName)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.write_parents(person, firstName)
|
2005-01-02 01:28:53 +05:30
|
|
|
self.write_marriage(person)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.end_paragraph()
|
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
self.write_mate(person)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
if person.get_note() and self.includeNotes:
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph("DDR-NoteHeader")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.start_bold()
|
|
|
|
self.doc.write_text(_("Notes for %s" % name))
|
|
|
|
self.doc.end_bold()
|
|
|
|
self.doc.end_paragraph()
|
2004-02-14 11:10:30 +05:30
|
|
|
self.doc.write_note(person.get_note(),person.get_note_format(),"DDR-Entry")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
return 0 # Not duplicate person
|
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
def write_birth(self, person):
|
2002-10-20 19:55:16 +05:30
|
|
|
""" 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 ____________.
|
|
|
|
"""
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
birth_handle = person.get_birth_handle()
|
|
|
|
if birth_handle:
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
birth = self.database.get_event_from_handle(birth_handle)
|
2004-10-28 21:51:33 +05:30
|
|
|
date_obj = birth.get_date_object()
|
2005-02-01 10:38:16 +05:30
|
|
|
date_txt = birth.get_date()
|
2004-07-28 07:59:07 +05:30
|
|
|
if birth.get_place_handle():
|
2004-08-07 10:46:57 +05:30
|
|
|
place = self.database.get_place_from_handle(birth.get_place_handle()).get_title()
|
2002-10-20 19:55:16 +05:30
|
|
|
if place[-1:] == '.':
|
|
|
|
place = place[:-1]
|
2005-01-02 01:28:53 +05:30
|
|
|
elif self.blankDate:
|
2004-05-04 06:50:21 +05:30
|
|
|
place = "______________"
|
|
|
|
else:
|
|
|
|
place = ""
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-10-28 21:51:33 +05:30
|
|
|
if date_txt:
|
|
|
|
if date_obj.get_day_valid() and date_obj.get_month_valid() and \
|
2005-01-02 01:28:53 +05:30
|
|
|
self.fullDate:
|
2004-05-04 06:50:21 +05:30
|
|
|
if place:
|
2004-10-28 21:51:33 +05:30
|
|
|
self.doc.write_text(_(" was born on %s in %s.") % (date_txt, place))
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-10-28 21:51:33 +05:30
|
|
|
self.doc.write_text(_(" was born on %s.") % date_txt )
|
2004-05-04 06:50:21 +05:30
|
|
|
elif place:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.write_text(_(" was born in the year %s in %s.") % \
|
2004-10-28 21:51:33 +05:30
|
|
|
(date_obj.get_year(), place))
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-10-28 21:51:33 +05:30
|
|
|
self.doc.write_text(_(" was born in the year %s.") % date_obj.get_year())
|
2004-05-04 06:50:21 +05:30
|
|
|
elif place:
|
2003-02-16 04:33:48 +05:30
|
|
|
self.doc.write_text(_(" was born in %s.") % place)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
self.doc.write_text(_("."))
|
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
def write_death(self, person, firstName):
|
2002-10-20 19:55:16 +05:30
|
|
|
""" 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.
|
|
|
|
.
|
|
|
|
"""
|
2005-02-01 10:38:16 +05:30
|
|
|
t1 = ""
|
2004-07-28 07:59:07 +05:30
|
|
|
death_handle = person.get_death_handle()
|
|
|
|
if death_handle:
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
death = self.database.get_event_from_handle(death_handle)
|
2004-10-28 21:51:33 +05:30
|
|
|
date_obj = death.get_date_object()
|
|
|
|
date_txt = death.get_date()
|
2004-07-28 07:59:07 +05:30
|
|
|
place_handle = death.get_place_handle()
|
|
|
|
if place_handle:
|
2004-08-07 10:46:57 +05:30
|
|
|
place = self.database.get_place_from_handle(place_handle).get_title()
|
2004-05-04 06:50:21 +05:30
|
|
|
if place[-1:] == '.':
|
|
|
|
place = place[:-1]
|
2005-01-02 01:28:53 +05:30
|
|
|
elif self.blankPlace:
|
2004-05-04 06:50:21 +05:30
|
|
|
place = "_____________"
|
|
|
|
else:
|
|
|
|
place = ""
|
|
|
|
|
2004-10-28 21:51:33 +05:30
|
|
|
if date_txt:
|
|
|
|
if date_obj.get_day() and date_obj.get_month() and \
|
2005-01-02 01:28:53 +05:30
|
|
|
self.fullDate:
|
2004-10-28 21:51:33 +05:30
|
|
|
fulldate = date_txt
|
2005-01-02 01:28:53 +05:30
|
|
|
elif date_obj.get_month() and self.fullDate:
|
2004-10-28 21:51:33 +05:30
|
|
|
fulldate = "%s %s" % (date_obj.get_month(), date_obj.get_year())
|
2004-05-04 06:50:21 +05:30
|
|
|
else:
|
|
|
|
fulldate = ""
|
2005-01-02 01:28:53 +05:30
|
|
|
elif self.blankDate:
|
2004-05-04 06:50:21 +05:30
|
|
|
fulldate = "_____________"
|
|
|
|
else:
|
|
|
|
fulldate = ""
|
|
|
|
|
|
|
|
if fulldate:
|
|
|
|
if place:
|
2005-02-01 10:38:16 +05:30
|
|
|
t1 = _(" %s died on %s in %s") % (firstName, fulldate, place)
|
2004-05-04 06:50:21 +05:30
|
|
|
else:
|
2005-02-01 10:38:16 +05:30
|
|
|
t1 = _(" %s died on %s") % (firstName, fulldate)
|
2004-10-28 21:51:33 +05:30
|
|
|
elif date_obj.get_year() > 0:
|
2004-05-04 06:50:21 +05:30
|
|
|
if place:
|
2005-02-01 10:38:16 +05:30
|
|
|
t1 = _(" %s died in %s in %s") % (firstName, date_obj.get_year(), place)
|
2004-05-04 06:50:21 +05:30
|
|
|
else:
|
2005-02-01 10:38:16 +05:30
|
|
|
t1 = _(" %s died in %s") % (firstName, date_obj.get_year())
|
2004-05-04 06:50:21 +05:30
|
|
|
elif place:
|
2005-02-01 10:38:16 +05:30
|
|
|
t1 = _(" %s died in %s") % (firstName, place)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
if self.calcAgeFlag:
|
2005-02-01 10:38:16 +05:30
|
|
|
t1 = t1 + self.calcAge(person)
|
|
|
|
|
|
|
|
t2 = ""
|
|
|
|
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
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-01 10:38:16 +05:30
|
|
|
if burial:
|
|
|
|
place = ""
|
|
|
|
if burial.get_place_handle():
|
|
|
|
place = self.database.get_place_from_handle(burial.get_place_handle())
|
|
|
|
elif self.blankPlace:
|
|
|
|
place = "____________"
|
|
|
|
|
|
|
|
if place[-1:] == '.':
|
|
|
|
place = place[:-1]
|
|
|
|
|
|
|
|
fulldate = ""
|
|
|
|
date_obj = burial.get_date_object()
|
|
|
|
if date_obj:
|
|
|
|
if date_obj.get_day_valid() and date_obj.get_month_valid() and \
|
|
|
|
self.fullDate:
|
|
|
|
fulldate = burial.get_date()
|
|
|
|
elif self.blankDate:
|
|
|
|
fulldate= "___________"
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-01 10:38:16 +05:30
|
|
|
if fulldate and place:
|
|
|
|
t2 = _(" and %s was buried on %s in %s") % (firstName, fulldate, place)
|
|
|
|
elif fulldate and not place:
|
|
|
|
t2 = _(" and %s was buried on %s") % (firstName, fulldate)
|
|
|
|
elif not fulldate and place:
|
|
|
|
t2 = _(" and %s was buried in %s") % (firstName, place)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-01 10:38:16 +05:30
|
|
|
t = t1 + t2
|
2004-05-04 06:50:21 +05:30
|
|
|
if t:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.write_text(t)
|
2004-05-04 06:50:21 +05:30
|
|
|
self.doc.write_text(".")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def write_parents(self, person, firstName):
|
|
|
|
""" Ouptut parents sentence
|
|
|
|
Statement format:
|
|
|
|
|
2004-02-23 00:54:31 +05:30
|
|
|
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.
|
2002-10-20 19:55:16 +05:30
|
|
|
"""
|
2004-07-28 07:59:07 +05:30
|
|
|
ext_family_handle = person.get_main_parents_family_handle()
|
|
|
|
if ext_family_handle:
|
2004-08-20 03:05:16 +05:30
|
|
|
ext_family = self.database.get_family_from_handle(ext_family_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
father_handle = ext_family.get_father_handle()
|
|
|
|
if father_handle:
|
2004-08-07 10:46:57 +05:30
|
|
|
father = self.database.get_person_from_handle(father_handle).get_primary_name().get_regular_name()
|
2004-05-04 06:50:21 +05:30
|
|
|
else:
|
|
|
|
father = ""
|
2004-07-28 07:59:07 +05:30
|
|
|
mother_handle = ext_family.get_father_handle()
|
|
|
|
if mother_handle:
|
2004-08-07 10:46:57 +05:30
|
|
|
mother = self.database.get_person_from_handle(mother_handle).get_primary_name().get_regular_name()
|
2004-05-04 06:50:21 +05:30
|
|
|
else:
|
|
|
|
mother = ""
|
|
|
|
|
|
|
|
if father or mother:
|
2005-02-01 09:16:29 +05:30
|
|
|
if person.get_gender() == RelLib.Person.MALE:
|
2004-05-04 06:50:21 +05:30
|
|
|
if father:
|
|
|
|
if mother:
|
2004-02-23 00:54:31 +05:30
|
|
|
self.doc.write_text(_(" %s is the son of %s and %s.") % \
|
2003-02-16 04:33:48 +05:30
|
|
|
(firstName, father, mother))
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-02-23 00:54:31 +05:30
|
|
|
self.doc.write_text(_(" %s is the son of %s.") % \
|
2003-02-16 04:33:48 +05:30
|
|
|
(firstName, father))
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-02-23 00:54:31 +05:30
|
|
|
self.doc.write_text(_(" %s is the son of %s.") % \
|
2003-02-16 04:33:48 +05:30
|
|
|
(firstName, mother))
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-05-04 06:50:21 +05:30
|
|
|
if father:
|
|
|
|
if mother:
|
2004-02-23 00:54:31 +05:30
|
|
|
self.doc.write_text(_(" %s is the daughter of %s and %s.") % \
|
2003-02-16 04:33:48 +05:30
|
|
|
(firstName, father, mother))
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-02-23 00:54:31 +05:30
|
|
|
self.doc.write_text(_(" %s is the daughter of %s.") % \
|
2003-02-16 04:33:48 +05:30
|
|
|
(firstName, father))
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-02-23 00:54:31 +05:30
|
|
|
self.doc.write_text(_(" %s is the daughter of %s.") % \
|
2003-02-16 04:33:48 +05:30
|
|
|
(firstName, mother))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
def write_marriage(self, person):
|
2002-10-20 19:55:16 +05:30
|
|
|
""" Output marriage sentence
|
|
|
|
HE/SHE married SPOUSE on FULLDATE in PLACE.
|
|
|
|
HE/SHE married SPOUSE on FULLDATE.
|
|
|
|
HE/SHE married SPOUSE in PLACE.
|
2003-02-16 04:33:48 +05:30
|
|
|
HE/SHE married SPOUSE
|
2002-10-20 19:55:16 +05:30
|
|
|
"""
|
2004-07-28 07:59:07 +05:30
|
|
|
famList = person.get_family_handle_list()
|
2005-02-01 10:38:16 +05:30
|
|
|
for fam_num in range(len(famList)):
|
|
|
|
fam_id = famList[fam_num]
|
|
|
|
fam = self.database.get_family_from_handle(fam_id)
|
|
|
|
spouse = ""
|
|
|
|
t = ""
|
|
|
|
if person.get_gender() == RelLib.Person.MALE:
|
|
|
|
mother_handle = fam.get_mother_handle()
|
|
|
|
if mother_handle:
|
|
|
|
spouse = self.database.get_person_from_handle(mother_handle).get_primary_name().get_regular_name()
|
|
|
|
if fam_num == 0:
|
|
|
|
heshe = _(" He")
|
|
|
|
elif fam_num < len(famList)-1:
|
|
|
|
heshe = _(",")
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-02-01 10:38:16 +05:30
|
|
|
heshe = _(" and he")
|
|
|
|
else:
|
|
|
|
if fam_num == 0:
|
|
|
|
heshe = _(" She")
|
|
|
|
elif fam_num < len(famList)-1:
|
|
|
|
heshe = _(",")
|
2004-05-04 06:50:21 +05:30
|
|
|
else:
|
2005-02-01 10:38:16 +05:30
|
|
|
heshe = _(" and she")
|
2004-05-04 06:50:21 +05:30
|
|
|
|
2005-02-01 10:38:16 +05:30
|
|
|
father_handle = fam.get_father_handle()
|
|
|
|
if father_handle:
|
|
|
|
spouse = self.database.get_person_from_handle(father_handle).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_obj = marriage.get_date_object()
|
|
|
|
if date_obj:
|
|
|
|
if date_obj.get_year_valid():
|
|
|
|
if date_obj.get_day_valid() and date_obj.get_month_valid() and \
|
2005-01-02 01:28:53 +05:30
|
|
|
self.fullDate:
|
2005-02-01 10:38:16 +05:30
|
|
|
fulldate = marriage.get_date()
|
|
|
|
elif self.blankDate:
|
|
|
|
fulldate = "__________"
|
2004-05-04 06:50:21 +05:30
|
|
|
|
2005-02-01 10:38:16 +05:30
|
|
|
if fam.get_relationship() == RelLib.Family.MARRIED:
|
2004-05-04 06:50:21 +05:30
|
|
|
if spouse:
|
|
|
|
if not fulldate and not place:
|
2005-02-01 10:38:16 +05:30
|
|
|
t = _("%s married %s") % (heshe, spouse)
|
2004-05-04 06:50:21 +05:30
|
|
|
elif not fulldate and place:
|
2005-02-01 10:38:16 +05:30
|
|
|
t = _("%s married %s in %s") % (heshe, spouse, place)
|
2004-05-04 06:50:21 +05:30
|
|
|
elif fulldate and not place:
|
2005-02-01 10:38:16 +05:30
|
|
|
t = _("%s married %s on %s") % (heshe, spouse, fulldate)
|
2004-05-04 06:50:21 +05:30
|
|
|
else:
|
2005-02-01 10:38:16 +05:30
|
|
|
t = _("%s married %s on %s in %s") % \
|
2003-02-16 04:33:48 +05:30
|
|
|
(heshe, spouse, fulldate, place)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-05-04 06:50:21 +05:30
|
|
|
if not fulldate and not place:
|
2005-02-01 10:38:16 +05:30
|
|
|
t = _("%s married") % heshe
|
2004-05-04 06:50:21 +05:30
|
|
|
elif not fulldate and place:
|
2005-02-01 10:38:16 +05:30
|
|
|
t = _("%s married in %s") % (heshe, place)
|
2004-05-04 06:50:21 +05:30
|
|
|
elif fulldate and not place:
|
2005-02-01 10:38:16 +05:30
|
|
|
t = _("%s married on %s") % (heshe, fulldate)
|
2004-05-04 06:50:21 +05:30
|
|
|
else:
|
2005-02-01 10:38:16 +05:30
|
|
|
t = _("%s married on %s in %s") % \
|
2004-05-04 06:50:21 +05:30
|
|
|
(heshe, fulldate, place)
|
2005-02-01 10:38:16 +05:30
|
|
|
else: # Not a marriage
|
|
|
|
if spouse != "":
|
|
|
|
t = _("%s had a relationship with %s") % (heshe, spouse)
|
|
|
|
else:
|
|
|
|
t = _("%s had a relationship with") % heshe
|
2004-05-04 06:50:21 +05:30
|
|
|
|
2005-02-01 10:38:16 +05:30
|
|
|
if t != "":
|
|
|
|
self.doc.write_text(t)
|
|
|
|
if fam_num == len(famList)-1:
|
2004-05-04 06:50:21 +05:30
|
|
|
self.doc.write_text(".")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
def write_mate(self, person):
|
2002-10-20 19:55:16 +05:30
|
|
|
"""Output birth, death, parentage, marriage and notes information """
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
for fam_id in person.get_family_handle_list():
|
2004-08-20 03:05:16 +05:30
|
|
|
fam = self.database.get_family_from_handle(fam_id)
|
2003-06-03 00:14:39 +05:30
|
|
|
mate = ""
|
2005-02-01 09:16:29 +05:30
|
|
|
if person.get_gender() == RelLib.Person.MALE:
|
2003-06-03 00:20:11 +05:30
|
|
|
heshe = _("She")
|
2004-07-28 07:59:07 +05:30
|
|
|
mother_handle = fam.get_mother_handle()
|
|
|
|
if mother_handle:
|
2004-08-07 10:46:57 +05:30
|
|
|
mate = self.database.get_person_from_handle(mother_handle)
|
2004-02-14 11:10:30 +05:30
|
|
|
mateName = mate.get_primary_name().get_regular_name()
|
|
|
|
mateFirstName = mate.get_primary_name().get_first_name()
|
2003-06-03 00:14:39 +05:30
|
|
|
else:
|
2003-06-03 00:20:11 +05:30
|
|
|
heshe = _("He")
|
2004-07-28 07:59:07 +05:30
|
|
|
father_handle = fam.get_father_handle()
|
|
|
|
if father_handle:
|
2004-08-07 10:46:57 +05:30
|
|
|
mate = self.database.get_person_from_handle(father_handle)
|
2004-02-14 11:10:30 +05:30
|
|
|
mateName = mate.get_primary_name().get_regular_name()
|
|
|
|
mateFirstName = mate.get_primary_name().get_first_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-06-03 00:14:39 +05:30
|
|
|
if mate:
|
2005-01-02 01:28:53 +05:30
|
|
|
if self.addImages:
|
2004-01-08 04:10:04 +05:30
|
|
|
self.insert_images(mate)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-22 10:47:14 +05:30
|
|
|
self.doc.start_paragraph("DDR-Entry")
|
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
if not self.firstName:
|
2003-06-03 00:14:39 +05:30
|
|
|
mateFirstName = heshe
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-06-03 00:14:39 +05:30
|
|
|
self.doc.write_text(mateName)
|
2005-01-02 01:28:53 +05:30
|
|
|
self.write_birth(mate)
|
|
|
|
self.write_death(mate, mateFirstName)
|
2003-06-03 00:14:39 +05:30
|
|
|
self.write_parents(mate, mateFirstName)
|
|
|
|
self.doc.end_paragraph()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#--------------------------------------------------------------------
|
2004-01-08 04:10:04 +05:30
|
|
|
def insert_images(self, person):
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-21 11:41:59 +05:30
|
|
|
photos = person.get_media_list()
|
2003-06-03 00:14:39 +05:30
|
|
|
for photo in photos :
|
2004-07-28 07:59:07 +05:30
|
|
|
object_handle = photo.get_reference_handle()
|
2004-08-07 10:46:57 +05:30
|
|
|
object = self.database.get_object_from_handle(object_handle)
|
2004-02-14 11:10:30 +05:30
|
|
|
if object.get_mime_type()[0:5] == "image":
|
|
|
|
file = object.get_path()
|
2004-02-21 11:41:59 +05:30
|
|
|
self.doc.add_media_object(file,"row",4.0,4.0)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#--------------------------------------------------------------------
|
2003-07-07 22:05:32 +05:30
|
|
|
def write_report(self):
|
2002-10-20 19:55:16 +05:30
|
|
|
self.cur_gen= 1
|
2005-01-02 01:28:53 +05:30
|
|
|
self.apply_filter(self.start_person.get_handle(),1)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
name = self.start_person.get_primary_name().get_regular_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
famList = self.start_person.get_family_handle_list()
|
2002-10-20 19:55:16 +05:30
|
|
|
spouseName= ""
|
2004-05-04 06:50:21 +05:30
|
|
|
if len(famList):
|
|
|
|
for fam_id in famList:
|
2004-08-20 03:05:16 +05:30
|
|
|
fam = self.database.get_family_from_handle(fam_id)
|
2005-02-01 09:16:29 +05:30
|
|
|
if self.start_person.get_gender() == RelLib.Person.MALE:
|
2004-07-28 07:59:07 +05:30
|
|
|
mother_handle = fam.get_mother_handle()
|
|
|
|
if mother_handle:
|
2004-08-07 10:46:57 +05:30
|
|
|
spouseName = self.database.get_person_from_handle(mother_handle).get_primary_name().get_first_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
father_handle = fam.get_father_handle()
|
|
|
|
if father_handle:
|
2004-08-07 10:46:57 +05:30
|
|
|
spouseName = self.database.get_person_from_handle(father_handle).get_primary_name().get_first_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph("DDR-Title")
|
2004-05-04 06:50:21 +05:30
|
|
|
if spouseName:
|
2004-02-23 00:54:31 +05:30
|
|
|
name = spouseName + _(" and ") + name
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-06-03 00:14:39 +05:30
|
|
|
title = _("Detailed Descendant Report for %s") % name
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.write_text(title)
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
|
|
|
|
keys = self.map.keys()
|
|
|
|
keys.sort()
|
|
|
|
generation = 0
|
|
|
|
need_header = 1
|
|
|
|
|
|
|
|
for generation in xrange(len(self.genKeys)):
|
|
|
|
if self.pgbrk and generation > 0:
|
|
|
|
self.doc.page_break()
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph("DDR-Generation")
|
2002-10-20 19:55:16 +05:30
|
|
|
t = _("%s Generation") % DetDescendantReport.gen[generation+1]
|
|
|
|
self.doc.write_text(t)
|
|
|
|
self.doc.end_paragraph()
|
2005-01-02 01:28:53 +05:30
|
|
|
if self.childRef:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.prevGenIDs= self.genIDs.copy()
|
|
|
|
self.genIDs.clear()
|
|
|
|
|
2003-02-16 04:33:48 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
for key in self.genKeys[generation]:
|
2004-07-28 07:59:07 +05:30
|
|
|
person_handle = self.map[key]
|
2004-08-07 10:46:57 +05:30
|
|
|
person = self.database.get_person_from_handle(person_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
self.genIDs[person_handle]= key
|
2005-01-02 01:28:53 +05:30
|
|
|
dupPerson= self.write_person(key)
|
2002-10-20 19:55:16 +05:30
|
|
|
if dupPerson == 0: # Is this a duplicate ind record
|
2005-02-01 10:38:16 +05:30
|
|
|
if self.listChildren:
|
|
|
|
for family_handle in person.get_family_handle_list():
|
|
|
|
family = self.database.get_family_from_handle(family_handle)
|
|
|
|
self.write_children(family)
|
2003-07-07 22:05:32 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2005-01-02 01:28:53 +05:30
|
|
|
class DetDescendantOptions(ReportOptions.ReportOptions):
|
|
|
|
|
|
|
|
"""
|
|
|
|
Defines options and provides handling interface.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self,name,person_id=None):
|
|
|
|
ReportOptions.ReportOptions.__init__(self,name,person_id)
|
|
|
|
|
|
|
|
def set_new_options(self):
|
|
|
|
# Options specific for this report
|
|
|
|
self.options_dict = {
|
|
|
|
'firstnameiop' : 0,
|
|
|
|
'fulldates' : 1,
|
|
|
|
'listc' : 1,
|
|
|
|
'incnotes' : 1,
|
|
|
|
'repplace' : 0,
|
|
|
|
'repdate' : 0,
|
|
|
|
'computeage' : 1,
|
|
|
|
'omitda' : 1,
|
|
|
|
'desref' : 1,
|
|
|
|
'incphotos' : 0,
|
|
|
|
}
|
|
|
|
self.options_help = {
|
|
|
|
'firstnameiop' : ("=0/1","Whether to use first names instead of pronouns",
|
|
|
|
["Do not use first names","Use first names"],
|
|
|
|
True),
|
|
|
|
'fulldates' : ("=0/1","Whether to use full dates instead of just year.",
|
|
|
|
["Do not use full dates","Use full dates"],
|
|
|
|
True),
|
|
|
|
'listc' : ("=0/1","Whether to list children.",
|
|
|
|
["Do not list children","List children"],
|
|
|
|
True),
|
|
|
|
'incnotes' : ("=0/1","Whether to include notes.",
|
|
|
|
["Do not include notes","Include notes"],
|
|
|
|
True),
|
|
|
|
'repplace' : ("=0/1","Whether to replace missing Places with blanks.",
|
|
|
|
["Do not replace missing Places","Replace missing Places"],
|
|
|
|
True),
|
|
|
|
'repdate' : ("=0/1","Whether to replace missing Dates with blanks.",
|
|
|
|
["Do not replace missing Dates","Replace missing Dates"],
|
|
|
|
True),
|
|
|
|
'computeage' : ("=0/1","Whether to compute age.",
|
|
|
|
["Do not compute age","Compute age"],
|
|
|
|
True),
|
|
|
|
'omitda' : ("=0/1","Whether to omit duplicate ancestors.",
|
|
|
|
["Do not omit duplicates","Omit duplicates"],
|
|
|
|
True),
|
|
|
|
'desref' : ("=0/1","Whether to add descendant references in child list.",
|
|
|
|
["Do not add references","Add references"],
|
|
|
|
True),
|
|
|
|
'incphotos' : ("=0/1","Whether to include images.",
|
|
|
|
["Do not include images","Include images"],
|
|
|
|
True),
|
|
|
|
}
|
|
|
|
|
|
|
|
def enable_options(self):
|
|
|
|
# Semi-common options that should be enabled for this report
|
|
|
|
self.enable_dict = {
|
|
|
|
'gen' : 10,
|
|
|
|
'pagebbg' : 0,
|
|
|
|
}
|
|
|
|
|
|
|
|
def make_default_style(self,default_style):
|
|
|
|
"""Make the default output style for the Detailed Descendant Report"""
|
|
|
|
font = BaseDoc.FontStyle()
|
|
|
|
font.set(face=BaseDoc.FONT_SANS_SERIF,size=16,bold=1)
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
|
|
|
para.set_font(font)
|
|
|
|
para.set_header_level(1)
|
|
|
|
para.set(pad=0.5)
|
|
|
|
para.set_description(_('The style used for the title of the page.'))
|
|
|
|
default_style.add_style("DDR-Title",para)
|
|
|
|
|
|
|
|
font = BaseDoc.FontStyle()
|
|
|
|
font.set(face=BaseDoc.FONT_SANS_SERIF,size=14,italic=1)
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
|
|
|
para.set_font(font)
|
|
|
|
para.set_header_level(2)
|
|
|
|
para.set(pad=0.5)
|
|
|
|
para.set_description(_('The style used for the generation header.'))
|
|
|
|
default_style.add_style("DDR-Generation",para)
|
|
|
|
|
|
|
|
font = BaseDoc.FontStyle()
|
|
|
|
font.set(face=BaseDoc.FONT_SANS_SERIF,size=10,italic=0, bold=0)
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
|
|
|
para.set_font(font)
|
|
|
|
#para.set_header_level(3)
|
|
|
|
para.set_left_margin(1.0) # in centimeters
|
|
|
|
para.set(pad=0.5)
|
|
|
|
para.set_description(_('The style used for the children list title.'))
|
|
|
|
default_style.add_style("DDR-ChildTitle",para)
|
|
|
|
|
|
|
|
font = BaseDoc.FontStyle()
|
|
|
|
font.set(face=BaseDoc.FONT_SANS_SERIF,size=9)
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
|
|
|
para.set_font(font)
|
|
|
|
para.set(first_indent=0.0,lmargin=1.0,pad=0.25)
|
|
|
|
para.set_description(_('The style used for the children list.'))
|
|
|
|
default_style.add_style("DDR-ChildList",para)
|
|
|
|
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
|
|
|
para.set(first_indent=0.0,lmargin=1.0,pad=0.25)
|
|
|
|
para.set_description(_('The style used for the notes section header.'))
|
|
|
|
default_style.add_style("DDR-NoteHeader",para)
|
|
|
|
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
|
|
|
para.set(first_indent=0.5,lmargin=0.0,pad=0.25)
|
|
|
|
default_style.add_style("DDR-Entry",para)
|
|
|
|
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
|
|
|
para.set(first_indent=-1.0,lmargin=1.0,pad=0.25)
|
|
|
|
para.set_description(_('The style used for the first personal entry.'))
|
|
|
|
default_style.add_style("DDR-First-Entry",para)
|
|
|
|
|
|
|
|
def add_user_options(self,dialog):
|
|
|
|
"""
|
|
|
|
Override the base class add_user_options task to add a menu that allows
|
|
|
|
the user to select the sort method.
|
|
|
|
"""
|
2003-07-07 22:05:32 +05:30
|
|
|
|
|
|
|
# Pronoun instead of first name
|
|
|
|
self.first_name_option = gtk.CheckButton(_("Use first names instead of pronouns"))
|
2005-01-02 01:28:53 +05:30
|
|
|
self.first_name_option.set_active(self.options_dict['firstnameiop'])
|
2003-07-07 22:05:32 +05:30
|
|
|
|
|
|
|
# Full date usage
|
|
|
|
self.full_date_option = gtk.CheckButton(_("Use full dates instead of only the year"))
|
2005-01-02 01:28:53 +05:30
|
|
|
self.full_date_option.set_active(self.options_dict['fulldates'])
|
2003-07-07 22:05:32 +05:30
|
|
|
|
|
|
|
# Children List
|
|
|
|
self.list_children_option = gtk.CheckButton(_("List children"))
|
2005-01-02 01:28:53 +05:30
|
|
|
self.list_children_option.set_active(self.options_dict['listc'])
|
2003-07-07 22:05:32 +05:30
|
|
|
|
|
|
|
# Print notes
|
|
|
|
self.include_notes_option = gtk.CheckButton(_("Include notes"))
|
2005-01-02 01:28:53 +05:30
|
|
|
self.include_notes_option.set_active(self.options_dict['incnotes'])
|
2003-07-07 22:05:32 +05:30
|
|
|
|
|
|
|
# Replace missing Place with ___________
|
|
|
|
self.place_option = gtk.CheckButton(_("Replace Place with ______"))
|
2005-01-02 01:28:53 +05:30
|
|
|
self.place_option.set_active(self.options_dict['repplace'])
|
2003-07-07 22:05:32 +05:30
|
|
|
|
|
|
|
# Replace missing dates with __________
|
|
|
|
self.date_option = gtk.CheckButton(_("Replace Dates with ______"))
|
2005-01-02 01:28:53 +05:30
|
|
|
self.date_option.set_active(self.options_dict['repdate'])
|
2003-07-07 22:05:32 +05:30
|
|
|
|
|
|
|
# Add "Died at the age of NN" in text
|
|
|
|
self.age_option = gtk.CheckButton(_("Compute age"))
|
2005-01-02 01:28:53 +05:30
|
|
|
self.age_option.set_active(self.options_dict['computeage'])
|
2003-07-07 22:05:32 +05:30
|
|
|
|
|
|
|
# Omit duplicate persons, occurs when distant cousins marry
|
|
|
|
self.dupPersons_option = gtk.CheckButton(_("Omit duplicate ancestors"))
|
2005-01-02 01:28:53 +05:30
|
|
|
self.dupPersons_option.set_active(self.options_dict['omitda'])
|
2003-07-07 22:05:32 +05:30
|
|
|
|
|
|
|
#Add descendant reference in child list
|
|
|
|
self.childRef_option = gtk.CheckButton(_("Add descendant reference in child list"))
|
2005-01-02 01:28:53 +05:30
|
|
|
self.childRef_option.set_active(self.options_dict['desref'])
|
2003-07-07 22:05:32 +05:30
|
|
|
|
|
|
|
#Add photo/image reference
|
|
|
|
self.image_option = gtk.CheckButton(_("Include Photo/Images from Gallery"))
|
2005-01-02 01:28:53 +05:30
|
|
|
self.image_option.set_active(self.options_dict['incphotos'])
|
2003-07-07 22:05:32 +05:30
|
|
|
|
|
|
|
# Add new options. The first argument is the tab name for grouping options.
|
|
|
|
# if you want to put everyting in the generic "Options" category, use
|
|
|
|
# self.add_option(text,widget) instead of self.add_frame_option(category,text,widget)
|
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
dialog.add_frame_option(_('Content'),'',self.first_name_option)
|
|
|
|
dialog.add_frame_option(_('Content'),'',self.full_date_option)
|
|
|
|
dialog.add_frame_option(_('Content'),'',self.list_children_option)
|
|
|
|
dialog.add_frame_option(_('Content'),'',self.include_notes_option)
|
|
|
|
dialog.add_frame_option(_('Content'),'',self.place_option)
|
|
|
|
dialog.add_frame_option(_('Content'),'',self.date_option)
|
|
|
|
dialog.add_frame_option(_('Content'),'',self.age_option)
|
|
|
|
dialog.add_frame_option(_('Content'),'',self.dupPersons_option)
|
|
|
|
dialog.add_frame_option(_('Content'),'',self.childRef_option)
|
|
|
|
dialog.add_frame_option(_('Content'),'',self.image_option)
|
|
|
|
|
|
|
|
def parse_user_options(self,dialog):
|
|
|
|
"""
|
|
|
|
Parses the custom options that we have added.
|
|
|
|
"""
|
2003-07-07 22:05:32 +05:30
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
self.options_dict['firstnameiop'] = int(self.first_name_option.get_active())
|
|
|
|
self.options_dict['fulldates'] = int(self.full_date_option.get_active())
|
|
|
|
self.options_dict['listc'] = int(self.list_children_option.get_active())
|
|
|
|
self.options_dict['incnotes'] = int(self.include_notes_option.get_active())
|
|
|
|
self.options_dict['repplace'] = int(self.place_option.get_active())
|
|
|
|
self.options_dict['repdate'] = int(self.date_option.get_active())
|
|
|
|
self.options_dict['computeage'] = int(self.age_option.get_active())
|
|
|
|
self.options_dict['omitda'] = int(self.dupPersons_option.get_active())
|
|
|
|
self.options_dict['desref'] = int(self.childRef_option.get_active())
|
|
|
|
self.options_dict['incphotos'] = int(self.image_option.get_active())
|
2003-07-07 22:05:32 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2005-01-05 10:32:19 +05:30
|
|
|
from PluginMgr import register_report
|
2002-10-20 19:55:16 +05:30
|
|
|
register_report(
|
2005-01-02 01:28:53 +05:30
|
|
|
name = 'det_descendant_report',
|
|
|
|
category = const.CATEGORY_TEXT,
|
|
|
|
report_class = DetDescendantReport,
|
|
|
|
options_class = DetDescendantOptions,
|
|
|
|
modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI,
|
|
|
|
translated_name = _("Detailed Descendant Report"),
|
2002-10-20 19:55:16 +05:30
|
|
|
status=(_("Beta")),
|
|
|
|
description= _("Produces a detailed descendant report"),
|
2003-02-08 22:58:41 +05:30
|
|
|
author_name="Bruce DeGrasse",
|
|
|
|
author_email="bdegrasse1@attbi.com"
|
2002-10-20 19:55:16 +05:30
|
|
|
)
|