2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2004-01-08 04:10:04 +05:30
|
|
|
# Copyright (C) 2000-2004 Bruce J. DeGrasse
|
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$
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
"Generate files/Detailed Ancestral Report"
|
|
|
|
|
|
|
|
import RelLib
|
|
|
|
import os
|
2003-01-29 10:13:12 +05:30
|
|
|
import Errors
|
|
|
|
|
2003-08-17 07:44:33 +05:30
|
|
|
from gettext import gettext as _
|
2003-01-29 10:13:12 +05:30
|
|
|
from QuestionDialog import ErrorDialog
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-07-07 11:45:05 +05:30
|
|
|
import Report
|
2003-09-02 06:17:09 +05:30
|
|
|
import BaseDoc
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
import gtk
|
|
|
|
import gnome.ui
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2003-07-07 11:45:05 +05:30
|
|
|
class DetAncestorReport(Report.Report):
|
2003-02-16 04:33:48 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#--------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#--------------------------------------------------------------------
|
2003-07-07 11:45:05 +05:30
|
|
|
def __init__(self,database,person,max,pgbrk,rptOpt,doc,output,newpage=0):
|
2002-10-20 19:55:16 +05:30
|
|
|
self.map = {}
|
|
|
|
self.database = database
|
|
|
|
self.start = person
|
|
|
|
self.max_generations = max
|
|
|
|
self.pgbrk = pgbrk
|
2003-07-07 11:45:05 +05:30
|
|
|
self.rptOpt = rptOpt
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc = doc
|
2003-07-07 11:45:05 +05:30
|
|
|
self.newpage = newpage
|
2002-10-20 19:55:16 +05:30
|
|
|
self.genIDs = {}
|
|
|
|
self.prevGenIDs= {}
|
|
|
|
|
2003-07-07 11:45:05 +05:30
|
|
|
if output:
|
|
|
|
self.standalone = 1
|
|
|
|
try:
|
|
|
|
self.doc.open(output)
|
2003-09-13 10:26:04 +05:30
|
|
|
self.doc.init()
|
2003-07-07 11:45:05 +05:30
|
|
|
except IOError,msg:
|
|
|
|
ErrorDialog(_("Could not open %s") % output + "\n" + msg)
|
|
|
|
else:
|
|
|
|
self.standalone = 0
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#--------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
def filter(self,person,index):
|
|
|
|
if person == None or index >= 2**self.max_generations:
|
|
|
|
return
|
|
|
|
self.map[index] = person
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
family = person.get_main_parents_family_id()
|
2002-10-20 19:55:16 +05:30
|
|
|
if family != None:
|
2004-02-14 11:10:30 +05:30
|
|
|
self.filter(family.get_father_id(),index*2)
|
|
|
|
self.filter(family.get_mother_id(),(index*2)+1)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
|
|
def write_children(self, family, rptOptions):
|
|
|
|
""" 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-02-14 11:10:30 +05:30
|
|
|
num_children= len(family.get_child_id_list())
|
2002-10-20 19:55:16 +05:30
|
|
|
if num_children > 0:
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph("DAR-ChildTitle")
|
2004-02-14 11:10:30 +05:30
|
|
|
if family.get_mother_id() != None:
|
|
|
|
mother= family.get_mother_id().get_primary_name().get_regular_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
else: mother= "unknown"
|
2004-02-14 11:10:30 +05:30
|
|
|
if family.get_father_id() != None:
|
|
|
|
father= family.get_father_id().get_primary_name().get_regular_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
else: father= "unknown"
|
|
|
|
self.doc.start_bold()
|
|
|
|
if num_children == 1:
|
|
|
|
self.doc.write_text(_("Child of %s and %s is:") % (mother, father))
|
|
|
|
else: self.doc.write_text(_("Children of %s and %s are:") % (mother, father))
|
|
|
|
self.doc.end_bold()
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
for child in family.get_child_id_list():
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph("DAR-ChildList")
|
2004-02-14 11:10:30 +05:30
|
|
|
name= child.get_primary_name().get_regular_name()
|
|
|
|
birth= child.get_birth()
|
|
|
|
death= child.get_death()
|
2002-10-20 19:55:16 +05:30
|
|
|
if rptOptions.childRef == reportOptions.Yes:
|
2004-02-14 11:10:30 +05:30
|
|
|
childID= child.get_id()
|
2002-10-20 19:55:16 +05:30
|
|
|
if self.prevGenIDs.get(childID) != None:
|
|
|
|
name= "[" + str(self.prevGenIDs.get(childID)) + "] "+ name
|
2004-02-14 11:10:30 +05:30
|
|
|
if birth.get_date() != "":
|
|
|
|
if birth.get_place_name() != "":
|
|
|
|
if death.get_date() != "":
|
|
|
|
if death.get_place_name() != "":
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \
|
2004-02-14 11:10:30 +05:30
|
|
|
(name, birth.get_date(), birth.get_place_name(),
|
|
|
|
death.get_date(), death.get_place_name())) # f
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
self.doc.write_text(_("- %s Born: %s %s Died: %s") % \
|
2004-02-14 11:10:30 +05:30
|
|
|
(name, birth.get_date(), birth.get_place_name(),
|
|
|
|
death.get_date())) # e
|
|
|
|
elif death.get_place_name() != "":
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.write_text(_("- %s Born: %s %s Died: %s") % \
|
2004-02-14 11:10:30 +05:30
|
|
|
(name, birth.get_date(), birth.get_place_name(),
|
|
|
|
death.get_place_name())) # d
|
2002-10-20 19:55:16 +05:30
|
|
|
else: self.doc.write_text(_("- %s Born: %s %s") % \
|
2004-02-14 11:10:30 +05:30
|
|
|
(name, birth.get_date(), birth.get_place_name())) # c
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-02-14 11:10:30 +05:30
|
|
|
if death.get_date() != "":
|
|
|
|
if death.get_place_name() != "":
|
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(), \
|
|
|
|
death.get_place_name())) # 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
|
|
|
|
elif death.get_place_name() != "":
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.write_text(_("- %s Born: %s Died: %s") % \
|
2004-02-14 11:10:30 +05:30
|
|
|
(name, birth.get_date(), death.get_place_name())) # 9
|
2002-10-20 19:55:16 +05:30
|
|
|
else: self.doc.write_text(_("- %s Born: %s") % \
|
2004-02-14 11:10:30 +05:30
|
|
|
(name, birth.get_date())) # 8
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-02-14 11:10:30 +05:30
|
|
|
if birth.get_place_name() != "":
|
|
|
|
if death.get_date() != "":
|
|
|
|
if death.get_place_name() != "":
|
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_place_name(), \
|
|
|
|
death.get_date(), death.get_place_name())) # 7
|
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_place_name(), death.get_date())) # 6
|
|
|
|
elif death.get_place_name() != "":
|
2003-04-22 01:17:45 +05:30
|
|
|
self.doc.write_text(_("- %s Born: %s Died: %s") % \
|
2004-02-14 11:10:30 +05:30
|
|
|
(name, birth.get_place_name(), death.get_place_name())) # 5
|
2002-10-20 19:55:16 +05:30
|
|
|
else: self.doc.write_text(_("- %s Born: %s") % \
|
2004-02-14 11:10:30 +05:30
|
|
|
(name, birth.get_place_name())) # 4
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-02-14 11:10:30 +05:30
|
|
|
if death.get_date() != "":
|
|
|
|
if death.get_place_name() != "":
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.write_text(_("- %s Died: %s %s") % \
|
2004-02-14 11:10:30 +05:30
|
|
|
(name, death.get_date(), death.get_place_name())) # 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
|
|
|
|
elif death.get_place_name() != "":
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.write_text(_("- %s Died: %s") % \
|
2004-02-14 11:10:30 +05:30
|
|
|
(name, death.get_place_name())) # 1
|
2002-10-20 19:55:16 +05:30
|
|
|
else: self.doc.write_text(_("- %s") % name) # 0
|
|
|
|
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
|
|
|
|
def write_person(self, key, rptOptions):
|
|
|
|
"""Output birth, death, parentage, marriage and notes information """
|
|
|
|
|
2004-02-15 08:54:12 +05:30
|
|
|
self.doc.start_paragraph("DAR-First-Entry","%s." % str(key))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
person = self.map[key]
|
|
|
|
if rptOptions.addImages == reportOptions.Yes:
|
2004-01-08 04:10:04 +05:30
|
|
|
self.insert_images(person)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
name = person.get_primary_name().get_regular_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
if rptOptions.firstName == reportOptions.Yes:
|
2004-02-14 11:10:30 +05:30
|
|
|
firstName= person.get_primary_name().get_first_name()
|
|
|
|
elif person.get_gender() == RelLib.Person.male:
|
2002-10-20 19:55:16 +05:30
|
|
|
firstName= _("He")
|
|
|
|
else:
|
|
|
|
firstName= _("She")
|
|
|
|
|
|
|
|
self.doc.start_bold()
|
|
|
|
self.doc.write_text(name)
|
|
|
|
self.doc.end_bold()
|
|
|
|
|
|
|
|
if rptOptions.dupPersons == reportOptions.Yes:
|
|
|
|
# Check for duplicate record (result of distant cousins marrying)
|
|
|
|
keys = self.map.keys()
|
|
|
|
keys.sort()
|
|
|
|
for dkey in keys:
|
|
|
|
if dkey >= key: break
|
2004-02-14 11:10:30 +05:30
|
|
|
if self.map[key].get_id() == self.map[dkey].get_id():
|
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-02-14 11:10:30 +05:30
|
|
|
birth = person.get_birth()
|
2002-10-20 19:55:16 +05:30
|
|
|
if birth:
|
|
|
|
self.write_birth(person, rptOptions)
|
|
|
|
self.write_death(person, firstName, rptOptions)
|
|
|
|
self.write_parents(person, firstName)
|
|
|
|
self.write_marriage(person, rptOptions)
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
|
|
|
|
if key == 1: self.write_mate(person, rptOptions)
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if person.get_note() != "" and rptOptions.includeNotes == reportOptions.Yes:
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph("DAR-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(),"DAR-Entry")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
return 0 # Not duplicate person
|
|
|
|
|
|
|
|
def write_birth(self, person, rptOptions):
|
|
|
|
""" 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-02-14 11:10:30 +05:30
|
|
|
birth = person.get_birth()
|
2002-10-20 19:55:16 +05:30
|
|
|
if birth:
|
2004-02-14 11:10:30 +05:30
|
|
|
date = birth.get_date_object().get_start_date()
|
|
|
|
if birth.get_place_name() != "":
|
|
|
|
place = birth.get_place_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
if place[-1:] == '.':
|
|
|
|
place = place[:-1]
|
|
|
|
elif rptOptions.blankDate == reportOptions.Yes:
|
|
|
|
place= "______________"
|
|
|
|
else: place= ""
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if date.get_date() != "":
|
2002-10-20 19:55:16 +05:30
|
|
|
if date.getDayValid() and date.getMonthValid() and \
|
|
|
|
rptOptions.fullDate == reportOptions.Yes:
|
|
|
|
if place != "":
|
2004-02-14 11:10:30 +05:30
|
|
|
self.doc.write_text(_(" was born on %s in %s.") % (date.get_date(), place))
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2004-02-14 11:10:30 +05:30
|
|
|
self.doc.write_text(_(" was born on %s.") % date.get_date())
|
2002-10-20 19:55:16 +05:30
|
|
|
elif place != "":
|
|
|
|
self.doc.write_text(_(" was born in the year %s in %s.") % \
|
|
|
|
(date.getYear(), place))
|
|
|
|
else:
|
|
|
|
self.doc.write_text(_(" was born in the year %s.") % date.getYear())
|
|
|
|
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(_("."))
|
|
|
|
|
|
|
|
return
|
|
|
|
self.doc.write_text(_("."))
|
|
|
|
return
|
|
|
|
|
|
|
|
def write_death(self, person, firstName, rptOptions):
|
|
|
|
""" 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= ""
|
2004-02-14 11:10:30 +05:30
|
|
|
death = person.get_death()
|
2002-10-20 19:55:16 +05:30
|
|
|
if death != None:
|
2004-02-14 11:10:30 +05:30
|
|
|
date = death.get_date_object().get_start_date()
|
|
|
|
place = death.get_place_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
if place[-1:] == '.':
|
|
|
|
place = place[:-1]
|
|
|
|
elif place == "" and rptOptions.blankPlace == reportOptions.Yes:
|
|
|
|
place= "_____________"
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if date.get_date() != "":
|
2003-06-03 04:16:58 +05:30
|
|
|
if date.getDay() and date.getMonth() and \
|
2002-10-20 19:55:16 +05:30
|
|
|
rptOptions.fullDate == reportOptions.Yes:
|
2004-02-14 11:10:30 +05:30
|
|
|
fulldate= date.get_date()
|
2003-06-03 04:16:58 +05:30
|
|
|
elif date.getMonth() and rptOptions.fullDate == reportOptions.Yes:
|
2002-10-20 19:55:16 +05:30
|
|
|
fulldate= "%s %s" % (date.getMonth(), date.getYear())
|
|
|
|
else: fulldate= ""
|
|
|
|
elif rptOptions.blankDate == reportOptions.Yes:
|
|
|
|
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.getYear() > 0:
|
|
|
|
if place != "":
|
|
|
|
t= _(" %s died in %s in %s") % (firstName, date.getYear(), place)
|
|
|
|
else: t= _(" %s died in %s") % (firstName, date.getYear())
|
|
|
|
elif place != "":
|
|
|
|
t= _(" %s died in %s") % (firstName, place)
|
|
|
|
|
|
|
|
if rptOptions.calcAgeFlag == reportOptions.Yes:
|
|
|
|
t= t + rptOptions.calcAge(person)
|
|
|
|
|
|
|
|
if t != "":
|
|
|
|
self.doc.write_text(t)
|
|
|
|
else: return
|
|
|
|
|
|
|
|
t= ""
|
2004-02-14 11:10:30 +05:30
|
|
|
famList= person.get_family_id_list()
|
2002-10-20 19:55:16 +05:30
|
|
|
if len(famList) > 0:
|
|
|
|
for fam in famList:
|
|
|
|
buried= None
|
|
|
|
if buried:
|
2004-02-14 11:10:30 +05:30
|
|
|
date = buried.get_date_object().get_start_date()
|
|
|
|
place = buried.get_place_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
if place[-1:] == '.':
|
|
|
|
place = place[:-1]
|
|
|
|
fulldate= ""
|
2004-02-14 11:10:30 +05:30
|
|
|
if date.get_date() != "":
|
2002-10-20 19:55:16 +05:30
|
|
|
if date.getDayValid() and date.getMonthValid() and \
|
|
|
|
rptOptions.fullDate == reportOptions.Yes:
|
2004-02-14 11:10:30 +05:30
|
|
|
fulldate= date.get_date()
|
2002-10-20 19:55:16 +05:30
|
|
|
elif rptOptions.blankDate == reportOptions.Yes:
|
|
|
|
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 was the son of FATHER and MOTHER.
|
|
|
|
FIRSTNAME was the son of FATHER.
|
|
|
|
FIRSTNAME was the son of MOTHER.
|
|
|
|
FIRSTNAME was the daughter of FATHER and MOTHER.
|
|
|
|
FIRSTNAME was the daughter of FATHER.
|
|
|
|
FIRSTNAME was the daughter of MOTHER.
|
|
|
|
"""
|
2004-02-14 11:10:30 +05:30
|
|
|
ext_family= person.get_main_parents_family_id()
|
2002-10-20 19:55:16 +05:30
|
|
|
if ext_family != None:
|
2004-02-14 11:10:30 +05:30
|
|
|
if ext_family.get_father_id() != None:
|
|
|
|
father= ext_family.get_father_id().get_primary_name().get_regular_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
else: father= ""
|
2004-02-14 11:10:30 +05:30
|
|
|
if ext_family.get_mother_id() != None:
|
|
|
|
mother= ext_family.get_mother_id().get_primary_name().get_regular_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
else: mother= ""
|
|
|
|
|
|
|
|
if father != "" or mother != "":
|
2004-02-14 11:10:30 +05:30
|
|
|
if person.get_gender() == RelLib.Person.male:
|
2002-10-20 19:55:16 +05:30
|
|
|
if father != "":
|
|
|
|
if mother != "":
|
2003-02-16 04:33:48 +05:30
|
|
|
self.doc.write_text(_(" %s was the son of %s and %s.") % \
|
|
|
|
(firstName, father, mother))
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2003-02-16 04:33:48 +05:30
|
|
|
self.doc.write_text(_(" %s was the son of %s.") % \
|
|
|
|
(firstName, father))
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2003-02-16 04:33:48 +05:30
|
|
|
self.doc.write_text(_(" %s was the son of %s.") % \
|
|
|
|
(firstName, mother))
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
if father != "":
|
|
|
|
if mother != "":
|
2003-02-16 04:33:48 +05:30
|
|
|
self.doc.write_text(_(" %s was the daughter of %s and %s.") % \
|
|
|
|
(firstName, father, mother))
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2003-02-16 04:33:48 +05:30
|
|
|
self.doc.write_text(_(" %s was the daughter of %s.") % \
|
|
|
|
(firstName, father))
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2003-02-16 04:33:48 +05:30
|
|
|
self.doc.write_text(_(" %s was the daughter of %s.") % \
|
|
|
|
(firstName, mother))
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
|
|
|
|
def write_marriage(self, person, rptOptions):
|
|
|
|
""" 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
|
|
|
|
HE/SHE married on FULLDATE in PLACE.
|
|
|
|
HE/SHE married on FULLDATE.
|
|
|
|
HE/SHE married in PLACE.
|
2002-10-20 19:55:16 +05:30
|
|
|
"""
|
2004-02-14 11:10:30 +05:30
|
|
|
famList= person.get_family_id_list()
|
2002-10-20 19:55:16 +05:30
|
|
|
if len(famList) > 0:
|
|
|
|
fam_num= 0
|
2003-02-16 04:33:48 +05:30
|
|
|
endOfSent= ""
|
2002-10-20 19:55:16 +05:30
|
|
|
for fam in famList:
|
|
|
|
fam_num= fam_num + 1
|
|
|
|
spouse= ""
|
2003-02-16 04:33:48 +05:30
|
|
|
t= ""
|
2004-02-14 11:10:30 +05:30
|
|
|
if person.get_gender() == RelLib.Person.male:
|
|
|
|
if fam.get_mother_id() != None:
|
|
|
|
spouse= fam.get_mother_id().get_primary_name().get_regular_name()
|
2003-02-16 04:33:48 +05:30
|
|
|
if fam_num == 1:
|
|
|
|
heshe= _("He")
|
|
|
|
elif fam_num < len(famList):
|
|
|
|
heshe= _(",")
|
|
|
|
else: heshe= _("and he")
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
|
|
|
if fam_num == 1:
|
|
|
|
heshe= _("She")
|
|
|
|
elif fam_num < len(famList):
|
|
|
|
heshe= _(",")
|
|
|
|
else: heshe= _("and she")
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
if fam.get_father_id() != None:
|
|
|
|
spouse= fam.get_father_id().get_primary_name().get_regular_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
marriage= fam.get_marriage()
|
2002-10-20 19:55:16 +05:30
|
|
|
fulldate= ""
|
|
|
|
place= ""
|
|
|
|
if marriage != None:
|
2004-02-14 11:10:30 +05:30
|
|
|
if marriage.get_place_id() != None and \
|
|
|
|
marriage.get_place_name() != "":
|
|
|
|
place= marriage.get_place_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
elif rptOptions.blankPlace == reportOptions.Yes:
|
|
|
|
place= "____________"
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
date= marriage.get_date_object()
|
2002-10-20 19:55:16 +05:30
|
|
|
if date != None:
|
|
|
|
if date.getYearValid():
|
|
|
|
if date.getDayValid() and date.getMonthValid() and \
|
|
|
|
rptOptions.fullDate == reportOptions.Yes:
|
2004-02-14 11:10:30 +05:30
|
|
|
fulldate= date.get_date()
|
2002-10-20 19:55:16 +05:30
|
|
|
elif rptOptions.blankDate == reportOptions.Yes:
|
|
|
|
fulldate= "__________"
|
|
|
|
|
|
|
|
if spouse != "":
|
|
|
|
if fulldate == "" and place == "":
|
2003-02-16 04:33:48 +05:30
|
|
|
t= _(" %s married %s") % (heshe, spouse)
|
2002-10-20 19:55:16 +05:30
|
|
|
elif fulldate == "" and place != "":
|
2003-02-16 04:33:48 +05:30
|
|
|
t= _(" %s married %s in %s") % (heshe, spouse, place)
|
2002-10-20 19:55:16 +05:30
|
|
|
elif fulldate != "" and place == "":
|
2003-02-16 04:33:48 +05:30
|
|
|
t= _(" %s married %s on %s") % (heshe, spouse, fulldate)
|
|
|
|
else: t= _(" %s married %s on %s in %s") % \
|
|
|
|
(heshe, spouse, fulldate, place)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2003-06-02 20:53:27 +05:30
|
|
|
if fulldate == "" and place == "":
|
|
|
|
t= _(" %s married") % heshe
|
|
|
|
elif fulldate == "" and place != "":
|
2003-02-16 04:33:48 +05:30
|
|
|
t= _(" %s married in %s") % (heshe, place)
|
2002-10-20 19:55:16 +05:30
|
|
|
elif fulldate != "" and place == "":
|
2003-02-16 04:33:48 +05:30
|
|
|
t= _(" %s married on %s") % (heshe, fulldate)
|
|
|
|
elif fulldate != "" and place != "":
|
|
|
|
t= _(" %s married on %s in %s") % \
|
|
|
|
(heshe, fulldate, place)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-02-16 04:33:48 +05:30
|
|
|
if t != "":
|
|
|
|
self.doc.write_text(t)
|
|
|
|
endOfSent= "."
|
|
|
|
if fam_num == len(famList): self.doc.write_text(endOfSent)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def write_mate(self, mate, rptOptions):
|
|
|
|
"""Output birth, death, parentage, marriage and notes information """
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
famList= mate.get_family_id_list()
|
2002-10-20 19:55:16 +05:30
|
|
|
if len(famList) > 0:
|
|
|
|
for fam in famList:
|
|
|
|
person= ""
|
2004-02-14 11:10:30 +05:30
|
|
|
if mate.get_gender() == RelLib.Person.male:
|
|
|
|
if fam.get_mother_id() != None:
|
|
|
|
ind= fam.get_mother_id()
|
|
|
|
person= fam.get_mother_id().get_primary_name().get_regular_name()
|
|
|
|
firstName= fam.get_mother_id().get_primary_name().get_first_name()
|
2003-02-16 04:33:48 +05:30
|
|
|
heshe= _("She")
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2003-02-16 04:33:48 +05:30
|
|
|
heshe= _("He")
|
2004-02-14 11:10:30 +05:30
|
|
|
if fam.get_father_id() != None:
|
|
|
|
ind= fam.get_father_id()
|
|
|
|
person= fam.get_father_id().get_primary_name().get_regular_name()
|
|
|
|
firstName= fam.get_father_id().get_primary_name().get_first_name()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
if person != "":
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph("DAR-Entry")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
if rptOptions.addImages == reportOptions.Yes:
|
2004-01-08 04:10:04 +05:30
|
|
|
self.insert_images(ind)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
if rptOptions.firstName == reportOptions.No:
|
|
|
|
firstName= heshe
|
|
|
|
|
|
|
|
self.doc.write_text(person)
|
|
|
|
|
|
|
|
self.write_birth(ind, rptOptions)
|
|
|
|
|
|
|
|
self.write_death(ind, firstName, rptOptions)
|
|
|
|
|
|
|
|
self.write_parents(ind, firstName)
|
|
|
|
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
|
|
|
|
if rptOptions.listChildren == reportOptions.Yes \
|
2004-02-14 11:10:30 +05:30
|
|
|
and mate.get_gender() == RelLib.Person.male:
|
2002-10-20 19:55:16 +05:30
|
|
|
self.write_children(fam, rptOptions)
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#--------------------------------------------------------------------
|
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()
|
2004-01-08 04:10:04 +05:30
|
|
|
paragraph_started = 0
|
2003-10-27 09:18:13 +05:30
|
|
|
for photo in photos :
|
2004-02-14 11:10:30 +05:30
|
|
|
object = photo.get_reference()
|
|
|
|
if object.get_mime_type()[0:5] == "image":
|
|
|
|
file = object.get_path()
|
2004-01-08 04:10:04 +05:30
|
|
|
if not paragraph_started:
|
|
|
|
self.doc.start_paragraph("DAR-Entry")
|
|
|
|
paragraph_started = 1
|
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
|
|
|
self.doc.end_paragraph()
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#--------------------------------------------------------------------
|
2003-07-07 11:45:05 +05:30
|
|
|
def write_report(self):
|
|
|
|
if self.newpage:
|
|
|
|
self.doc.page_break()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.filter(self.start,1)
|
2003-02-16 04:33:48 +05:30
|
|
|
#rptOpt= reportOptions()
|
2003-07-07 11:45:05 +05:30
|
|
|
rptOpt = self.rptOpt
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
name = self.start.get_primary_name().get_regular_name()
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph("DAR-Title")
|
2002-10-20 19:55:16 +05:30
|
|
|
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()
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph("DAR-Generation")
|
2002-10-20 19:55:16 +05:30
|
|
|
t = _("%s Generation") % DetAncestorReport.gen[generation+1]
|
|
|
|
self.doc.write_text(t)
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
generation = generation + 1
|
|
|
|
if rptOpt.childRef == reportOptions.Yes:
|
|
|
|
self.prevGenIDs= self.genIDs.copy()
|
|
|
|
self.genIDs.clear()
|
|
|
|
|
|
|
|
person = self.map[key]
|
2004-02-14 11:10:30 +05:30
|
|
|
self.genIDs[person.get_id()]= key
|
2002-10-20 19:55:16 +05:30
|
|
|
dupPerson= self.write_person(key, rptOpt)
|
|
|
|
if dupPerson == 0: # Is this a duplicate ind record
|
2004-02-14 11:10:30 +05:30
|
|
|
if person.get_gender() == RelLib.Person.female and \
|
2002-10-20 19:55:16 +05:30
|
|
|
rptOpt.listChildren == reportOptions.Yes and \
|
2004-02-14 11:10:30 +05:30
|
|
|
len(person.get_family_id_list()) > 0:
|
|
|
|
family= person.get_family_id_list()[0]
|
2002-10-20 19:55:16 +05:30
|
|
|
self.write_children(family, rptOpt)
|
|
|
|
|
2004-01-08 04:10:04 +05:30
|
|
|
#if rptOpt.addImages == reportOptions.Yes:
|
|
|
|
# self.append_images(person)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-07-07 11:45:05 +05:30
|
|
|
if self.standalone:
|
|
|
|
self.doc.close()
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
def _make_default_style(default_style):
|
|
|
|
"""Make the default output style for the Detailed Ancestral Report"""
|
2003-09-02 06:17:09 +05:30
|
|
|
font = BaseDoc.FontStyle()
|
|
|
|
font.set(face=BaseDoc.FONT_SANS_SERIF,size=16,bold=1)
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
2003-07-07 11:45:05 +05:30
|
|
|
para.set_font(font)
|
|
|
|
para.set_header_level(1)
|
|
|
|
para.set(pad=0.5)
|
2004-02-15 08:54:12 +05:30
|
|
|
para.set_description(_('The style used for the title of the page.'))
|
2003-07-18 19:13:13 +05:30
|
|
|
default_style.add_style("DAR-Title",para)
|
2003-07-07 11:45:05 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
font = BaseDoc.FontStyle()
|
|
|
|
font.set(face=BaseDoc.FONT_SANS_SERIF,size=14,italic=1)
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
2003-07-07 11:45:05 +05:30
|
|
|
para.set_font(font)
|
|
|
|
para.set_header_level(2)
|
|
|
|
para.set(pad=0.5)
|
2004-02-15 08:54:12 +05:30
|
|
|
para.set_description(_('The style used for the generation header.'))
|
2003-07-18 19:13:13 +05:30
|
|
|
default_style.add_style("DAR-Generation",para)
|
2003-07-07 11:45:05 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
font = BaseDoc.FontStyle()
|
|
|
|
font.set(face=BaseDoc.FONT_SANS_SERIF,size=10,italic=0, bold=0)
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
2003-07-07 11:45:05 +05:30
|
|
|
para.set_font(font)
|
|
|
|
#para.set_header_level(3)
|
2004-02-15 08:54:12 +05:30
|
|
|
para.set_left_margin(1.0) # in centimeters
|
2003-07-07 11:45:05 +05:30
|
|
|
para.set(pad=0.5)
|
2004-02-15 08:54:12 +05:30
|
|
|
para.set_description(_('The style used for the children list title.'))
|
2003-07-18 19:13:13 +05:30
|
|
|
default_style.add_style("DAR-ChildTitle",para)
|
2003-07-07 11:45:05 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
font = BaseDoc.FontStyle()
|
|
|
|
font.set(face=BaseDoc.FONT_SANS_SERIF,size=9)
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
2003-07-07 11:45:05 +05:30
|
|
|
para.set_font(font)
|
2004-02-15 08:54:12 +05:30
|
|
|
para.set(first_indent=0.0,lmargin=1.0,pad=0.25)
|
|
|
|
para.set_description(_('The style used for the children list.'))
|
2003-07-18 19:13:13 +05:30
|
|
|
default_style.add_style("DAR-ChildList",para)
|
2003-07-07 11:45:05 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
para = BaseDoc.ParagraphStyle()
|
2003-07-07 11:45:05 +05:30
|
|
|
para.set(first_indent=0.0,lmargin=0.0,pad=0.25)
|
2003-07-18 19:13:13 +05:30
|
|
|
default_style.add_style("DAR-NoteHeader",para)
|
2003-07-07 11:45:05 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
para = BaseDoc.ParagraphStyle()
|
2004-02-15 08:54:12 +05:30
|
|
|
para.set(first_indent=0.5,lmargin=1.0,pad=0.25)
|
|
|
|
para.set_description(_('The basic style used for the text display.'))
|
2003-07-18 19:13:13 +05:30
|
|
|
default_style.add_style("DAR-Entry",para)
|
2003-07-07 11:45:05 +05:30
|
|
|
|
2004-02-15 08:54:12 +05:30
|
|
|
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("DAR-First-Entry",para)
|
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
table = BaseDoc.TableStyle()
|
2003-07-07 11:45:05 +05:30
|
|
|
table.set_width(1000)
|
|
|
|
table.set_columns(3)
|
|
|
|
table.set_column_width(1,"30%")
|
|
|
|
#self.default_style.add_style("Images",table)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2003-07-07 11:45:05 +05:30
|
|
|
class DetAncestorReportDialog(Report.TextReportDialog):
|
2003-10-31 06:50:58 +05:30
|
|
|
|
|
|
|
report_options = {}
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def __init__(self,database,person):
|
2003-10-31 06:50:58 +05:30
|
|
|
Report.TextReportDialog.__init__(self,database,person,self.report_options)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Customization hooks
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
def get_title(self):
|
|
|
|
"""The window title for this dialog"""
|
|
|
|
return _("Gramps - Ahnentafel Report")
|
|
|
|
|
|
|
|
def get_header(self, name):
|
|
|
|
"""The header line at the top of the dialog contents"""
|
|
|
|
return _("Detailed Ancestral Report for %s") % name
|
|
|
|
|
|
|
|
def get_target_browser_title(self):
|
|
|
|
"""The title of the window created when the 'browse' button is
|
|
|
|
clicked in the 'Save As' frame."""
|
|
|
|
return _("Save Ancestor Report")
|
|
|
|
|
|
|
|
def get_stylesheet_savefile(self):
|
|
|
|
"""Where to save styles for this report."""
|
|
|
|
return "det_ancestor_report.xml"
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Create output styles appropriate to this report.
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
def make_default_style(self):
|
2003-07-07 11:45:05 +05:30
|
|
|
_make_default_style(self.default_style)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Create the contents of the report.
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
def make_report(self):
|
|
|
|
"""Create the object that will produce the Detailed Ancestral
|
|
|
|
Report. All user dialog has already been handled and the
|
|
|
|
output file opened."""
|
2003-01-29 10:13:12 +05:30
|
|
|
try:
|
2003-07-07 11:45:05 +05:30
|
|
|
MyReport = DetAncestorReport(self.db, self.person,
|
|
|
|
self.max_gen, self.pg_brk, self.rptOpt, self.doc, self.target_path )
|
|
|
|
MyReport.write_report()
|
2003-01-29 10:13:12 +05:30
|
|
|
except Errors.ReportError, msg:
|
2003-05-16 07:19:50 +05:30
|
|
|
(m1,m2) = msg.messages()
|
|
|
|
ErrorDialog(m1,m2)
|
2003-05-23 09:38:03 +05:30
|
|
|
except Errors.FilterError, msg:
|
|
|
|
(m1,m2) = msg.messages()
|
|
|
|
ErrorDialog(m1,m2)
|
2003-01-29 10:13:12 +05:30
|
|
|
except:
|
|
|
|
import DisplayTrace
|
|
|
|
DisplayTrace.DisplayTrace()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2003-02-16 04:33:48 +05:30
|
|
|
#*** Begin change
|
|
|
|
def add_user_options(self):
|
|
|
|
# Create a GTK Checkbox widgets
|
|
|
|
|
|
|
|
# Pronoun instead of first name
|
|
|
|
self.first_name_option = gtk.CheckButton(_("Use first names instead of pronouns"))
|
|
|
|
self.first_name_option.set_active(0)
|
|
|
|
|
|
|
|
# Full date usage
|
|
|
|
self.full_date_option = gtk.CheckButton(_("Use full dates instead of only the year"))
|
|
|
|
self.full_date_option.set_active(1)
|
|
|
|
|
|
|
|
# Children List
|
|
|
|
self.list_children_option = gtk.CheckButton(_("List children"))
|
|
|
|
self.list_children_option.set_active(1)
|
|
|
|
|
|
|
|
# Print notes
|
|
|
|
self.include_notes_option = gtk.CheckButton(_("Include notes"))
|
|
|
|
self.include_notes_option.set_active(1)
|
|
|
|
|
|
|
|
# Replace missing Place with ___________
|
|
|
|
self.place_option = gtk.CheckButton(_("Replace Place with ______"))
|
|
|
|
self.place_option.set_active(0)
|
|
|
|
|
|
|
|
# Replace missing dates with __________
|
|
|
|
self.date_option = gtk.CheckButton(_("Replace Dates with ______"))
|
|
|
|
self.date_option.set_active(0)
|
|
|
|
|
|
|
|
# Add "Died at the age of NN" in text
|
|
|
|
self.age_option = gtk.CheckButton(_("Compute age"))
|
|
|
|
self.age_option.set_active(1)
|
|
|
|
|
|
|
|
# Omit duplicate persons, occurs when distant cousins marry
|
|
|
|
self.dupPersons_option = gtk.CheckButton(_("Omit duplicate ancestors"))
|
|
|
|
self.dupPersons_option.set_active(1)
|
|
|
|
|
|
|
|
#Add descendant reference in child list
|
|
|
|
self.childRef_option = gtk.CheckButton(_("Add descendant reference in child list"))
|
|
|
|
self.childRef_option.set_active(1)
|
|
|
|
|
|
|
|
#Add photo/image reference
|
|
|
|
self.image_option = gtk.CheckButton(_("Include Photo/Images from Gallery"))
|
|
|
|
self.image_option.set_active(0)
|
|
|
|
|
|
|
|
# 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)
|
|
|
|
|
2003-09-26 04:41:03 +05:30
|
|
|
self.add_frame_option(_('Content'),'',self.first_name_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.full_date_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.list_children_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.include_notes_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.place_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.date_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.age_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.dupPersons_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.childRef_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.image_option)
|
2003-02-16 04:33:48 +05:30
|
|
|
|
|
|
|
|
|
|
|
def parse_report_options_frame(self):
|
|
|
|
"""Parse the report options frame of the dialog. Save the user selected choices for later use."""
|
|
|
|
|
|
|
|
# call the parent task to handle normal options
|
2003-07-07 11:45:05 +05:30
|
|
|
Report.ReportDialog.parse_report_options_frame(self)
|
2003-02-16 04:33:48 +05:30
|
|
|
|
|
|
|
# get values from the widgets
|
|
|
|
if self.first_name_option.get_active():
|
|
|
|
self.firstName = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.firstName = reportOptions.No
|
|
|
|
|
|
|
|
if self.full_date_option.get_active():
|
|
|
|
self.fullDate = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.fullDate = reportOptions.No
|
|
|
|
|
|
|
|
if self.list_children_option.get_active():
|
|
|
|
self.listChildren = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.listChildren = reportOptions.No
|
|
|
|
|
|
|
|
if self.include_notes_option.get_active():
|
|
|
|
self.includeNotes = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.includeNotes = reportOptions.No
|
|
|
|
|
|
|
|
if self.place_option.get_active():
|
|
|
|
self.blankPlace = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.blankPlace = reportOptions.No
|
|
|
|
|
|
|
|
if self.date_option.get_active():
|
|
|
|
self.blankDate = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.blankDate = reportOptions.No
|
|
|
|
|
|
|
|
if self.age_option.get_active():
|
|
|
|
self.calcAgeFlag = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.calcAgeFlag = reportOptions.No
|
|
|
|
|
|
|
|
if self.dupPersons_option.get_active():
|
|
|
|
self.dupPersons = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.dupPersons = reportOptions.No
|
|
|
|
|
|
|
|
if self.childRef_option.get_active():
|
|
|
|
self.childRef = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.childRef = reportOptions.No
|
|
|
|
|
|
|
|
if self.image_option.get_active():
|
|
|
|
self.addImages = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.addImages = reportOptions.No
|
|
|
|
|
2003-07-07 11:45:05 +05:30
|
|
|
rptOpt = reportOptions()
|
|
|
|
rptOpt.firstName= self.firstName
|
|
|
|
rptOpt.fullDate= self.fullDate
|
|
|
|
rptOpt.listChildren= self.listChildren
|
|
|
|
rptOpt.includeNotes= self.includeNotes
|
|
|
|
rptOpt.blankPlace= self.blankPlace
|
|
|
|
rptOpt.blankDate= self.blankDate
|
|
|
|
rptOpt.calcAgeFlag= self.calcAgeFlag
|
|
|
|
rptOpt.dupPersons= self.dupPersons
|
|
|
|
rptOpt.childRef= self.childRef
|
|
|
|
rptOpt.addImages= self.addImages
|
|
|
|
self.rptOpt = rptOpt
|
|
|
|
|
2003-02-16 04:33:48 +05:30
|
|
|
#*** End of change
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
2003-07-07 11:45:05 +05:30
|
|
|
# Standalone report function
|
2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
def report(database,person):
|
|
|
|
DetAncestorReportDialog(database,person)
|
|
|
|
|
2003-07-07 11:45:05 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Set up sane defaults for the book_item
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
_style_file = "det_ancestor_report.xml"
|
|
|
|
_style_name = "default"
|
|
|
|
|
|
|
|
_person_id = ""
|
|
|
|
_max_gen = 10
|
|
|
|
_pg_brk = 0
|
|
|
|
_first_name = 0
|
|
|
|
_full_date = 1
|
|
|
|
_list_children = 1
|
|
|
|
_include_notes = 1
|
|
|
|
_place = 0
|
|
|
|
_date = 1
|
|
|
|
_age = 1
|
|
|
|
_dup_persons = 1
|
|
|
|
_child_ref = 1
|
|
|
|
_images = 0
|
|
|
|
|
|
|
|
_options = ( _person_id, _max_gen, _pg_brk,
|
|
|
|
_first_name, _full_date, _list_children, _include_notes,
|
|
|
|
_place, _date, _age, _dup_persons, _child_ref, _images )
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Book Item Options dialog
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
class DetAncestorBareReportDialog(Report.BareReportDialog):
|
|
|
|
def __init__(self,database,person,opt,stl):
|
|
|
|
self.options = opt
|
|
|
|
self.db = database
|
|
|
|
if self.options[0]:
|
2004-02-14 11:10:30 +05:30
|
|
|
self.person = self.db.get_person(self.options[0])
|
2003-07-07 11:45:05 +05:30
|
|
|
else:
|
|
|
|
self.person = person
|
2003-07-11 08:59:33 +05:30
|
|
|
self.style_name = stl
|
2003-07-07 11:45:05 +05:30
|
|
|
|
|
|
|
self.max_gen = int(self.options[1])
|
|
|
|
self.pg_brk = int(self.options[2])
|
|
|
|
self.first_name = int(self.options[3])
|
|
|
|
self.full_date = int(self.options[4])
|
|
|
|
self.list_children = int(self.options[5])
|
|
|
|
self.include_notes = int(self.options[6])
|
|
|
|
self.place = int(self.options[7])
|
|
|
|
self.date = int(self.options[8])
|
|
|
|
self.age = int(self.options[9])
|
|
|
|
self.dup_persons = int(self.options[10])
|
|
|
|
self.child_ref = int(self.options[11])
|
|
|
|
self.images = int(self.options[12])
|
|
|
|
|
|
|
|
Report.BareReportDialog.__init__(self,database,self.person)
|
|
|
|
|
|
|
|
self.new_person = None
|
|
|
|
|
|
|
|
self.window.run()
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Customization hooks
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2003-07-07 22:27:27 +05:30
|
|
|
def make_default_style(self):
|
|
|
|
_make_default_style(self.default_style)
|
|
|
|
|
2003-07-07 11:45:05 +05:30
|
|
|
def get_title(self):
|
|
|
|
"""The window title for this dialog"""
|
|
|
|
return "%s - GRAMPS Book" % (_("Detailed Ancestral Report"))
|
|
|
|
|
|
|
|
def get_header(self, name):
|
|
|
|
"""The header line at the top of the dialog contents"""
|
|
|
|
return _("Detailed Ancestral Report for GRAMPS Book")
|
|
|
|
|
|
|
|
def get_stylesheet_savefile(self):
|
|
|
|
"""Where to save styles for this report."""
|
|
|
|
return _style_file
|
|
|
|
|
|
|
|
def add_user_options(self):
|
|
|
|
# Create a GTK Checkbox widgets
|
|
|
|
|
|
|
|
# Pronoun instead of first name
|
|
|
|
self.first_name_option = gtk.CheckButton(_("Use first names instead of pronouns"))
|
|
|
|
self.first_name_option.set_active(self.first_name)
|
|
|
|
|
|
|
|
# Full date usage
|
|
|
|
self.full_date_option = gtk.CheckButton(_("Use full dates instead of only the year"))
|
|
|
|
self.full_date_option.set_active(self.full_date)
|
|
|
|
|
|
|
|
# Children List
|
|
|
|
self.list_children_option = gtk.CheckButton(_("List children"))
|
|
|
|
self.list_children_option.set_active(self.list_children)
|
|
|
|
|
|
|
|
# Print notes
|
|
|
|
self.include_notes_option = gtk.CheckButton(_("Include notes"))
|
|
|
|
self.include_notes_option.set_active(self.include_notes)
|
|
|
|
|
|
|
|
# Replace missing Place with ___________
|
|
|
|
self.place_option = gtk.CheckButton(_("Replace Place with ______"))
|
|
|
|
self.place_option.set_active(self.place)
|
|
|
|
|
|
|
|
# Replace missing dates with __________
|
|
|
|
self.date_option = gtk.CheckButton(_("Replace Dates with ______"))
|
|
|
|
self.date_option.set_active(self.date)
|
|
|
|
|
|
|
|
# Add "Died at the age of NN" in text
|
|
|
|
self.age_option = gtk.CheckButton(_("Compute age"))
|
|
|
|
self.age_option.set_active(self.age)
|
|
|
|
|
|
|
|
# Omit duplicate persons, occurs when distant cousins marry
|
|
|
|
self.dupPersons_option = gtk.CheckButton(_("Omit duplicate ancestors"))
|
|
|
|
self.dupPersons_option.set_active(self.dup_persons)
|
|
|
|
|
|
|
|
#Add descendant reference in child list
|
|
|
|
self.childRef_option = gtk.CheckButton(_("Add descendant reference in child list"))
|
|
|
|
self.childRef_option.set_active(self.child_ref)
|
|
|
|
|
|
|
|
#Add photo/image reference
|
|
|
|
self.image_option = gtk.CheckButton(_("Include Photo/Images from Gallery"))
|
|
|
|
self.image_option.set_active(self.images)
|
|
|
|
|
|
|
|
# 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)
|
|
|
|
|
2003-09-26 04:41:03 +05:30
|
|
|
self.add_frame_option(_('Content'),'',self.first_name_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.full_date_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.list_children_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.include_notes_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.place_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.date_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.age_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.dupPersons_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.childRef_option)
|
|
|
|
self.add_frame_option(_('Content'),'',self.image_option)
|
2003-07-07 11:45:05 +05:30
|
|
|
|
|
|
|
def parse_report_options_frame(self):
|
|
|
|
"""Parse the report options frame of the dialog. Save the user selected choices for later use."""
|
|
|
|
|
|
|
|
# call the parent task to handle normal options
|
|
|
|
Report.BareReportDialog.parse_report_options_frame(self)
|
|
|
|
|
|
|
|
# get values from the widgets
|
|
|
|
if self.first_name_option.get_active():
|
|
|
|
self.first_name = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.first_name = reportOptions.No
|
|
|
|
|
|
|
|
if self.full_date_option.get_active():
|
|
|
|
self.full_date = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.full_date = reportOptions.No
|
|
|
|
|
|
|
|
if self.list_children_option.get_active():
|
|
|
|
self.list_children = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.list_children = reportOptions.No
|
|
|
|
|
|
|
|
if self.include_notes_option.get_active():
|
|
|
|
self.include_notes = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.include_notes = reportOptions.No
|
|
|
|
|
|
|
|
if self.place_option.get_active():
|
|
|
|
self.place = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.place = reportOptions.No
|
|
|
|
|
|
|
|
if self.date_option.get_active():
|
|
|
|
self.date = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.date = reportOptions.No
|
|
|
|
|
|
|
|
if self.age_option.get_active():
|
|
|
|
self.age = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.age = reportOptions.No
|
|
|
|
|
|
|
|
if self.dupPersons_option.get_active():
|
|
|
|
self.dup_persons = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.dup_persons = reportOptions.No
|
|
|
|
|
|
|
|
if self.childRef_option.get_active():
|
|
|
|
self.child_ref = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.child_ref = reportOptions.No
|
|
|
|
|
|
|
|
if self.image_option.get_active():
|
|
|
|
self.images = reportOptions.Yes
|
|
|
|
else:
|
|
|
|
self.images = reportOptions.No
|
|
|
|
|
|
|
|
def on_cancel(self, obj):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def on_ok_clicked(self, obj):
|
|
|
|
"""The user is satisfied with the dialog choices. Parse all options
|
|
|
|
and close the window."""
|
|
|
|
|
|
|
|
# Preparation
|
|
|
|
self.parse_style_frame()
|
|
|
|
self.parse_report_options_frame()
|
|
|
|
|
|
|
|
if self.new_person:
|
|
|
|
self.person = self.new_person
|
2004-02-14 11:10:30 +05:30
|
|
|
self.options = ( self.person.get_id(), self.max_gen, self.pg_brk,
|
2003-07-07 11:45:05 +05:30
|
|
|
self.first_name, self.full_date, self.list_children,
|
|
|
|
self.include_notes, self.place, self.date, self.age,
|
2003-07-07 22:27:27 +05:30
|
|
|
self.dup_persons, self.child_ref, self.images )
|
2003-07-07 11:45:05 +05:30
|
|
|
self.style_name = self.selected_style.get_name()
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Function to write Book Item
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
def write_book_item(database,person,doc,options,newpage=0):
|
|
|
|
"""Write the Detailed Ancestral Report using options set.
|
|
|
|
All user dialog has already been handled and the output file opened."""
|
|
|
|
try:
|
|
|
|
if options[0]:
|
2004-02-14 11:10:30 +05:30
|
|
|
person = database.get_person(options[0])
|
2003-07-07 11:45:05 +05:30
|
|
|
max_gen = int(options[1])
|
|
|
|
pg_brk = int(options[2])
|
|
|
|
rptOpt = reportOptions()
|
|
|
|
rptOpt.firstName = int(options[3])
|
|
|
|
rptOpt.fullDate = int(options[4])
|
|
|
|
rptOpt.listChildren = int(options[5])
|
|
|
|
rptOpt.includeNotes = int(options[6])
|
|
|
|
rptOpt.blankPlace = int(options[7])
|
|
|
|
rptOpt.blankDate = int(options[8])
|
|
|
|
rptOpt.calcAgeFlag = int(options[9])
|
|
|
|
rptOpt.dupPersons = int(options[10])
|
|
|
|
rptOpt.childRef = int(options[11])
|
|
|
|
rptOpt.addImages = int(options[12])
|
|
|
|
return DetAncestorReport(database, person,
|
|
|
|
max_gen, pg_brk, rptOpt, doc, None, newpage)
|
|
|
|
except Errors.ReportError, msg:
|
|
|
|
(m1,m2) = msg.messages()
|
|
|
|
ErrorDialog(m1,m2)
|
|
|
|
except Errors.FilterError, msg:
|
|
|
|
(m1,m2) = msg.messages()
|
|
|
|
ErrorDialog(m1,m2)
|
|
|
|
except:
|
|
|
|
import DisplayTrace
|
|
|
|
DisplayTrace.DisplayTrace()
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
def get_xpm_image():
|
|
|
|
return [
|
|
|
|
"48 48 4 1",
|
|
|
|
" c None",
|
|
|
|
". c #FFFFFF",
|
|
|
|
"+ c #C0C0C0",
|
|
|
|
"@ c #000000",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" ++++++++++++++++++++++++++++++++++ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +...@@@@@@@@@@@@@@@@@@@@@@@@@@...+ ",
|
|
|
|
" +...@@@@@@@@@@@@@@@@@@@@@@@@@@...+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +.....@@@@@@@@@@@@@@@@@@@@@@@@...+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +........@@@@@@@@@@@@@@@@@@@@@...+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +.....@@@@@@@@@@@@@@@@@@@@@@@@...+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +........@@@@@@@@@@@@@@@@@@@@@...+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +.....@@@@@@@@@@@@@@@@@@@@@@@@...+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +.........@@@@@@@@@@@@@@@@@@@@...+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +.....@@@@@@@@@@@@@@@@@@@@@@@@...+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +.........@@@@@@@@@@@@@@@@@@@@...+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +.........@@@@@@@@@@@@@@@@@@@@...+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +.....@@@@@@@@@@@@@@@@@@@@@@@@...+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +.........@@@@@@@@@@@@@@@@@@@@...+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +.....@@@@@@@@@@@@@@@@@@@@@@@@...+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +.........@@@@@@@@@@@@@@@@@@@@...+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" +................................+ ",
|
|
|
|
" ++++++++++++++++++++++++++++++++++ ",
|
|
|
|
" ",
|
|
|
|
" ",
|
|
|
|
" "]
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2003-07-07 11:45:05 +05:30
|
|
|
from Plugins import register_report, register_book_item
|
2003-02-16 04:33:48 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
register_report(
|
|
|
|
report,
|
|
|
|
_("Detailed Ancestral Report"),
|
|
|
|
status=(_("Beta")),
|
|
|
|
category=_("Text Reports"),
|
|
|
|
description= _("Produces a detailed ancestral report"),
|
2003-02-08 22:58:41 +05:30
|
|
|
xpm= get_xpm_image(),
|
|
|
|
author_name="Bruce DeGrasse",
|
|
|
|
author_email="bdegrasse1@attbi.com"
|
2002-10-20 19:55:16 +05:30
|
|
|
)
|
|
|
|
|
2003-07-07 11:45:05 +05:30
|
|
|
# (name,category,options_dialog,write_book_item,options,style_name,style_file,make_default_style)
|
|
|
|
register_book_item(
|
|
|
|
_("Detailed Ancestral Report"),
|
|
|
|
_("Text"),
|
|
|
|
DetAncestorBareReportDialog,
|
|
|
|
write_book_item,
|
|
|
|
_options,
|
|
|
|
_style_name,
|
|
|
|
_style_file,
|
|
|
|
_make_default_style
|
|
|
|
)
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
class reportOptions:
|
2003-07-07 11:45:05 +05:30
|
|
|
Yes = 1
|
|
|
|
No = 0
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
### Initialize report options###
|
|
|
|
|
|
|
|
#Use first name in place of he or she in text
|
|
|
|
self.firstName= reportOptions.Yes
|
|
|
|
|
|
|
|
#Use year only, not full date/month
|
|
|
|
self.fullDate= reportOptions.Yes
|
|
|
|
|
|
|
|
#Do not list children
|
|
|
|
self.listChildren= reportOptions.Yes
|
|
|
|
|
|
|
|
#Add stepchildren to the list of children
|
|
|
|
#self.addStepChildren= reportOptions.Yes
|
|
|
|
|
|
|
|
#Print notes
|
|
|
|
self.includeNotes= reportOptions.Yes
|
|
|
|
|
|
|
|
#Selectively print notes (omit private information)
|
|
|
|
#self.omitPrivInfo= reportOptions.No
|
|
|
|
|
|
|
|
#generate header for each page, specify text
|
|
|
|
#self.noHeader= reportOptions.Yes
|
|
|
|
|
|
|
|
#Inculde reference notes
|
|
|
|
#self.noRefNotes= reportOptions.Yes
|
|
|
|
|
|
|
|
#Include source notes
|
|
|
|
#self.noSourceNotes= reportOptions.Yes
|
|
|
|
|
|
|
|
#Replace missing Place with ___________
|
|
|
|
self.blankPlace= reportOptions.No
|
|
|
|
|
|
|
|
#Replace missing dates with __________
|
|
|
|
self.blankDate= reportOptions.No
|
|
|
|
|
|
|
|
#Omit country code
|
|
|
|
#self.noCountryInfo= reportOptions.No
|
|
|
|
|
|
|
|
#Put title before or after name (Dr., Lt., etc.)
|
|
|
|
#self.titleAfter= reportOptions.Yes
|
|
|
|
|
|
|
|
#Add "Died at the age of NN" in text
|
|
|
|
self.calcAgeFlag= reportOptions.Yes
|
|
|
|
|
|
|
|
#Add Photos and Images to report
|
2003-02-16 04:33:48 +05:30
|
|
|
self.addImages= reportOptions.Yes
|
2004-01-08 04:10:04 +05:30
|
|
|
#self.imageAttrTag= "DetAncestralReport-H"
|
2003-02-16 04:33:48 +05:30
|
|
|
#self.imageAttrTag= "DetAncestralReport-L"
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#Omit sensitive information such as birth, christening, marriage
|
|
|
|
# for living after XXXXX date.
|
|
|
|
|
|
|
|
#Omit duplicate persons, occurs when distant cousins marry
|
|
|
|
self.dupPersons= reportOptions.Yes
|
|
|
|
|
|
|
|
#Add descendant reference in child list
|
|
|
|
self.childRef= reportOptions.Yes
|
|
|
|
|
|
|
|
def calcAge(self, ind):
|
|
|
|
""" Calulate age
|
|
|
|
APHRASE=
|
|
|
|
at the age of NUMBER UNIT(S)
|
|
|
|
UNIT= year | month | day
|
|
|
|
UNITS= years | months | days
|
|
|
|
null
|
|
|
|
"""
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
birth= ind.get_birth().get_date_object().get_start_date()
|
|
|
|
death= ind.get_death().get_date_object().get_start_date()
|
2002-10-20 19:55:16 +05:30
|
|
|
self.t= ""
|
|
|
|
if birth.getYearValid() and death.getYearValid():
|
|
|
|
self.age= death.getYear() - birth.getYear()
|
2003-02-16 04:33:48 +05:30
|
|
|
self.units= 3 # year
|
2002-10-20 19:55:16 +05:30
|
|
|
if birth.getMonthValid() and death.getMonthValid():
|
|
|
|
if birth.getMonth() > death.getMonth():
|
|
|
|
self.age= self.age -1
|
|
|
|
if birth.getDayValid() and death.getDayValid():
|
|
|
|
if birth.getMonth() == death.getMonth() and birth.getDay() > death.getDay():
|
|
|
|
self.age= self.age -1
|
|
|
|
if self.age == 0:
|
|
|
|
self.age= death.getMonth() - birth.getMonth() # calc age in months
|
|
|
|
if birth.getDay() > death.getDay():
|
|
|
|
self.age= self.age - 1
|
2003-02-16 04:33:48 +05:30
|
|
|
self.units= 2 # month
|
2002-10-20 19:55:16 +05:30
|
|
|
if self.age == 0:
|
|
|
|
self.age= death.getDay() + 31 - birth.getDay() # calc age in days
|
2003-02-16 04:33:48 +05:30
|
|
|
self.units= 1 # day
|
|
|
|
if self.age > 1:
|
|
|
|
if self.units == 1:
|
|
|
|
self.t= _(" at the age of %d days") % self.age
|
|
|
|
elif self.units == 2:
|
|
|
|
self.t= _(" at the age of %d months") % self.age
|
|
|
|
else:
|
|
|
|
self.t= _(" at the age of %d years") % self.age
|
|
|
|
else:
|
|
|
|
if self.units == 1:
|
|
|
|
self.t= _(" at the age of %d day") % self.age
|
|
|
|
elif self.units == 2:
|
|
|
|
self.t= _(" at the age of %d month") % self.age
|
|
|
|
else:
|
|
|
|
self.t= _(" at the age of %d year") % self.age
|
2002-10-20 19:55:16 +05:30
|
|
|
return self.t
|