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
|
2006-03-01 01:24:35 +05:30
|
|
|
# Copyright (C) 2000-2006 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
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2006-04-07 03:32:46 +05:30
|
|
|
from gettext import gettext as _
|
2005-12-06 12:08:09 +05:30
|
|
|
import cStringIO
|
2005-01-02 01:28:53 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Gnome/GTK modules
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
import gtk
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GRAMPS modules
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2002-10-20 19:55:16 +05:30
|
|
|
import RelLib
|
2006-04-04 09:44:51 +05:30
|
|
|
import Utils
|
2003-02-16 04:33:48 +05:30
|
|
|
import Errors
|
2006-06-01 10:09:40 +05:30
|
|
|
from PluginUtils import register_report
|
|
|
|
from ReportBase import Report, ReportUtils, ReportOptions, \
|
|
|
|
CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
|
2003-09-02 06:17:09 +05:30
|
|
|
import BaseDoc
|
2005-01-02 01:28:53 +05:30
|
|
|
import const
|
2006-04-04 09:44:51 +05:30
|
|
|
import DateHandler
|
2005-02-02 10:39:07 +05:30
|
|
|
from NameDisplay import displayer as _nd
|
2005-12-06 12:08:09 +05:30
|
|
|
from QuestionDialog import ErrorDialog
|
2005-02-02 10:39:07 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Constants
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
EMPTY_ENTRY = "_____________"
|
2005-12-06 12:08:09 +05:30
|
|
|
HENRY = "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2006-06-01 10:09:40 +05:30
|
|
|
class DetDescendantReport(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.
|
2006-03-01 01:24:35 +05:30
|
|
|
includeMates - Whether to include information about spouses
|
2005-01-02 01:28:53 +05:30
|
|
|
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.
|
|
|
|
"""
|
2006-06-01 10:09:40 +05:30
|
|
|
Report.__init__(self,database,person,options_class)
|
2005-01-02 01:28:53 +05:30
|
|
|
|
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.fullDate = options_class.handler.options_dict['fulldates']
|
|
|
|
self.listChildren = options_class.handler.options_dict['listc']
|
|
|
|
self.includeNotes = options_class.handler.options_dict['incnotes']
|
2006-11-20 18:46:22 +05:30
|
|
|
self.usecall = options_class.handler.options_dict['usecall']
|
2005-01-02 01:28:53 +05:30
|
|
|
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']
|
2005-08-18 11:28:28 +05:30
|
|
|
self.includeNames = options_class.handler.options_dict['incnames']
|
|
|
|
self.includeEvents = options_class.handler.options_dict['incevents']
|
|
|
|
self.includeSources= options_class.handler.options_dict['incsources']
|
2006-03-01 01:24:35 +05:30
|
|
|
self.includeMates = options_class.handler.options_dict['incmates']
|
2005-01-02 01:28:53 +05:30
|
|
|
|
2005-02-02 10:39:07 +05:30
|
|
|
self.gen_handles = {}
|
|
|
|
self.prev_gen_handles= {}
|
|
|
|
self.gen_keys = []
|
2005-12-06 12:08:09 +05:30
|
|
|
self.henry = {}
|
2005-02-02 10:39:07 +05:30
|
|
|
|
|
|
|
if self.blankDate:
|
|
|
|
self.EMPTY_DATE = EMPTY_ENTRY
|
|
|
|
else:
|
|
|
|
self.EMPTY_DATE = ""
|
|
|
|
|
|
|
|
if self.blankPlace:
|
|
|
|
self.EMPTY_PLACE = EMPTY_ENTRY
|
|
|
|
else:
|
|
|
|
self.EMPTY_PLACE = ""
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-08-18 11:28:28 +05:30
|
|
|
self.sref_map = {}
|
|
|
|
self.sref_index = 0
|
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
def apply_filter(self,person_handle,index,pid,cur_gen=1):
|
2004-07-28 07:59:07 +05:30
|
|
|
if (not person_handle) or (cur_gen > self.max_generations):
|
2005-12-06 12:08:09 +05:30
|
|
|
return
|
|
|
|
self.henry[person_handle] = pid
|
2004-07-28 07:59:07 +05:30
|
|
|
self.map[index] = person_handle
|
2003-06-04 01:18:33 +05:30
|
|
|
|
2005-02-02 10:39:07 +05:30
|
|
|
if len(self.gen_keys) < cur_gen:
|
|
|
|
self.gen_keys.append([index])
|
2003-06-04 01:18:33 +05:30
|
|
|
else:
|
2005-02-02 10:39:07 +05:30
|
|
|
self.gen_keys[cur_gen-1].append(index)
|
2003-06-04 01:18:33 +05:30
|
|
|
|
2004-08-07 10:46:57 +05:30
|
|
|
person = self.database.get_person_from_handle(person_handle)
|
2005-12-06 12:08:09 +05:30
|
|
|
index = 0
|
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)
|
2006-04-22 10:43:21 +05:30
|
|
|
for child_ref in family.get_child_ref_list():
|
2003-06-04 01:18:33 +05:30
|
|
|
ix = max(self.map.keys())
|
2006-04-22 10:43:21 +05:30
|
|
|
self.apply_filter(child_ref.ref, ix+1,
|
2005-12-06 12:08:09 +05:30
|
|
|
pid+HENRY[index], cur_gen+1)
|
|
|
|
index += 1
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-02 10:39:07 +05:30
|
|
|
def write_report(self):
|
2005-12-06 12:08:09 +05:30
|
|
|
self.apply_filter(self.start_person.get_handle(),1,"1")
|
2005-01-02 01:28:53 +05:30
|
|
|
|
2005-02-22 09:13:53 +05:30
|
|
|
name = _nd.display_name(self.start_person.get_primary_name())
|
2005-02-02 10:39:07 +05:30
|
|
|
|
|
|
|
spouseName = ""
|
2005-08-18 11:28:28 +05:30
|
|
|
nspouses = 0
|
2005-02-02 10:39:07 +05:30
|
|
|
for family_handle in self.start_person.get_family_handle_list():
|
|
|
|
family = self.database.get_family_from_handle(family_handle)
|
|
|
|
if self.start_person.get_gender() == RelLib.Person.MALE:
|
|
|
|
spouse_handle = family.get_mother_handle()
|
2005-01-02 01:28:53 +05:30
|
|
|
else:
|
2005-02-02 10:39:07 +05:30
|
|
|
spouse_handle = family.get_father_handle()
|
|
|
|
if spouse_handle:
|
2005-08-18 11:28:28 +05:30
|
|
|
nspouses += 1
|
2005-02-02 10:39:07 +05:30
|
|
|
spouse = self.database.get_person_from_handle(spouse_handle)
|
|
|
|
spouseName = _nd.display(spouse)
|
2005-01-02 01:28:53 +05:30
|
|
|
|
2005-02-02 10:39:07 +05:30
|
|
|
self.doc.start_paragraph("DDR-Title")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
title = _("Descendant Report for %(person_name)s") % {
|
2005-02-02 10:39:07 +05:30
|
|
|
'person_name' : name }
|
2006-06-04 09:56:28 +05:30
|
|
|
mark = BaseDoc.IndexMark(title,BaseDoc.INDEX_TYPE_TOC,1)
|
|
|
|
self.doc.write_text(title,mark)
|
2005-02-02 10:39:07 +05:30
|
|
|
self.doc.end_paragraph()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-02 10:39:07 +05:30
|
|
|
keys = self.map.keys()
|
|
|
|
keys.sort()
|
|
|
|
generation = 0
|
|
|
|
need_header = 1
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-02 10:39:07 +05:30
|
|
|
for generation in xrange(len(self.gen_keys)):
|
|
|
|
if self.pgbrk and generation > 0:
|
|
|
|
self.doc.page_break()
|
|
|
|
self.doc.start_paragraph("DDR-Generation")
|
2005-12-06 12:08:09 +05:30
|
|
|
text = _("Generation %d") % (generation+1)
|
2006-06-04 09:56:28 +05:30
|
|
|
mark = BaseDoc.IndexMark(text,BaseDoc.INDEX_TYPE_TOC,2)
|
|
|
|
self.doc.write_text(text,mark)
|
2005-02-02 10:39:07 +05:30
|
|
|
self.doc.end_paragraph()
|
|
|
|
if self.childRef:
|
|
|
|
self.prev_gen_handles = self.gen_handles.copy()
|
|
|
|
self.gen_handles.clear()
|
|
|
|
|
|
|
|
for key in self.gen_keys[generation]:
|
|
|
|
person_handle = self.map[key]
|
|
|
|
person = self.database.get_person_from_handle(person_handle)
|
|
|
|
self.gen_handles[person_handle] = key
|
|
|
|
dupPerson = self.write_person(key)
|
2005-02-15 03:09:59 +05:30
|
|
|
if dupPerson == 0: # Is this a duplicate ind record
|
2006-11-14 10:09:55 +05:30
|
|
|
if self.listChildren or self.includeEvents:
|
2005-02-02 10:39:07 +05:30
|
|
|
for family_handle in person.get_family_handle_list():
|
|
|
|
family = self.database.get_family_from_handle(family_handle)
|
2006-11-14 10:09:55 +05:30
|
|
|
if self.listChildren:
|
|
|
|
self.write_children(family)
|
|
|
|
if self.includeEvents:
|
|
|
|
self.write_family_events(family)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-08-18 11:28:28 +05:30
|
|
|
if self.includeSources:
|
|
|
|
self.write_endnotes()
|
|
|
|
|
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-12-06 12:08:09 +05:30
|
|
|
plist = person.get_media_list()
|
|
|
|
if self.addImages and len(plist) > 0:
|
|
|
|
photo = plist[0]
|
|
|
|
ReportUtils.insert_image(self.database,self.doc,photo)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
val = self.henry[person_handle]
|
|
|
|
self.doc.start_paragraph("DDR-First-Entry","%s." % val)
|
2004-02-22 10:47:14 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
name = _nd.display_formal(person)
|
2006-06-03 09:02:26 +05:30
|
|
|
mark = ReportUtils.get_person_mark(self.database, person)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.doc.start_bold()
|
2006-06-03 09:02:26 +05:30
|
|
|
self.doc.write_text(name,mark)
|
2005-12-06 12:08:09 +05:30
|
|
|
if name[-1:] == '.':
|
|
|
|
self.doc.write_text(" ")
|
|
|
|
else:
|
|
|
|
self.doc.write_text(". ")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.end_bold()
|
2005-12-06 12:08:09 +05:30
|
|
|
# Output the global source references for this person
|
|
|
|
self.endnotes(person)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
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:
|
2005-12-06 12:08:09 +05:30
|
|
|
if dkey >= key:
|
2004-05-04 06:50:21 +05:30
|
|
|
break
|
|
|
|
if self.map[key] == self.map[dkey]:
|
2005-12-06 12:08:09 +05:30
|
|
|
self.doc.write_text(_("%(name)s is the same person as [%(id_str)s].") %
|
|
|
|
{ 'name' : '', 'id_str' : str(dkey) })
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.end_paragraph()
|
2005-02-15 03:09:59 +05:30
|
|
|
return 1 # Duplicate person
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
# Check birth record
|
2005-12-06 12:08:09 +05:30
|
|
|
|
2006-11-20 18:46:22 +05:30
|
|
|
first = ReportUtils.common_name(person,self.usecall)
|
2005-12-06 12:08:09 +05:30
|
|
|
text = ReportUtils.born_str(self.database,person,first,
|
|
|
|
self.EMPTY_DATE,self.EMPTY_PLACE)
|
|
|
|
if text:
|
|
|
|
self.doc.write_text(text)
|
2006-03-30 08:47:33 +05:30
|
|
|
birth_ref = person.get_birth_ref()
|
|
|
|
if birth_ref:
|
|
|
|
birth = self.database.get_event_from_handle(birth_ref.ref)
|
|
|
|
self.endnotes(birth)
|
2005-12-06 12:08:09 +05:30
|
|
|
first = 0
|
2006-03-01 01:24:35 +05:30
|
|
|
|
|
|
|
age,units = self.calc_age(person)
|
2005-12-06 12:08:09 +05:30
|
|
|
text = ReportUtils.died_str(self.database,person,first,
|
2006-03-01 01:24:35 +05:30
|
|
|
self.EMPTY_DATE,self.EMPTY_PLACE,age,units)
|
2005-12-06 12:08:09 +05:30
|
|
|
if text:
|
|
|
|
self.doc.write_text(text)
|
2006-03-30 08:47:33 +05:30
|
|
|
death_ref = person.get_birth_ref()
|
|
|
|
if death_ref:
|
|
|
|
death = self.database.get_event_from_handle(death_ref.ref)
|
|
|
|
self.endnotes(death)
|
2005-12-06 12:08:09 +05:30
|
|
|
first = 0
|
2005-02-02 10:39:07 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
|
|
|
|
text = ReportUtils.buried_str(self.database,person,first,
|
|
|
|
self.EMPTY_DATE,self.EMPTY_PLACE)
|
2005-02-02 10:39:07 +05:30
|
|
|
if text:
|
|
|
|
self.doc.write_text(text)
|
|
|
|
|
2006-11-20 18:46:22 +05:30
|
|
|
first = ReportUtils.common_name(person,self.usecall)
|
2005-12-06 12:08:09 +05:30
|
|
|
|
|
|
|
self.write_parents(person, first)
|
2005-01-02 01:28:53 +05:30
|
|
|
self.write_marriage(person)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.end_paragraph()
|
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
if self.includeMates:
|
2005-12-06 12:08:09 +05:30
|
|
|
self.write_mate(person)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
if person.get_note() != "" and self.includeNotes:
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph("DDR-NoteHeader")
|
2005-04-26 21:34:21 +05:30
|
|
|
self.doc.write_text(_("Notes for %s") % name)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.end_paragraph()
|
2005-12-06 12:08:09 +05:30
|
|
|
self.doc.write_note(person.get_note(),person.get_note_format(),
|
|
|
|
"DDR-Entry")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
first = True
|
2005-08-18 11:28:28 +05:30
|
|
|
if self.includeNames:
|
|
|
|
for alt_name in person.get_alternate_names():
|
|
|
|
if first:
|
|
|
|
self.doc.start_paragraph('DDR-MoreHeader')
|
|
|
|
self.doc.write_text(_('More about %(person_name)s:') % {
|
|
|
|
'person_name' : name })
|
|
|
|
self.doc.end_paragraph()
|
2005-12-06 12:08:09 +05:30
|
|
|
first = False
|
2005-08-18 11:28:28 +05:30
|
|
|
self.doc.start_paragraph('DDR-MoreDetails')
|
2006-04-22 12:26:48 +05:30
|
|
|
atype = str( alt_name.get_type() )
|
2006-04-04 09:44:51 +05:30
|
|
|
aname = alt_name.get_regular_name()
|
2005-08-18 11:28:28 +05:30
|
|
|
self.doc.write_text(_('%(name_kind)s: %(name)s%(endnotes)s') % {
|
2006-04-04 09:44:51 +05:30
|
|
|
'name_kind' : atype,
|
|
|
|
'name' : aname,
|
2005-08-18 11:28:28 +05:30
|
|
|
'endnotes' : self.endnotes(alt_name),
|
|
|
|
})
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
|
|
|
|
if self.includeEvents:
|
2006-06-28 09:31:14 +05:30
|
|
|
birth_ref = person.get_birth_ref()
|
|
|
|
death_ref = person.get_death_ref()
|
2006-11-22 10:13:33 +05:30
|
|
|
for event_ref in person.get_primary_event_ref_list():
|
2006-06-28 09:31:14 +05:30
|
|
|
if event_ref == birth_ref or event_ref == death_ref:
|
|
|
|
continue
|
2005-08-18 11:28:28 +05:30
|
|
|
|
|
|
|
if first:
|
|
|
|
self.doc.start_paragraph('DDR-MoreHeader')
|
|
|
|
self.doc.write_text(_('More about %(person_name)s:') % {
|
2005-12-06 12:08:09 +05:30
|
|
|
'person_name' : _nd.display(person) })
|
2005-08-18 11:28:28 +05:30
|
|
|
self.doc.end_paragraph()
|
|
|
|
first = 0
|
|
|
|
|
2006-11-14 10:09:55 +05:30
|
|
|
self.write_event(event_ref)
|
2005-08-18 11:28:28 +05:30
|
|
|
|
2005-02-15 03:09:59 +05:30
|
|
|
return 0 # Not duplicate person
|
2006-11-14 10:09:55 +05:30
|
|
|
|
|
|
|
def write_event(self, event_ref):
|
|
|
|
event = self.database.get_event_from_handle(event_ref.ref)
|
|
|
|
date = DateHandler.get_date(event)
|
|
|
|
ph = event.get_place_handle()
|
|
|
|
if ph:
|
|
|
|
place = self.database.get_place_from_handle(ph).get_title()
|
|
|
|
else:
|
|
|
|
place = u''
|
|
|
|
|
|
|
|
self.doc.start_paragraph('DDR-MoreDetails')
|
|
|
|
evtName = str( event.get_type() )
|
|
|
|
if date and place:
|
|
|
|
self.doc.write_text(
|
|
|
|
_('%(event_name)s: %(date)s, %(place)s%(endnotes)s. ') % {
|
|
|
|
'event_name' : _(evtName),
|
|
|
|
'date' : date,
|
|
|
|
'endnotes' : self.endnotes(event),
|
|
|
|
'place' : place })
|
|
|
|
elif date:
|
|
|
|
self.doc.write_text(
|
|
|
|
_('%(event_name)s: %(date)s%(endnotes)s. ') % {
|
|
|
|
'event_name' : _(evtName),
|
|
|
|
'endnotes' : self.endnotes(event),
|
|
|
|
'date' : date})
|
|
|
|
elif place:
|
|
|
|
self.doc.write_text(
|
|
|
|
_('%(event_name)s: %(place)s%(endnotes)s. ') % {
|
|
|
|
'event_name' : _(evtName),
|
|
|
|
'endnotes' : self.endnotes(event),
|
|
|
|
'place' : place })
|
|
|
|
else:
|
|
|
|
self.doc.write_text(_('%(event_name)s: ') % {
|
|
|
|
'event_name' : _(evtName)})
|
|
|
|
if event.get_description():
|
|
|
|
self.doc.write_text(event.get_description())
|
2006-12-21 18:34:02 +05:30
|
|
|
self.doc.write_text(".")
|
2006-11-14 10:09:55 +05:30
|
|
|
self.doc.end_paragraph()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-02 10:39:07 +05:30
|
|
|
def write_parents(self, person, firstName):
|
|
|
|
family_handle = person.get_main_parents_family_handle()
|
|
|
|
if family_handle:
|
|
|
|
family = self.database.get_family_from_handle(family_handle)
|
|
|
|
mother_handle = family.get_mother_handle()
|
|
|
|
father_handle = family.get_father_handle()
|
|
|
|
if mother_handle:
|
|
|
|
mother = self.database.get_person_from_handle(mother_handle)
|
2005-02-22 09:13:53 +05:30
|
|
|
mother_name = _nd.display_name(mother.get_primary_name())
|
2006-06-03 09:02:26 +05:30
|
|
|
mother_mark = ReportUtils.get_person_mark(self.database, mother)
|
2002-10-20 19:55:16 +05:30
|
|
|
else:
|
2005-02-02 10:39:07 +05:30
|
|
|
mother_name = ""
|
2006-06-03 09:02:26 +05:30
|
|
|
mother_mark = ""
|
2005-02-02 10:39:07 +05:30
|
|
|
if father_handle:
|
|
|
|
father = self.database.get_person_from_handle(father_handle)
|
2005-02-22 09:13:53 +05:30
|
|
|
father_name = _nd.display_name(father.get_primary_name())
|
2006-06-03 09:02:26 +05:30
|
|
|
father_mark = ReportUtils.get_person_mark(self.database, father)
|
2004-05-04 06:50:21 +05:30
|
|
|
else:
|
2005-02-02 10:39:07 +05:30
|
|
|
father_name = ""
|
2006-06-03 09:02:26 +05:30
|
|
|
father_mark = ""
|
2005-02-02 10:39:07 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
text = ReportUtils.child_str(person, father_name, mother_name,
|
2006-03-30 08:47:33 +05:30
|
|
|
bool(person.get_death_ref()),
|
2005-12-06 12:08:09 +05:30
|
|
|
firstName)
|
2005-02-02 10:39:07 +05:30
|
|
|
if text:
|
|
|
|
self.doc.write_text(text)
|
2006-06-03 09:02:26 +05:30
|
|
|
if father_mark:
|
|
|
|
self.doc.write_text("",father_mark)
|
|
|
|
if mother_mark:
|
|
|
|
self.doc.write_text("",mother_mark)
|
2005-02-02 10:39:07 +05:30
|
|
|
|
|
|
|
def write_marriage(self, person):
|
2005-12-06 12:08:09 +05:30
|
|
|
"""
|
|
|
|
Output marriage sentence.
|
|
|
|
"""
|
2005-02-02 10:39:07 +05:30
|
|
|
is_first = True
|
|
|
|
for family_handle in person.get_family_handle_list():
|
|
|
|
family = self.database.get_family_from_handle(family_handle)
|
|
|
|
spouse_handle = ReportUtils.find_spouse(person,family)
|
|
|
|
spouse = self.database.get_person_from_handle(spouse_handle)
|
|
|
|
marriage_event = ReportUtils.find_marriage(self.database,family)
|
|
|
|
text = ""
|
2006-06-03 09:02:26 +05:30
|
|
|
spouse_mark = ReportUtils.get_person_mark(self.database, spouse)
|
2005-02-02 10:39:07 +05:30
|
|
|
if marriage_event:
|
|
|
|
text = ReportUtils.married_str(self.database,person,spouse,
|
2005-08-18 11:28:28 +05:30
|
|
|
marriage_event,self.endnotes,
|
2005-02-02 10:39:07 +05:30
|
|
|
self.EMPTY_DATE,self.EMPTY_PLACE,
|
|
|
|
is_first)
|
2004-05-04 06:50:21 +05:30
|
|
|
else:
|
2005-02-02 10:39:07 +05:30
|
|
|
text = ReportUtils.married_rel_str(self.database,person,family,
|
|
|
|
is_first)
|
|
|
|
if text:
|
2006-06-03 09:02:26 +05:30
|
|
|
self.doc.write_text(text,spouse_mark)
|
2005-02-02 10:39:07 +05:30
|
|
|
is_first = False
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-02 10:39:07 +05:30
|
|
|
def write_children(self, family):
|
|
|
|
""" List children.
|
2002-10-20 19:55:16 +05:30
|
|
|
"""
|
|
|
|
|
2006-04-22 10:43:21 +05:30
|
|
|
if not family.get_child_ref_list():
|
2005-02-02 10:39:07 +05:30
|
|
|
return
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-02 10:39:07 +05:30
|
|
|
mother_handle = family.get_mother_handle()
|
|
|
|
if mother_handle:
|
|
|
|
mother = self.database.get_person_from_handle(mother_handle)
|
|
|
|
mother_name = _nd.display(mother)
|
|
|
|
else:
|
|
|
|
mother_name = _("unknown")
|
|
|
|
|
|
|
|
father_handle = family.get_father_handle()
|
|
|
|
if father_handle:
|
|
|
|
father = self.database.get_person_from_handle(father_handle)
|
|
|
|
father_name = _nd.display(father)
|
|
|
|
else:
|
|
|
|
father_name = _("unknown")
|
|
|
|
|
|
|
|
self.doc.start_paragraph("DDR-ChildTitle")
|
2005-12-06 12:08:09 +05:30
|
|
|
self.doc.write_text(_("Children of %s and %s") %
|
|
|
|
(mother_name,father_name))
|
2005-02-02 10:39:07 +05:30
|
|
|
self.doc.end_paragraph()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
cnt = 1
|
2006-04-22 10:43:21 +05:30
|
|
|
for child_ref in family.get_child_ref_list():
|
|
|
|
child_handle = child_ref.ref
|
2005-02-02 10:39:07 +05:30
|
|
|
child = self.database.get_person_from_handle(child_handle)
|
|
|
|
child_name = _nd.display(child)
|
2006-06-03 09:02:26 +05:30
|
|
|
child_mark = ReportUtils.get_person_mark(self.database,child)
|
2005-02-02 10:39:07 +05:30
|
|
|
|
|
|
|
if self.childRef and self.prev_gen_handles.get(child_handle):
|
2005-12-06 12:08:09 +05:30
|
|
|
value = str(self.prev_gen_handles.get(child_handle))
|
|
|
|
child_name += " [%s]" % value
|
2005-02-02 10:39:07 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
self.doc.start_paragraph("DDR-ChildList",
|
|
|
|
ReportUtils.roman(cnt).lower() + ".")
|
|
|
|
cnt += 1
|
2005-02-02 10:39:07 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
if self.henry.has_key(child_handle):
|
|
|
|
self.doc.write_text("%s [%s]. " % (child_name,
|
2006-05-30 06:48:41 +05:30
|
|
|
self.henry[child_handle]),
|
2006-06-03 09:02:26 +05:30
|
|
|
child_mark )
|
2005-12-06 12:08:09 +05:30
|
|
|
else:
|
2006-06-03 09:02:26 +05:30
|
|
|
self.doc.write_text("%s. " % child_name,child_mark)
|
2005-12-06 12:08:09 +05:30
|
|
|
|
|
|
|
self.doc.write_text(ReportUtils.born_str(
|
|
|
|
self.database, child, 0, self.EMPTY_DATE, self.EMPTY_PLACE))
|
|
|
|
self.doc.write_text(ReportUtils.died_str(
|
|
|
|
self.database, child, 0, self.EMPTY_DATE, self.EMPTY_PLACE))
|
2005-02-02 10:39:07 +05:30
|
|
|
self.doc.end_paragraph()
|
|
|
|
|
2006-11-14 10:09:55 +05:30
|
|
|
def write_family_events(self,family):
|
|
|
|
|
|
|
|
if not family.get_event_ref_list():
|
|
|
|
return
|
|
|
|
|
|
|
|
mother_handle = family.get_mother_handle()
|
|
|
|
if mother_handle:
|
|
|
|
mother = self.database.get_person_from_handle(mother_handle)
|
|
|
|
mother_name = _nd.display(mother)
|
|
|
|
else:
|
|
|
|
mother_name = _("unknown")
|
|
|
|
|
|
|
|
father_handle = family.get_father_handle()
|
|
|
|
if father_handle:
|
|
|
|
father = self.database.get_person_from_handle(father_handle)
|
|
|
|
father_name = _nd.display(father)
|
|
|
|
else:
|
|
|
|
father_name = _("unknown")
|
|
|
|
|
|
|
|
first = 1
|
|
|
|
for event_ref in family.get_event_ref_list():
|
|
|
|
if first:
|
|
|
|
self.doc.start_paragraph('DDR-MoreHeader')
|
|
|
|
self.doc.write_text(
|
|
|
|
_('More about %(mother_name)s and %(father_name)s:') % {
|
|
|
|
'mother_name' : mother_name,
|
|
|
|
'father_name' : father_name })
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
first = 0
|
|
|
|
self.write_event(event_ref)
|
|
|
|
|
2005-02-02 10:39:07 +05:30
|
|
|
def write_mate(self, mate):
|
|
|
|
"""Output birth, death, parentage, marriage and notes information """
|
|
|
|
for family_handle in mate.get_family_handle_list():
|
|
|
|
family = self.database.get_family_from_handle(family_handle)
|
|
|
|
person_name = ""
|
|
|
|
ind_handle = None
|
2006-08-12 09:07:05 +05:30
|
|
|
has_info = False
|
|
|
|
person_key = ""
|
2005-02-02 10:39:07 +05:30
|
|
|
if mate.get_gender() == RelLib.Person.MALE:
|
|
|
|
ind_handle = family.get_mother_handle()
|
2003-06-03 00:14:39 +05:30
|
|
|
else:
|
2005-02-02 10:39:07 +05:30
|
|
|
ind_handle = family.get_father_handle()
|
|
|
|
if ind_handle:
|
|
|
|
ind = self.database.get_person_from_handle(ind_handle)
|
|
|
|
person_name = _nd.display(ind)
|
2006-06-03 09:02:26 +05:30
|
|
|
person_mark = ReportUtils.get_person_mark(self.database,ind)
|
2006-11-20 18:46:22 +05:30
|
|
|
firstName = ReportUtils.common_name(ind,self.usecall)
|
2006-08-12 09:07:05 +05:30
|
|
|
|
2006-11-22 10:13:33 +05:30
|
|
|
for event_ref in ind.get_primary_event_ref_list():
|
2006-08-12 09:07:05 +05:30
|
|
|
event = self.database.get_event_from_handle(event_ref.ref)
|
|
|
|
if event:
|
|
|
|
etype = event.get_type()
|
|
|
|
if etype == RelLib.EventType.BURIAL or \
|
|
|
|
etype == RelLib.EventType.BIRTH or \
|
|
|
|
etype == RelLib.EventType.DEATH :
|
|
|
|
has_info = True
|
|
|
|
break
|
|
|
|
if not has_info:
|
|
|
|
family_handle = ind.get_main_parents_family_handle()
|
|
|
|
if family_handle:
|
|
|
|
f = self.database.get_family_from_handle(family_handle)
|
|
|
|
if f.get_mother_handle() or f.get_father_handle():
|
|
|
|
has_info = True
|
2005-12-06 12:08:09 +05:30
|
|
|
else:
|
|
|
|
firstName = 0
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2006-08-12 09:07:05 +05:30
|
|
|
print_name = ""
|
|
|
|
|
|
|
|
if person_name and has_info:
|
2004-02-22 10:47:14 +05:30
|
|
|
self.doc.start_paragraph("DDR-Entry")
|
|
|
|
|
2006-08-12 09:07:05 +05:30
|
|
|
self.doc.write_text(person_name,person_key)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2006-08-12 09:07:05 +05:30
|
|
|
text = ReportUtils.born_str(self.database,ind,print_name,
|
2005-02-02 10:39:07 +05:30
|
|
|
self.EMPTY_DATE,self.EMPTY_PLACE)
|
|
|
|
if text:
|
|
|
|
self.doc.write_text(text)
|
2006-08-12 09:07:05 +05:30
|
|
|
print_name = 0;
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-02 10:39:07 +05:30
|
|
|
age,units = self.calc_age(ind)
|
2006-08-12 09:07:05 +05:30
|
|
|
text = ReportUtils.died_str(self.database,ind,print_name,
|
2005-02-02 10:39:07 +05:30
|
|
|
self.EMPTY_DATE,self.EMPTY_PLACE,age,units)
|
|
|
|
if text:
|
|
|
|
self.doc.write_text(text)
|
2006-08-12 09:07:05 +05:30
|
|
|
print_name = 0;
|
2005-02-02 10:39:07 +05:30
|
|
|
|
2006-08-12 09:07:05 +05:30
|
|
|
text = ReportUtils.buried_str(self.database,ind,print_name,
|
2005-02-02 10:39:07 +05:30
|
|
|
self.EMPTY_DATE,self.EMPTY_PLACE)
|
|
|
|
if text:
|
|
|
|
self.doc.write_text(text)
|
2006-08-12 09:07:05 +05:30
|
|
|
print_name = 0;
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2006-08-12 09:07:05 +05:30
|
|
|
if print_name == 0:
|
|
|
|
print_name = firstName
|
|
|
|
self.write_parents(ind, print_name)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-02 10:39:07 +05:30
|
|
|
self.doc.end_paragraph()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-02-02 10:39:07 +05:30
|
|
|
def calc_age(self,ind):
|
|
|
|
"""
|
|
|
|
Calulate age.
|
|
|
|
|
|
|
|
Returns a tuple (age,units) where units is an integer representing
|
|
|
|
time units:
|
|
|
|
no age info: 0
|
|
|
|
years: 1
|
|
|
|
months: 2
|
|
|
|
days: 3
|
|
|
|
"""
|
|
|
|
if self.calcAgeFlag:
|
|
|
|
return ReportUtils.old_calc_age(self.database,ind)
|
|
|
|
else:
|
|
|
|
return (0,0)
|
2003-07-07 22:05:32 +05:30
|
|
|
|
2005-08-18 11:28:28 +05:30
|
|
|
def write_endnotes(self):
|
|
|
|
keys = self.sref_map.keys()
|
|
|
|
if not keys:
|
|
|
|
return
|
|
|
|
|
|
|
|
self.doc.start_paragraph('DDR-Endnotes-Header')
|
|
|
|
self.doc.write_text(_('Endnotes'))
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
|
|
|
|
keys.sort()
|
|
|
|
for key in keys:
|
|
|
|
srcref = self.sref_map[key]
|
2006-05-23 05:26:57 +05:30
|
|
|
base = self.database.get_source_from_handle(
|
|
|
|
srcref.get_reference_handle())
|
2005-08-18 11:28:28 +05:30
|
|
|
|
|
|
|
self.doc.start_paragraph('DDR-Endnotes',"%d." % key)
|
|
|
|
self.doc.write_text(base.get_title())
|
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
# Disable writing reference details, because only the details
|
|
|
|
# the first reference to this source will appear.
|
|
|
|
# FIXME: need to properly change self.endnotes() to put
|
|
|
|
# this feature back correclty.
|
|
|
|
## for item in [ base.get_author(), base.get_publication_info(), base.get_abbreviation(),
|
|
|
|
## _dd.display(srcref.get_date_object()),]:
|
|
|
|
## if item:
|
|
|
|
## self.doc.write_text('; %s' % item)
|
|
|
|
##
|
|
|
|
## item = srcref.get_text()
|
|
|
|
## if item:
|
|
|
|
## self.doc.write_text('; ')
|
|
|
|
## self.doc.write_text(_('Text:'))
|
|
|
|
## self.doc.write_text(' ')
|
|
|
|
## self.doc.write_text(item)
|
|
|
|
##
|
|
|
|
## item = srcref.get_note()
|
|
|
|
## if item:
|
|
|
|
## self.doc.write_text('; ')
|
|
|
|
## self.doc.write_text(_('Comments:'))
|
|
|
|
## self.doc.write_text(' ')
|
|
|
|
## self.doc.write_text(item)
|
2005-08-18 11:28:28 +05:30
|
|
|
|
|
|
|
self.doc.write_text('.')
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
|
|
|
|
def endnotes(self,obj):
|
2005-12-06 12:08:09 +05:30
|
|
|
if not obj or not self.includeSources:
|
2005-08-18 11:28:28 +05:30
|
|
|
return ""
|
2005-12-06 12:08:09 +05:30
|
|
|
|
2005-08-18 11:28:28 +05:30
|
|
|
msg = cStringIO.StringIO()
|
|
|
|
slist = obj.get_source_references()
|
|
|
|
if slist:
|
|
|
|
msg.write('<super>')
|
|
|
|
first = 1
|
|
|
|
for ref in slist:
|
|
|
|
if not first:
|
|
|
|
msg.write(',')
|
|
|
|
first = 0
|
2006-05-23 05:26:57 +05:30
|
|
|
ref_base = ref.get_reference_handle()
|
2005-08-18 11:28:28 +05:30
|
|
|
the_key = 0
|
|
|
|
for key in self.sref_map.keys():
|
2006-05-23 05:26:57 +05:30
|
|
|
if ref_base == self.sref_map[key].get_reference_handle():
|
2005-08-18 11:28:28 +05:30
|
|
|
the_key = key
|
|
|
|
break
|
|
|
|
if the_key:
|
|
|
|
msg.write("%d" % the_key)
|
|
|
|
else:
|
|
|
|
self.sref_index += 1
|
|
|
|
self.sref_map[self.sref_index] = ref
|
|
|
|
msg.write("%d" % self.sref_index)
|
|
|
|
msg.write('</super>')
|
|
|
|
str = msg.getvalue()
|
|
|
|
msg.close()
|
|
|
|
return str
|
|
|
|
|
2003-07-07 22:05:32 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2006-06-01 10:09:40 +05:30
|
|
|
class DetDescendantOptions(ReportOptions):
|
2005-01-02 01:28:53 +05:30
|
|
|
|
|
|
|
"""
|
|
|
|
Defines options and provides handling interface.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self,name,person_id=None):
|
2006-06-01 10:09:40 +05:30
|
|
|
ReportOptions.__init__(self,name,person_id)
|
2005-01-02 01:28:53 +05:30
|
|
|
|
|
|
|
def set_new_options(self):
|
|
|
|
# Options specific for this report
|
|
|
|
self.options_dict = {
|
|
|
|
'fulldates' : 1,
|
|
|
|
'listc' : 1,
|
|
|
|
'incnotes' : 1,
|
2006-11-20 18:46:22 +05:30
|
|
|
'usecall' : 1,
|
2005-01-02 01:28:53 +05:30
|
|
|
'repplace' : 0,
|
|
|
|
'repdate' : 0,
|
|
|
|
'computeage' : 1,
|
|
|
|
'omitda' : 1,
|
|
|
|
'desref' : 1,
|
|
|
|
'incphotos' : 0,
|
2005-08-18 11:28:28 +05:30
|
|
|
'incnames' : 0,
|
|
|
|
'incevents' : 0,
|
|
|
|
'incsources' : 0,
|
2006-03-01 01:24:35 +05:30
|
|
|
'incmates' : 1,
|
2005-01-02 01:28:53 +05:30
|
|
|
}
|
|
|
|
self.options_help = {
|
|
|
|
'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),
|
2006-11-20 18:46:22 +05:30
|
|
|
'usecall' : ("=0/1","Whether to use the call name as the first name.",
|
|
|
|
["Do not use call name","Use call name"],
|
2005-12-06 12:08:09 +05:30
|
|
|
True),
|
2005-01-02 01:28:53 +05:30
|
|
|
'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),
|
2005-08-18 11:28:28 +05:30
|
|
|
'incnames' : ("=0/1","Whether to include other names.",
|
|
|
|
["Do not include other names","Include other names"],
|
|
|
|
True),
|
|
|
|
'incevents' : ("=0/1","Whether to include events.",
|
|
|
|
["Do not include events","Include events"],
|
|
|
|
True),
|
|
|
|
'incsources' : ("=0/1","Whether to include source references.",
|
|
|
|
["Do not include sources","Include sources"],
|
|
|
|
True),
|
2006-03-01 01:24:35 +05:30
|
|
|
'incmates' : ("=0/1","Whether to include detailed spouse information.",
|
|
|
|
["Do not include spouse info","Include spouse info"],
|
|
|
|
True),
|
2005-01-02 01:28:53 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
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):
|
2005-12-06 12:08:09 +05:30
|
|
|
"""Make the default output style for the Detailed Ancestral Report"""
|
2005-01-02 01:28:53 +05:30
|
|
|
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)
|
2005-12-06 12:08:09 +05:30
|
|
|
para.set_top_margin(0.25)
|
|
|
|
para.set_bottom_margin(0.25)
|
2006-06-04 09:56:28 +05:30
|
|
|
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
|
2005-01-02 01:28:53 +05:30
|
|
|
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)
|
2005-12-06 12:08:09 +05:30
|
|
|
para.set_top_margin(0.25)
|
|
|
|
para.set_bottom_margin(0.25)
|
2005-01-02 01:28:53 +05:30
|
|
|
para.set_description(_('The style used for the generation header.'))
|
|
|
|
default_style.add_style("DDR-Generation",para)
|
|
|
|
|
|
|
|
font = BaseDoc.FontStyle()
|
2005-12-06 12:08:09 +05:30
|
|
|
font.set(face=BaseDoc.FONT_SANS_SERIF,size=10,italic=0, bold=1)
|
2005-01-02 01:28:53 +05:30
|
|
|
para = BaseDoc.ParagraphStyle()
|
|
|
|
para.set_font(font)
|
2005-12-06 12:08:09 +05:30
|
|
|
para.set_left_margin(1.5) # in centimeters
|
|
|
|
para.set_top_margin(0.25)
|
|
|
|
para.set_bottom_margin(0.25)
|
2005-01-02 01:28:53 +05:30
|
|
|
para.set_description(_('The style used for the children list title.'))
|
|
|
|
default_style.add_style("DDR-ChildTitle",para)
|
|
|
|
|
|
|
|
font = BaseDoc.FontStyle()
|
2005-12-06 12:08:09 +05:30
|
|
|
font.set(size=10)
|
2005-01-02 01:28:53 +05:30
|
|
|
para = BaseDoc.ParagraphStyle()
|
|
|
|
para.set_font(font)
|
2005-12-06 12:08:09 +05:30
|
|
|
para.set(first_indent=-0.75,lmargin=2.25)
|
|
|
|
para.set_top_margin(0.125)
|
|
|
|
para.set_bottom_margin(0.125)
|
2005-01-02 01:28:53 +05:30
|
|
|
para.set_description(_('The style used for the children list.'))
|
|
|
|
default_style.add_style("DDR-ChildList",para)
|
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
font = BaseDoc.FontStyle()
|
|
|
|
font.set(face=BaseDoc.FONT_SANS_SERIF,size=10,italic=0, bold=1)
|
2005-01-02 01:28:53 +05:30
|
|
|
para = BaseDoc.ParagraphStyle()
|
2005-12-06 12:08:09 +05:30
|
|
|
para.set_font(font)
|
|
|
|
para.set(first_indent=0.0,lmargin=1.5)
|
|
|
|
para.set_top_margin(0.25)
|
|
|
|
para.set_bottom_margin(0.25)
|
2005-01-02 01:28:53 +05:30
|
|
|
default_style.add_style("DDR-NoteHeader",para)
|
|
|
|
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
2005-12-06 12:08:09 +05:30
|
|
|
para.set(lmargin=1.5)
|
|
|
|
para.set_top_margin(0.25)
|
|
|
|
para.set_bottom_margin(0.25)
|
|
|
|
para.set_description(_('The basic style used for the text display.'))
|
2005-01-02 01:28:53 +05:30
|
|
|
default_style.add_style("DDR-Entry",para)
|
|
|
|
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
2005-12-06 12:08:09 +05:30
|
|
|
para.set(first_indent=-1.5,lmargin=1.5)
|
|
|
|
para.set_top_margin(0.25)
|
|
|
|
para.set_bottom_margin(0.25)
|
2005-01-02 01:28:53 +05:30
|
|
|
para.set_description(_('The style used for the first personal entry.'))
|
|
|
|
default_style.add_style("DDR-First-Entry",para)
|
|
|
|
|
2005-08-18 11:28:28 +05:30
|
|
|
font = BaseDoc.FontStyle()
|
2005-12-06 12:08:09 +05:30
|
|
|
font.set(size=10,face=BaseDoc.FONT_SANS_SERIF,bold=1)
|
2005-08-18 11:28:28 +05:30
|
|
|
para = BaseDoc.ParagraphStyle()
|
|
|
|
para.set_font(font)
|
2005-12-06 12:08:09 +05:30
|
|
|
para.set(first_indent=0.0,lmargin=1.5)
|
|
|
|
para.set_top_margin(0.25)
|
|
|
|
para.set_bottom_margin(0.25)
|
2005-08-18 11:28:28 +05:30
|
|
|
para.set_description(_('The style used for the More About header.'))
|
|
|
|
default_style.add_style("DDR-MoreHeader",para)
|
|
|
|
|
|
|
|
font = BaseDoc.FontStyle()
|
2005-12-06 12:08:09 +05:30
|
|
|
font.set(face=BaseDoc.FONT_SERIF,size=10)
|
2005-08-18 11:28:28 +05:30
|
|
|
para = BaseDoc.ParagraphStyle()
|
|
|
|
para.set_font(font)
|
2005-12-06 12:08:09 +05:30
|
|
|
para.set(first_indent=0.0,lmargin=1.5)
|
|
|
|
para.set_top_margin(0.25)
|
|
|
|
para.set_bottom_margin(0.25)
|
2005-08-18 11:28:28 +05:30
|
|
|
para.set_description(_('The style used for additional detail data.'))
|
|
|
|
default_style.add_style("DDR-MoreDetails",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)
|
2005-12-06 12:08:09 +05:30
|
|
|
para.set_top_margin(0.25)
|
|
|
|
para.set_bottom_margin(0.25)
|
2005-08-18 11:28:28 +05:30
|
|
|
para.set_description(_('The style used for the generation header.'))
|
|
|
|
default_style.add_style("DDR-Endnotes-Header",para)
|
|
|
|
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
2006-10-09 08:59:34 +05:30
|
|
|
para.set(first_indent=-0.8,lmargin=1.5)
|
2005-12-06 12:08:09 +05:30
|
|
|
para.set_top_margin(0.25)
|
|
|
|
para.set_bottom_margin(0.25)
|
2005-08-18 11:28:28 +05:30
|
|
|
para.set_description(_('The basic style used for the endnotes text display.'))
|
|
|
|
default_style.add_style("DDR-Endnotes",para)
|
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
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
|
|
|
|
|
|
|
# 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
|
|
|
|
2006-11-20 18:46:22 +05:30
|
|
|
# Print callname
|
|
|
|
self.usecall = gtk.CheckButton(_("Use callname for common name"))
|
|
|
|
self.usecall.set_active(self.options_dict['usecall'])
|
2005-12-06 12:08:09 +05:30
|
|
|
|
2003-07-07 22:05:32 +05:30
|
|
|
# Replace missing Place with ___________
|
2005-04-26 21:34:21 +05:30
|
|
|
self.place_option = gtk.CheckButton(_("Replace missing places 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 __________
|
2005-04-26 21:34:21 +05:30
|
|
|
self.date_option = gtk.CheckButton(_("Replace missing 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
|
|
|
|
2005-08-18 11:28:28 +05:30
|
|
|
# Print alternative names
|
|
|
|
self.include_names_option = gtk.CheckButton(_("Include alternative names"))
|
|
|
|
self.include_names_option.set_active(self.options_dict['incnames'])
|
|
|
|
|
|
|
|
# Print events
|
|
|
|
self.include_events_option = gtk.CheckButton(_("Include events"))
|
|
|
|
self.include_events_option.set_active(self.options_dict['incevents'])
|
|
|
|
|
|
|
|
# Print sources
|
|
|
|
self.include_sources_option = gtk.CheckButton(_("Include sources"))
|
|
|
|
self.include_sources_option.set_active(self.options_dict['incsources'])
|
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
# Print Spouses
|
|
|
|
self.include_spouses_option = gtk.CheckButton(_("Include spouses"))
|
|
|
|
self.include_spouses_option.set_active(self.options_dict['incmates'])
|
|
|
|
|
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)
|
|
|
|
|
2006-11-20 18:46:22 +05:30
|
|
|
dialog.add_frame_option(_('Content'),'',self.usecall)
|
2005-01-02 01:28:53 +05:30
|
|
|
dialog.add_frame_option(_('Content'),'',self.full_date_option)
|
|
|
|
dialog.add_frame_option(_('Content'),'',self.list_children_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)
|
2005-12-06 12:08:09 +05:30
|
|
|
dialog.add_frame_option(_('Include'),'',self.image_option)
|
2006-11-20 18:46:22 +05:30
|
|
|
dialog.add_frame_option(_('Include'),'',self.include_notes_option)
|
2005-12-06 12:08:09 +05:30
|
|
|
dialog.add_frame_option(_('Include'),'',self.include_names_option)
|
|
|
|
dialog.add_frame_option(_('Include'),'',self.include_events_option)
|
|
|
|
dialog.add_frame_option(_('Include'),'',self.include_sources_option)
|
2006-03-01 01:24:35 +05:30
|
|
|
dialog.add_frame_option(_('Include'),'',self.include_spouses_option)
|
2005-12-06 12:08:09 +05:30
|
|
|
dialog.add_frame_option(_('Missing information'),'',self.place_option)
|
|
|
|
dialog.add_frame_option(_('Missing information'),'',self.date_option)
|
2005-01-02 01:28:53 +05:30
|
|
|
|
|
|
|
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['fulldates'] = int(self.full_date_option.get_active())
|
|
|
|
self.options_dict['listc'] = int(self.list_children_option.get_active())
|
2006-11-20 18:46:22 +05:30
|
|
|
self.options_dict['usecall'] = int(self.usecall.get_active())
|
2005-01-02 01:28:53 +05:30
|
|
|
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())
|
2005-08-18 11:28:28 +05:30
|
|
|
self.options_dict['incnames'] = int(self.include_names_option.get_active())
|
|
|
|
self.options_dict['incevents'] = int(self.include_events_option.get_active())
|
|
|
|
self.options_dict['incsources'] = int(self.include_sources_option.get_active())
|
2006-03-01 01:24:35 +05:30
|
|
|
self.options_dict['incmates'] = int(self.include_spouses_option.get_active())
|
2003-07-07 22:05:32 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
register_report(
|
2005-01-02 01:28:53 +05:30
|
|
|
name = 'det_descendant_report',
|
2006-06-01 10:09:40 +05:30
|
|
|
category = CATEGORY_TEXT,
|
2005-01-02 01:28:53 +05:30
|
|
|
report_class = DetDescendantReport,
|
|
|
|
options_class = DetDescendantOptions,
|
2006-06-01 10:09:40 +05:30
|
|
|
modes = MODE_GUI | MODE_BKI | MODE_CLI,
|
2005-01-02 01:28:53 +05:30
|
|
|
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
|
|
|
)
|