2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2007-06-28 11:11:40 +05:30
|
|
|
# Copyright (C) 2000-2007 Donald N. Allingham
|
2007-04-23 17:16:26 +05:30
|
|
|
# Copyright (C) 2007 Brian G. Matherly
|
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
|
|
|
|
#
|
|
|
|
|
2004-02-01 06:04:36 +05:30
|
|
|
# $Id$
|
|
|
|
|
2006-05-10 04:48:37 +05:30
|
|
|
"""Generate files/Family Group Report"""
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Gnome/GTK modules
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2003-07-07 03:25:52 +05:30
|
|
|
import gtk
|
2005-01-02 01:28:53 +05:30
|
|
|
|
2003-01-15 10:55:50 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# GRAMPS
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2007-10-08 22:11:39 +05:30
|
|
|
import gen.lib
|
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-08-06 08:27:37 +05:30
|
|
|
import DateHandler
|
2006-03-29 08:05:19 +05:30
|
|
|
import Utils
|
2006-05-02 02:41:26 +05:30
|
|
|
from TransUtils import sgettext as _
|
2007-06-28 11:11:40 +05:30
|
|
|
from BasicUtils import name_displayer as _nd
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
2003-01-15 10:55:50 +05:30
|
|
|
# FamilyGroup
|
2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2006-06-01 10:09:40 +05:30
|
|
|
class FamilyGroup(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 DetAncestorReport object that produces the report.
|
2004-05-04 09:02:37 +05:30
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
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.
|
|
|
|
|
|
|
|
family_handle - Handle of the family to write report on.
|
2007-08-12 09:27:18 +05:30
|
|
|
includeAttrs - Whether to include attributes
|
2005-01-02 01:28:53 +05:30
|
|
|
"""
|
2006-06-01 10:09:40 +05:30
|
|
|
Report.__init__(self,database,person,options_class)
|
2005-01-02 01:28:53 +05:30
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
self.family_handle = None
|
2005-01-09 01:49:06 +05:30
|
|
|
|
2006-08-13 09:02:59 +05:30
|
|
|
family_id = options_class.handler.options_dict['family_id']
|
|
|
|
if family_id:
|
2005-01-02 01:28:53 +05:30
|
|
|
family_list = person.get_family_handle_list()
|
|
|
|
for family_handle in family_list:
|
|
|
|
family = database.get_family_from_handle(family_handle)
|
2006-08-13 09:02:59 +05:30
|
|
|
this_family_id = family.get_gramps_id()
|
|
|
|
if this_family_id == family_id:
|
2006-03-01 01:24:35 +05:30
|
|
|
self.family_handle = family_handle
|
2005-01-02 01:28:53 +05:30
|
|
|
break
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
self.recursive = options_class.handler.options_dict['recursive']
|
|
|
|
self.missingInfo = options_class.handler.options_dict['missinginfo']
|
|
|
|
self.generations = options_class.handler.options_dict['generations']
|
|
|
|
self.incParEvents = options_class.handler.options_dict['incParEvents']
|
|
|
|
self.incParAddr = options_class.handler.options_dict['incParAddr']
|
|
|
|
self.incParNotes = options_class.handler.options_dict['incParNotes']
|
|
|
|
self.incParNames = options_class.handler.options_dict['incParNames']
|
2006-04-02 11:05:25 +05:30
|
|
|
self.incParMar = options_class.handler.options_dict['incParMar']
|
2006-03-01 01:24:35 +05:30
|
|
|
self.incRelDates = options_class.handler.options_dict['incRelDates']
|
2006-04-02 11:05:25 +05:30
|
|
|
self.incChiMar = options_class.handler.options_dict['incChiMar']
|
2007-08-12 09:27:18 +05:30
|
|
|
self.includeAttrs = options_class.handler.options_dict['incattrs']
|
2006-03-01 01:24:35 +05:30
|
|
|
|
|
|
|
def dump_parent_event(self,name,event):
|
|
|
|
place = ""
|
|
|
|
date = ""
|
2006-05-30 06:48:41 +05:30
|
|
|
descr = ""
|
2006-03-01 01:24:35 +05:30
|
|
|
if event:
|
2006-03-29 08:05:19 +05:30
|
|
|
date = DateHandler.get_date(event)
|
2006-03-01 01:24:35 +05:30
|
|
|
place_handle = event.get_place_handle()
|
2006-05-30 06:48:41 +05:30
|
|
|
place = ReportUtils.place_name(self.database,place_handle)
|
|
|
|
descr = event.get_description()
|
2007-08-12 09:27:18 +05:30
|
|
|
|
|
|
|
if self.includeAttrs:
|
|
|
|
for attr in event.get_attribute_list():
|
|
|
|
if descr:
|
|
|
|
descr += "; "
|
|
|
|
descr += _("%(type)s: %(value)s") % {
|
|
|
|
'type' : attr.get_type(),
|
|
|
|
'value' : attr.get_value() }
|
2006-05-30 06:48:41 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.start_row()
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_cell("FGR-TextContents")
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
2006-03-01 01:24:35 +05:30
|
|
|
self.doc.write_text(name)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
2006-05-30 06:48:41 +05:30
|
|
|
|
|
|
|
if descr:
|
|
|
|
self.doc.start_cell("FGR-TextContents",2)
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
|
|
|
self.doc.write_text(descr)
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.end_row()
|
|
|
|
|
|
|
|
if date or place:
|
|
|
|
self.doc.start_row()
|
|
|
|
self.doc.start_cell("FGR-TextContents")
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
|
|
|
|
if (date or place) or not descr:
|
|
|
|
self.doc.start_cell("FGR-TextContents")
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
|
|
|
self.doc.write_text(date)
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.start_cell("FGR-TextContentsEnd")
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
|
|
|
self.doc.write_text(place)
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.end_row()
|
2006-05-29 08:22:14 +05:30
|
|
|
|
|
|
|
def dump_parent_parents(self,person):
|
|
|
|
family_handle = person.get_main_parents_family_handle()
|
|
|
|
father_name = ""
|
|
|
|
mother_name = ""
|
|
|
|
if family_handle:
|
|
|
|
family = self.database.get_family_from_handle(family_handle)
|
|
|
|
father_handle = family.get_father_handle()
|
|
|
|
if father_handle:
|
|
|
|
father = self.database.get_person_from_handle(father_handle)
|
2006-07-21 01:07:56 +05:30
|
|
|
father_name = _nd.display(father)
|
2006-05-29 08:22:14 +05:30
|
|
|
if self.incRelDates:
|
|
|
|
birth_ref = father.get_birth_ref()
|
|
|
|
birth = " "
|
|
|
|
if birth_ref:
|
|
|
|
event = self.database.get_event_from_handle(birth_ref.ref)
|
|
|
|
birth = DateHandler.get_date( event )
|
|
|
|
death_ref = father.get_death_ref()
|
|
|
|
death = " "
|
|
|
|
if death_ref:
|
|
|
|
event = self.database.get_event_from_handle(death_ref.ref)
|
|
|
|
death = DateHandler.get_date( event )
|
|
|
|
if birth_ref or death_ref:
|
|
|
|
father_name = "%s (%s - %s)" % (father_name,birth,death)
|
|
|
|
mother_handle = family.get_mother_handle()
|
|
|
|
if mother_handle:
|
|
|
|
mother = self.database.get_person_from_handle(mother_handle)
|
2006-07-21 01:07:56 +05:30
|
|
|
mother_name = _nd.display(mother)
|
2006-05-29 08:22:14 +05:30
|
|
|
if self.incRelDates:
|
|
|
|
birth_ref = mother.get_birth_ref()
|
|
|
|
birth = " "
|
|
|
|
if birth_ref:
|
|
|
|
event = self.database.get_event_from_handle(birth_ref.ref)
|
|
|
|
birth = DateHandler.get_date( event )
|
|
|
|
death_ref = mother.get_death_ref()
|
|
|
|
death = " "
|
|
|
|
if death_ref:
|
|
|
|
event = self.database.get_event_from_handle(death_ref.ref)
|
|
|
|
death = DateHandler.get_date( event )
|
|
|
|
if birth_ref or death_ref:
|
|
|
|
mother_name = "%s (%s - %s)" % (mother_name,birth,death)
|
|
|
|
|
|
|
|
if father_name != "":
|
|
|
|
self.doc.start_row()
|
|
|
|
self.doc.start_cell("FGR-TextContents")
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
|
|
|
self.doc.write_text(_("Father"))
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.start_cell("FGR-TextContentsEnd",2)
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
2006-06-03 09:02:26 +05:30
|
|
|
mark = ReportUtils.get_person_mark(self.database,father)
|
|
|
|
self.doc.write_text(father_name,mark)
|
2006-05-29 08:22:14 +05:30
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.end_row()
|
|
|
|
elif self.missingInfo:
|
|
|
|
self.dump_parent_line(_("Father"),"")
|
|
|
|
|
|
|
|
if mother_name != "":
|
|
|
|
self.doc.start_row()
|
|
|
|
self.doc.start_cell("FGR-TextContents")
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
|
|
|
self.doc.write_text(_("Mother"))
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.start_cell("FGR-TextContentsEnd",2)
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
2006-06-03 09:02:26 +05:30
|
|
|
mark = ReportUtils.get_person_mark(self.database,mother)
|
|
|
|
self.doc.write_text(mother_name,mark)
|
2006-05-29 08:22:14 +05:30
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.end_row()
|
|
|
|
elif self.missingInfo:
|
|
|
|
self.dump_parent_line(_("Mother"),"")
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
def dump_parent_line(self,name,text):
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.start_row()
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_cell("FGR-TextContents")
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
2006-03-01 01:24:35 +05:30
|
|
|
self.doc.write_text(name)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
2006-03-01 01:24:35 +05:30
|
|
|
self.doc.start_cell("FGR-TextContentsEnd",2)
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
2006-03-01 01:24:35 +05:30
|
|
|
self.doc.write_text(text)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
2006-03-01 01:24:35 +05:30
|
|
|
self.doc.end_row()
|
|
|
|
|
2006-04-02 11:05:25 +05:30
|
|
|
def dump_parent(self,title,person_handle):
|
2006-03-01 01:24:35 +05:30
|
|
|
|
2006-04-02 11:05:25 +05:30
|
|
|
if not person_handle and not self.missingInfo:
|
2006-03-01 01:24:35 +05:30
|
|
|
return
|
2006-04-02 11:05:25 +05:30
|
|
|
elif not person_handle:
|
2007-10-08 22:11:39 +05:30
|
|
|
person = gen.lib.Person()
|
2006-03-01 01:24:35 +05:30
|
|
|
else:
|
2006-04-02 11:05:25 +05:30
|
|
|
person = self.database.get_person_from_handle(person_handle)
|
2006-07-21 01:07:56 +05:30
|
|
|
name = _nd.display(person)
|
2006-05-29 08:22:14 +05:30
|
|
|
|
2006-04-02 11:05:25 +05:30
|
|
|
self.doc.start_table(title,'FGR-ParentTable')
|
2006-03-01 01:24:35 +05:30
|
|
|
self.doc.start_row()
|
|
|
|
self.doc.start_cell('FGR-ParentHead',3)
|
|
|
|
self.doc.start_paragraph('FGR-ParentName')
|
2006-04-02 11:05:25 +05:30
|
|
|
self.doc.write_text(title + ': ')
|
2006-06-03 09:02:26 +05:30
|
|
|
mark = ReportUtils.get_person_mark(self.database,person)
|
|
|
|
self.doc.write_text(name,mark)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.end_row()
|
|
|
|
|
2006-03-29 08:05:19 +05:30
|
|
|
birth_ref = person.get_birth_ref()
|
2006-03-01 01:24:35 +05:30
|
|
|
birth = None
|
2007-10-08 22:11:39 +05:30
|
|
|
evtName = str(gen.lib.EventType())
|
2006-03-29 08:05:19 +05:30
|
|
|
if birth_ref:
|
|
|
|
birth = self.database.get_event_from_handle(birth_ref.ref)
|
2006-03-01 01:24:35 +05:30
|
|
|
if birth or self.missingInfo:
|
2006-04-02 11:05:25 +05:30
|
|
|
self.dump_parent_event(evtName,birth)
|
2006-03-01 01:24:35 +05:30
|
|
|
|
2006-03-29 08:05:19 +05:30
|
|
|
death_ref = person.get_death_ref()
|
2006-03-01 01:24:35 +05:30
|
|
|
death = None
|
2007-10-08 22:11:39 +05:30
|
|
|
evtName = str(gen.lib.EventType(gen.lib.EventType.DEATH))
|
2006-03-29 08:05:19 +05:30
|
|
|
if death_ref:
|
|
|
|
death = self.database.get_event_from_handle(death_ref.ref)
|
2006-03-01 01:24:35 +05:30
|
|
|
if death or self.missingInfo:
|
2006-04-02 11:05:25 +05:30
|
|
|
self.dump_parent_event(evtName,death)
|
2006-03-01 01:24:35 +05:30
|
|
|
|
2006-05-29 08:22:14 +05:30
|
|
|
self.dump_parent_parents(person)
|
2006-03-01 01:24:35 +05:30
|
|
|
|
|
|
|
if self.incParEvents:
|
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 and event_ref != death_ref:
|
|
|
|
event = self.database.get_event_from_handle(event_ref.ref)
|
|
|
|
evtType = event.get_type()
|
|
|
|
name = str( evtType )
|
|
|
|
self.dump_parent_event(name,event)
|
2006-03-01 01:24:35 +05:30
|
|
|
|
|
|
|
if self.incParAddr:
|
|
|
|
addrlist = person.get_address_list()[:]
|
|
|
|
for addr in addrlist:
|
2007-01-23 07:21:33 +05:30
|
|
|
location = ReportUtils.get_address_str(addr)
|
2006-03-29 08:05:19 +05:30
|
|
|
date = DateHandler.get_date( addr )
|
2006-03-01 01:24:35 +05:30
|
|
|
|
|
|
|
self.doc.start_row()
|
|
|
|
self.doc.start_cell("FGR-TextContents")
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
|
|
|
self.doc.write_text(_("Address"))
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.start_cell("FGR-TextContents")
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
|
|
|
self.doc.write_text(date)
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.start_cell("FGR-TextContentsEnd")
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
|
|
|
self.doc.write_text(location)
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.end_row()
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2007-07-20 17:33:35 +05:30
|
|
|
if self.incParNotes:
|
|
|
|
for notehandle in person.get_note_list():
|
|
|
|
note = self.database.get_note_from_handle(notehandle)
|
|
|
|
self.dump_parent_line(_("Note"),note.get(False))
|
2007-08-12 09:27:18 +05:30
|
|
|
|
|
|
|
if self.includeAttrs:
|
|
|
|
for attr in person.get_attribute_list():
|
|
|
|
self.dump_parent_line(str(attr.get_type()),attr.get_value())
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
if self.incParNames:
|
|
|
|
for alt_name in person.get_alternate_names():
|
2006-07-21 01:07:56 +05:30
|
|
|
name_type = str( alt_name.get_type() )
|
|
|
|
name = _nd.display_name(alt_name)
|
|
|
|
self.dump_parent_line(name_type,name)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
|
|
|
self.doc.end_table()
|
|
|
|
|
2006-04-02 11:05:25 +05:30
|
|
|
def dump_marriage(self,family):
|
|
|
|
if not family:
|
|
|
|
return
|
|
|
|
m = None
|
|
|
|
family_ref_list = family.get_event_ref_list()
|
|
|
|
for event_ref in family_ref_list:
|
|
|
|
if event_ref:
|
|
|
|
event = self.database.get_event_from_handle(event_ref.ref)
|
2007-10-08 22:11:39 +05:30
|
|
|
if int(event.get_type()) == gen.lib.EventType.MARRIAGE:
|
2006-04-02 11:05:25 +05:30
|
|
|
m = event
|
|
|
|
break
|
|
|
|
|
|
|
|
if m or self.missingInfo:
|
2006-10-29 07:32:16 +05:30
|
|
|
self.doc.start_table("MarriageInfo",'FGR-ParentTable')
|
2006-04-02 11:05:25 +05:30
|
|
|
self.doc.start_row()
|
|
|
|
self.doc.start_cell('FGR-ParentHead',3)
|
|
|
|
self.doc.start_paragraph('FGR-ParentName')
|
|
|
|
self.doc.write_text(_("Marriage:"))
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.end_row()
|
|
|
|
|
2007-10-08 22:11:39 +05:30
|
|
|
evtName = str(gen.lib.EventType(gen.lib.EventType.MARRIAGE))
|
2006-04-02 11:05:25 +05:30
|
|
|
self.dump_parent_event(evtName,m)
|
|
|
|
|
|
|
|
for event_ref in family_ref_list:
|
|
|
|
if event_ref:
|
|
|
|
event = self.database.get_event_from_handle(event_ref.ref)
|
|
|
|
evtType = event.get_type()
|
2007-10-08 22:11:39 +05:30
|
|
|
if int(evtType) != gen.lib.EventType.MARRIAGE:
|
2006-04-02 11:05:25 +05:30
|
|
|
name = Utils.format_event( evtType )
|
|
|
|
self.dump_parent_event(name,event)
|
|
|
|
|
|
|
|
self.doc.end_table()
|
|
|
|
|
2006-05-02 02:41:26 +05:30
|
|
|
def dump_marriage(self,family):
|
|
|
|
|
|
|
|
if not family:
|
|
|
|
return
|
|
|
|
|
|
|
|
m = None
|
2006-05-15 06:59:44 +05:30
|
|
|
family_list = family.get_event_ref_list()
|
|
|
|
for event_ref in family_list:
|
|
|
|
if event_ref:
|
|
|
|
event = self.database.get_event_from_handle(event_ref.ref)
|
2007-10-08 22:11:39 +05:30
|
|
|
if event.get_type() == gen.lib.EventType.MARRIAGE:
|
2006-05-02 02:41:26 +05:30
|
|
|
m = event
|
|
|
|
break
|
|
|
|
|
|
|
|
if len(family_list) > 0 or self.missingInfo:
|
2006-10-28 09:43:01 +05:30
|
|
|
self.doc.start_table("MarriageInfo",'FGR-ParentTable')
|
2006-05-02 02:41:26 +05:30
|
|
|
self.doc.start_row()
|
|
|
|
self.doc.start_cell('FGR-ParentHead',3)
|
|
|
|
self.doc.start_paragraph('FGR-ParentName')
|
|
|
|
self.doc.write_text(_("Marriage:"))
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.end_row()
|
|
|
|
|
|
|
|
self.dump_parent_event(_("Marriage"),m)
|
|
|
|
|
2006-05-15 06:59:44 +05:30
|
|
|
for event_ref in family_list:
|
|
|
|
if event_ref:
|
|
|
|
event = self.database.get_event_from_handle(event_ref.ref)
|
2007-10-08 22:11:39 +05:30
|
|
|
if event.get_type() != gen.lib.EventType.MARRIAGE:
|
2006-05-15 06:59:44 +05:30
|
|
|
self.dump_parent_event(str(event.get_type()),event)
|
2006-05-02 02:41:26 +05:30
|
|
|
|
|
|
|
self.doc.end_table()
|
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
def dump_child_event(self,text,name,event):
|
2004-05-04 09:02:37 +05:30
|
|
|
date = ""
|
|
|
|
place = ""
|
2002-10-20 19:55:16 +05:30
|
|
|
if event:
|
2005-08-06 08:27:37 +05:30
|
|
|
date = DateHandler.get_date(event)
|
2004-07-28 07:59:07 +05:30
|
|
|
place_handle = event.get_place_handle()
|
|
|
|
if place_handle:
|
2005-01-02 01:28:53 +05:30
|
|
|
place = self.database.get_place_from_handle(place_handle).get_title()
|
2004-05-04 09:02:37 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.start_row()
|
|
|
|
self.doc.start_cell(text)
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_cell('FGR-TextContents')
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.write_text(name)
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_cell('FGR-TextContents')
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.write_text(date)
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_cell('FGR-TextContentsEnd')
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.write_text(place)
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.end_row()
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
def dump_child(self,index,person_handle):
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
person = self.database.get_person_from_handle(person_handle)
|
2006-03-01 01:24:35 +05:30
|
|
|
families = len(person.get_family_handle_list())
|
2006-03-29 08:05:19 +05:30
|
|
|
birth_ref = person.get_birth_ref()
|
|
|
|
if birth_ref:
|
|
|
|
birth = self.database.get_event_from_handle(birth_ref.ref)
|
2006-03-01 01:24:35 +05:30
|
|
|
else:
|
|
|
|
birth = None
|
2006-03-29 08:05:19 +05:30
|
|
|
death_ref = person.get_death_ref()
|
|
|
|
if death_ref:
|
|
|
|
death = self.database.get_event_from_handle(death_ref.ref)
|
2006-03-01 01:24:35 +05:30
|
|
|
else:
|
|
|
|
death = None
|
|
|
|
|
2006-04-02 11:05:25 +05:30
|
|
|
spouse_count = 0;
|
|
|
|
if self.incChiMar:
|
|
|
|
for family_handle in person.get_family_handle_list():
|
|
|
|
family = self.database.get_family_from_handle(family_handle)
|
|
|
|
spouse_id = None
|
|
|
|
if person_handle == family.get_father_handle():
|
|
|
|
spouse_id = family.get_mother_handle()
|
|
|
|
else:
|
|
|
|
spouse_id = family.get_father_handle()
|
|
|
|
if spouse_id:
|
|
|
|
spouse_count = spouse_count + 1
|
2006-03-01 01:24:35 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.start_row()
|
2006-03-01 01:24:35 +05:30
|
|
|
if spouse_count != 0 or self.missingInfo or death != None or birth != None:
|
|
|
|
self.doc.start_cell('FGR-TextChild1')
|
|
|
|
else:
|
|
|
|
self.doc.start_cell('FGR-TextChild2')
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph('FGR-ChildText')
|
2006-05-02 02:41:26 +05:30
|
|
|
index_str = ("%d" % index)
|
2007-10-08 22:11:39 +05:30
|
|
|
if person.get_gender() == gen.lib.Person.MALE:
|
2006-05-02 02:41:26 +05:30
|
|
|
self.doc.write_text(index_str + _("acronym for male|M"))
|
2007-10-08 22:11:39 +05:30
|
|
|
elif person.get_gender() == gen.lib.Person.FEMALE:
|
2006-05-02 02:41:26 +05:30
|
|
|
self.doc.write_text(index_str + _("acronym for female|F"))
|
2006-03-01 01:24:35 +05:30
|
|
|
else:
|
2006-04-02 11:05:25 +05:30
|
|
|
self.doc.write_text(_("%dU") % index)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
2006-05-29 08:22:14 +05:30
|
|
|
|
2006-07-21 01:07:56 +05:30
|
|
|
name = _nd.display(person)
|
2006-06-03 09:02:26 +05:30
|
|
|
mark = ReportUtils.get_person_mark(self.database,person)
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_cell('FGR-ChildName',3)
|
|
|
|
self.doc.start_paragraph('FGR-ChildText')
|
2006-06-03 09:02:26 +05:30
|
|
|
self.doc.write_text(name,mark)
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.end_row()
|
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
if self.missingInfo or birth != None:
|
|
|
|
if spouse_count != 0 or self.missingInfo or death != None:
|
|
|
|
self.dump_child_event('FGR-TextChild1',_('Birth'),birth)
|
|
|
|
else:
|
|
|
|
self.dump_child_event('FGR-TextChild2',_('Birth'),birth)
|
|
|
|
|
|
|
|
if self.missingInfo or death != None:
|
2006-04-02 11:05:25 +05:30
|
|
|
if spouse_count == 0 or not self.incChiMar:
|
2006-03-01 01:24:35 +05:30
|
|
|
self.dump_child_event('FGR-TextChild2',_('Death'),death)
|
|
|
|
else:
|
|
|
|
self.dump_child_event('FGR-TextChild1',_('Death'),death)
|
2006-04-02 11:05:25 +05:30
|
|
|
|
|
|
|
if self.incChiMar:
|
|
|
|
index = 0
|
|
|
|
for family_handle in person.get_family_handle_list():
|
2004-05-04 09:02:37 +05:30
|
|
|
m = None
|
2006-04-02 11:05:25 +05:30
|
|
|
index = index + 1
|
|
|
|
family = self.database.get_family_from_handle(family_handle)
|
|
|
|
|
|
|
|
for event_ref in family.get_event_ref_list():
|
|
|
|
if event_ref:
|
|
|
|
event = self.database.get_event_from_handle(event_ref.ref)
|
2007-10-08 22:11:39 +05:30
|
|
|
if int(event.get_type()) == gen.lib.EventType.MARRIAGE:
|
2006-04-02 11:05:25 +05:30
|
|
|
m = event
|
|
|
|
break
|
|
|
|
|
|
|
|
spouse_id = None
|
2004-05-04 09:02:37 +05:30
|
|
|
|
2006-04-02 11:05:25 +05:30
|
|
|
if person_handle == family.get_father_handle():
|
|
|
|
spouse_id = family.get_mother_handle()
|
|
|
|
else:
|
|
|
|
spouse_id = family.get_father_handle()
|
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
if spouse_id:
|
2006-04-02 11:05:25 +05:30
|
|
|
self.doc.start_row()
|
|
|
|
if m or index != families:
|
|
|
|
self.doc.start_cell('FGR-TextChild1')
|
|
|
|
else:
|
|
|
|
self.doc.start_cell('FGR-TextChild2')
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.start_cell('FGR-TextContents')
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
|
|
|
self.doc.write_text(_("Spouse"))
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.start_cell('FGR-TextContentsEnd',2)
|
|
|
|
self.doc.start_paragraph('FGR-Normal')
|
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
spouse = self.database.get_person_from_handle(spouse_id)
|
2006-07-21 01:07:56 +05:30
|
|
|
spouse_name = _nd.display(spouse)
|
2006-03-01 01:24:35 +05:30
|
|
|
if self.incRelDates:
|
|
|
|
birth = " "
|
2006-03-29 08:05:19 +05:30
|
|
|
birth_ref = spouse.get_birth_ref()
|
|
|
|
if birth_ref:
|
|
|
|
event = self.database.get_event_from_handle(birth_ref.ref)
|
|
|
|
birth = DateHandler.get_date(event)
|
2006-03-01 01:24:35 +05:30
|
|
|
death = " "
|
2006-03-29 08:05:19 +05:30
|
|
|
death_ref = spouse.get_death_ref()
|
|
|
|
if death_ref:
|
|
|
|
event = self.database.get_event_from_handle(death_ref.ref)
|
|
|
|
death = DateHandler.get_date(event)
|
|
|
|
if birth_ref or death_ref:
|
2006-03-01 01:24:35 +05:30
|
|
|
spouse_name = "%s (%s - %s)" % (spouse_name,birth,death)
|
2006-06-03 09:02:26 +05:30
|
|
|
mark = ReportUtils.get_person_mark(self.database,spouse)
|
|
|
|
self.doc.write_text(spouse_name,mark)
|
2006-04-02 11:05:25 +05:30
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.end_row()
|
|
|
|
|
|
|
|
if m:
|
2007-10-08 22:11:39 +05:30
|
|
|
evtName = str(gen.lib.EventType(gen.lib.EventType.MARRIAGE))
|
2006-04-02 11:05:25 +05:30
|
|
|
if index == families:
|
|
|
|
self.dump_child_event('FGR-TextChild2',evtName,m)
|
|
|
|
else:
|
|
|
|
self.dump_child_event('FGR-TextChild1',evtName,m)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
def dump_family(self,family_handle,generation):
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph('FGR-Title')
|
2006-03-01 01:24:35 +05:30
|
|
|
if self.recursive and self.generations:
|
2006-06-04 09:56:28 +05:30
|
|
|
title=_("Family Group Report - Generation %d") % generation
|
2006-03-01 01:24:35 +05:30
|
|
|
else:
|
2006-06-04 09:56:28 +05:30
|
|
|
title=_("Family Group Report")
|
|
|
|
mark = BaseDoc.IndexMark(title,BaseDoc.INDEX_TYPE_TOC,1)
|
|
|
|
self.doc.write_text( title, mark )
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.end_paragraph()
|
2006-03-01 01:24:35 +05:30
|
|
|
|
|
|
|
family = self.database.get_family_from_handle(family_handle)
|
2002-10-20 19:55:16 +05:30
|
|
|
|
2006-04-02 11:05:25 +05:30
|
|
|
self.dump_parent(_("Husband"),family.get_father_handle())
|
2006-03-01 01:24:35 +05:30
|
|
|
self.doc.start_paragraph("FGR-blank")
|
|
|
|
self.doc.end_paragraph()
|
2006-04-02 11:05:25 +05:30
|
|
|
|
|
|
|
if self.incParMar:
|
|
|
|
self.dump_marriage(family)
|
|
|
|
self.doc.start_paragraph("FGR-blank")
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
|
|
|
|
self.dump_parent(_("Wife"),family.get_mother_handle())
|
2006-03-01 01:24:35 +05:30
|
|
|
|
2006-04-19 09:36:27 +05:30
|
|
|
length = len(family.get_child_ref_list())
|
2006-03-01 01:24:35 +05:30
|
|
|
if length > 0:
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph("FGR-blank")
|
2002-10-20 19:55:16 +05:30
|
|
|
self.doc.end_paragraph()
|
2006-03-01 01:24:35 +05:30
|
|
|
self.doc.start_table('FGR-Children','FGR-ChildTable')
|
|
|
|
self.doc.start_row()
|
|
|
|
self.doc.start_cell('FGR-ParentHead',4)
|
|
|
|
self.doc.start_paragraph('FGR-ParentName')
|
|
|
|
self.doc.write_text(_("Children"))
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
self.doc.end_cell()
|
|
|
|
self.doc.end_row()
|
|
|
|
index = 1
|
2006-04-19 09:36:27 +05:30
|
|
|
for child_ref in family.get_child_ref_list():
|
|
|
|
self.dump_child(index,child_ref.ref)
|
2006-03-01 01:24:35 +05:30
|
|
|
index = index + 1
|
|
|
|
self.doc.end_table()
|
|
|
|
|
|
|
|
if self.recursive:
|
2006-04-19 09:36:27 +05:30
|
|
|
for child_ref in family.get_child_ref_list():
|
|
|
|
child = self.database.get_person_from_handle(child_ref.ref)
|
2006-03-01 01:24:35 +05:30
|
|
|
for child_family_handle in child.get_family_handle_list():
|
|
|
|
if child_family_handle != family_handle:
|
|
|
|
self.doc.page_break()
|
|
|
|
self.dump_family(child_family_handle,(generation+1))
|
2003-07-07 03:25:52 +05:30
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
def write_report(self):
|
|
|
|
if self.family_handle:
|
|
|
|
self.dump_family(self.family_handle,1)
|
|
|
|
else:
|
|
|
|
self.doc.start_paragraph('FGR-Title')
|
|
|
|
self.doc.write_text(_("Family Group Report"))
|
|
|
|
self.doc.end_paragraph()
|
2003-07-07 03:25:52 +05:30
|
|
|
|
2002-10-20 19:55:16 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
2005-01-02 01:28:53 +05:30
|
|
|
#
|
2003-07-07 03:25:52 +05:30
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2006-06-01 10:09:40 +05:30
|
|
|
class FamilyGroupOptions(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
|
|
|
|
|
|
|
# Options specific for this report
|
|
|
|
self.options_dict = {
|
2006-08-13 09:02:59 +05:30
|
|
|
'family_id' : '',
|
2006-03-01 01:24:35 +05:30
|
|
|
'recursive' : 0,
|
|
|
|
'missinginfo' : 1,
|
|
|
|
'generations' : 1,
|
|
|
|
'incParEvents' : 0,
|
|
|
|
'incParAddr' : 0,
|
|
|
|
'incParNotes' : 0,
|
2007-08-12 09:27:18 +05:30
|
|
|
'incattrs' : 0,
|
2006-03-01 01:24:35 +05:30
|
|
|
'incParNames' : 0,
|
2006-04-02 11:05:25 +05:30
|
|
|
'incParMar' : 0,
|
|
|
|
'incChiMar' : 1,
|
2006-03-01 01:24:35 +05:30
|
|
|
'incRelDates' : 0,
|
2005-01-02 01:28:53 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
self.options_help = {
|
2006-08-13 09:02:59 +05:30
|
|
|
'family_id' : ("=ID","Gramps ID of the person's family.",
|
2005-01-02 01:28:53 +05:30
|
|
|
"Use show=id to get ID list.",
|
|
|
|
),
|
2006-03-01 01:24:35 +05:30
|
|
|
'recursive' : ("=0/1","Create reports for all decendants of this family.",
|
|
|
|
["Do not create reports for decendants","Create reports for decendants"],
|
|
|
|
False),
|
|
|
|
|
|
|
|
'missinginfo' : ("=0/1","Whether to include fields for missing information.",
|
|
|
|
["Do not include missing info","Include missing info"],
|
|
|
|
True),
|
|
|
|
|
|
|
|
'generations' : ("=0/1","Whether to include the generation on each report (recursive only).",
|
|
|
|
["Do not include the generation","Include the generation"],
|
|
|
|
True),
|
|
|
|
|
|
|
|
'incParEvents' : ("=0/1","Whether to include events for parents.",
|
|
|
|
["Do not include parental events","Include parental events"],
|
|
|
|
True),
|
|
|
|
|
|
|
|
'incParAddr' : ("=0/1","Whether to include addresses for parents.",
|
|
|
|
["Do not include parental addresses","Include parental addresses"],
|
|
|
|
True),
|
|
|
|
|
|
|
|
'incParNotes' : ("=0/1","Whether to include notes for parents.",
|
|
|
|
["Do not include parental notes","Include parental notes"],
|
|
|
|
True),
|
2007-08-12 09:27:18 +05:30
|
|
|
|
|
|
|
'incattrs' : ("=0/1","Whether to include attributes.",
|
|
|
|
["Do not include attributes","Include attributes"],
|
|
|
|
True),
|
2006-03-01 01:24:35 +05:30
|
|
|
|
|
|
|
'incParNames' : ("=0/1","Whether to include alternate names for parents.",
|
|
|
|
["Do not include parental names","Include parental names"],
|
|
|
|
True),
|
|
|
|
|
2006-04-02 11:05:25 +05:30
|
|
|
'incParMar' : ("=0/1","Whether to include marriage information for parents.",
|
|
|
|
["Do not include parental marriage info","Include parental marriage info"],
|
|
|
|
False),
|
|
|
|
|
|
|
|
'incChiMar' : ("=0/1","Whether to include marriage information for children.",
|
|
|
|
["Do not include children marriage info","Include children marriage info"],
|
|
|
|
True),
|
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
'incRelDates' : ("=0/1","Whether to include dates for relatives.",
|
|
|
|
["Do not include dates of relatives","Include dates of relatives"],
|
|
|
|
True),
|
2005-01-02 01:28:53 +05:30
|
|
|
}
|
|
|
|
|
2006-08-13 09:02:59 +05:30
|
|
|
def get_families(self,database,person):
|
2005-01-02 01:28:53 +05:30
|
|
|
"""
|
|
|
|
Create a mapping of all spouse names:families to be put
|
|
|
|
into the 'extra' option menu in the report options box. If
|
|
|
|
the selected person has never been married then this routine
|
|
|
|
will return a placebo label and disable the OK button.
|
|
|
|
"""
|
2006-08-13 09:02:59 +05:30
|
|
|
families = []
|
|
|
|
family_id = None
|
2005-01-02 01:28:53 +05:30
|
|
|
family_list = person.get_family_handle_list()
|
|
|
|
for family_handle in family_list:
|
|
|
|
family = database.get_family_from_handle(family_handle)
|
2006-08-13 09:02:59 +05:30
|
|
|
family_id = family.get_gramps_id()
|
2005-01-02 01:28:53 +05:30
|
|
|
if person.get_handle() == family.get_father_handle():
|
2005-01-09 01:49:06 +05:30
|
|
|
spouse_handle = family.get_mother_handle()
|
2003-07-07 03:25:52 +05:30
|
|
|
else:
|
2005-01-09 01:49:06 +05:30
|
|
|
spouse_handle = family.get_father_handle()
|
|
|
|
if spouse_handle:
|
|
|
|
spouse = database.get_person_from_handle(spouse_handle)
|
2005-01-02 01:28:53 +05:30
|
|
|
name = spouse.get_primary_name().get_name()
|
2003-07-07 03:25:52 +05:30
|
|
|
else:
|
2005-01-02 01:28:53 +05:30
|
|
|
name = _("unknown")
|
2006-08-13 09:02:59 +05:30
|
|
|
name = "%s (%s)" % (name,family_id)
|
|
|
|
families.append((family_id,name))
|
|
|
|
return families
|
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.
|
|
|
|
"""
|
|
|
|
|
2006-08-13 09:02:59 +05:30
|
|
|
families = self.get_families(dialog.db,dialog.person)
|
|
|
|
family_id = self.options_dict['family_id']
|
2005-01-02 01:28:53 +05:30
|
|
|
|
|
|
|
self.spouse_menu = gtk.combo_box_new_text()
|
|
|
|
index = 0
|
2006-08-13 09:02:59 +05:30
|
|
|
family_index = 0
|
|
|
|
for item in families:
|
2005-01-02 01:28:53 +05:30
|
|
|
self.spouse_menu.append_text(item[1])
|
2006-08-13 09:02:59 +05:30
|
|
|
if item[0] == family_id:
|
|
|
|
family_index = index
|
2005-01-02 01:28:53 +05:30
|
|
|
index = index + 1
|
2006-08-13 09:02:59 +05:30
|
|
|
self.spouse_menu.set_active(family_index)
|
2006-03-01 01:24:35 +05:30
|
|
|
|
|
|
|
# Recursive
|
|
|
|
self.recursive_option = gtk.CheckButton()
|
|
|
|
self.recursive_option.set_active(self.options_dict['recursive'])
|
|
|
|
|
|
|
|
# Missing Info
|
|
|
|
self.missing_info_option = gtk.CheckButton(_("Print fields for missing information"))
|
|
|
|
self.missing_info_option.set_active(self.options_dict['missinginfo'])
|
|
|
|
|
|
|
|
# Generations
|
|
|
|
self.include_generations_option = gtk.CheckButton(_("Generation numbers (recursive only)"))
|
|
|
|
self.include_generations_option.set_active(self.options_dict['generations'])
|
|
|
|
|
|
|
|
# Parental Events
|
|
|
|
self.include_par_events_option = gtk.CheckButton(_("Parent Events"))
|
|
|
|
self.include_par_events_option.set_active(self.options_dict['incParEvents'])
|
|
|
|
|
|
|
|
# Parental Addresses
|
|
|
|
self.include_par_addr_option = gtk.CheckButton(_("Parent Addresses"))
|
|
|
|
self.include_par_addr_option.set_active(self.options_dict['incParAddr'])
|
|
|
|
|
|
|
|
# Parental Notes
|
|
|
|
self.include_par_notes_option = gtk.CheckButton(_("Parent Notes"))
|
|
|
|
self.include_par_notes_option.set_active(self.options_dict['incParNotes'])
|
|
|
|
|
2007-08-12 09:27:18 +05:30
|
|
|
# Parental Attributes
|
|
|
|
self.include_attributes_option = gtk.CheckButton(_("Parent Attributes"))
|
|
|
|
self.include_attributes_option.set_active(self.options_dict['incattrs'])
|
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
# Parental Names
|
|
|
|
self.include_par_names_option = gtk.CheckButton(_("Alternate Parent Names"))
|
|
|
|
self.include_par_names_option.set_active(self.options_dict['incParNames'])
|
|
|
|
|
2006-04-02 11:05:25 +05:30
|
|
|
# Parental Marriage
|
|
|
|
self.include_par_marriage_option = gtk.CheckButton(_("Parent Marriage"))
|
|
|
|
self.include_par_marriage_option.set_active(self.options_dict['incParMar'])
|
|
|
|
|
2006-03-01 01:24:35 +05:30
|
|
|
# Relatives Dates
|
|
|
|
self.include_rel_dates_option = gtk.CheckButton(_("Dates of Relatives (father, mother, spouse)"))
|
|
|
|
self.include_rel_dates_option.set_active(self.options_dict['incRelDates'])
|
2005-01-02 01:28:53 +05:30
|
|
|
|
2006-04-02 11:05:25 +05:30
|
|
|
# Children Marriages
|
|
|
|
self.include_chi_marriage_option = gtk.CheckButton(_("Children Marriages"))
|
|
|
|
self.include_chi_marriage_option.set_active(self.options_dict['incChiMar'])
|
|
|
|
|
2005-01-02 01:28:53 +05:30
|
|
|
dialog.add_option(_("Spouse"),self.spouse_menu)
|
2006-03-01 01:24:35 +05:30
|
|
|
dialog.add_option(_("Recursive"),self.recursive_option)
|
|
|
|
dialog.add_frame_option(_('Include'),'',self.include_generations_option)
|
|
|
|
dialog.add_frame_option(_('Include'),'',self.include_par_events_option)
|
|
|
|
dialog.add_frame_option(_('Include'),'',self.include_par_addr_option)
|
|
|
|
dialog.add_frame_option(_('Include'),'',self.include_par_notes_option)
|
2007-08-12 09:27:18 +05:30
|
|
|
dialog.add_frame_option(_('Include'),'',self.include_attributes_option)
|
2006-03-01 01:24:35 +05:30
|
|
|
dialog.add_frame_option(_('Include'),'',self.include_par_names_option)
|
2006-04-02 11:05:25 +05:30
|
|
|
dialog.add_frame_option(_('Include'),'',self.include_par_marriage_option)
|
|
|
|
dialog.add_frame_option(_('Include'),'',self.include_chi_marriage_option)
|
2006-03-01 01:24:35 +05:30
|
|
|
dialog.add_frame_option(_('Include'),'',self.include_rel_dates_option)
|
|
|
|
dialog.add_frame_option(_('Missing Information'),'',self.missing_info_option)
|
2005-01-02 01:28:53 +05:30
|
|
|
|
|
|
|
def parse_user_options(self,dialog):
|
|
|
|
"""
|
|
|
|
Parses the custom options that we have added.
|
|
|
|
"""
|
2006-08-13 09:02:59 +05:30
|
|
|
families = self.get_families(dialog.db,dialog.person)
|
|
|
|
family_index = self.spouse_menu.get_active()
|
|
|
|
if families:
|
|
|
|
self.options_dict['family_id'] = families[family_index][0]
|
2006-03-01 01:24:35 +05:30
|
|
|
|
|
|
|
self.options_dict['recursive'] = int(self.recursive_option.get_active())
|
|
|
|
self.options_dict['missinginfo'] = int(self.missing_info_option.get_active())
|
|
|
|
self.options_dict['generations'] = int(self.include_generations_option.get_active())
|
|
|
|
self.options_dict['incParEvents'] = int(self.include_par_events_option.get_active())
|
|
|
|
self.options_dict['incParAddr'] = int(self.include_par_addr_option.get_active())
|
|
|
|
self.options_dict['incParNotes'] = int(self.include_par_notes_option.get_active())
|
2007-08-12 09:27:18 +05:30
|
|
|
self.options_dict['incattrs'] = int(self.include_attributes_option.get_active())
|
2006-03-01 01:24:35 +05:30
|
|
|
self.options_dict['incParNames'] = int(self.include_par_names_option.get_active())
|
2006-04-02 11:05:25 +05:30
|
|
|
self.options_dict['incParMar'] = int(self.include_par_marriage_option.get_active())
|
|
|
|
self.options_dict['incChiMar'] = int(self.include_chi_marriage_option.get_active())
|
2006-03-01 01:24:35 +05:30
|
|
|
self.options_dict['incRelDates'] = int(self.include_rel_dates_option.get_active())
|
2005-01-02 01:28:53 +05:30
|
|
|
|
|
|
|
def make_default_style(self,default_style):
|
|
|
|
"""Make default output style for the Family Group Report."""
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
2007-04-23 17:16:26 +05:30
|
|
|
#Paragraph Styles
|
2005-01-02 01:28:53 +05:30
|
|
|
font = BaseDoc.FontStyle()
|
|
|
|
font.set_size(4)
|
|
|
|
para.set_font(font)
|
2007-04-23 17:16:26 +05:30
|
|
|
default_style.add_paragraph_style('FGR-blank',para)
|
2005-01-02 01:28:53 +05:30
|
|
|
|
|
|
|
font = BaseDoc.FontStyle()
|
|
|
|
font.set_type_face(BaseDoc.FONT_SANS_SERIF)
|
|
|
|
font.set_size(16)
|
|
|
|
font.set_bold(1)
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
|
|
|
para.set_font(font)
|
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."))
|
2007-04-23 17:16:26 +05:30
|
|
|
default_style.add_paragraph_style('FGR-Title',para)
|
2005-01-02 01:28:53 +05:30
|
|
|
|
|
|
|
font = BaseDoc.FontStyle()
|
|
|
|
font.set_type_face(BaseDoc.FONT_SERIF)
|
|
|
|
font.set_size(10)
|
|
|
|
font.set_bold(0)
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
|
|
|
para.set_font(font)
|
|
|
|
para.set_description(_('The basic style used for the text display.'))
|
2007-04-23 17:16:26 +05:30
|
|
|
default_style.add_paragraph_style('FGR-Normal',para)
|
2005-01-02 01:28:53 +05:30
|
|
|
|
|
|
|
font = BaseDoc.FontStyle()
|
|
|
|
font.set_type_face(BaseDoc.FONT_SANS_SERIF)
|
|
|
|
font.set_size(10)
|
|
|
|
font.set_bold(1)
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
|
|
|
para.set_font(font)
|
|
|
|
para.set_description(_('The style used for the text related to the children.'))
|
2007-04-23 17:16:26 +05:30
|
|
|
default_style.add_paragraph_style('FGR-ChildText',para)
|
2005-01-02 01:28:53 +05:30
|
|
|
|
|
|
|
font = BaseDoc.FontStyle()
|
|
|
|
font.set_type_face(BaseDoc.FONT_SANS_SERIF)
|
|
|
|
font.set_size(12)
|
|
|
|
font.set_bold(1)
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
|
|
|
para.set_font(font)
|
|
|
|
para.set_description(_("The style used for the parent's name"))
|
2007-04-23 17:16:26 +05:30
|
|
|
default_style.add_paragraph_style('FGR-ParentName',para)
|
|
|
|
|
|
|
|
#Table Styles
|
|
|
|
cell = BaseDoc.TableCellStyle()
|
|
|
|
cell.set_padding(0.2)
|
|
|
|
cell.set_top_border(1)
|
|
|
|
cell.set_bottom_border(1)
|
|
|
|
cell.set_right_border(1)
|
|
|
|
cell.set_left_border(1)
|
|
|
|
default_style.add_cell_style('FGR-ParentHead',cell)
|
|
|
|
|
|
|
|
cell = BaseDoc.TableCellStyle()
|
|
|
|
cell.set_padding(0.1)
|
|
|
|
cell.set_bottom_border(1)
|
|
|
|
cell.set_left_border(1)
|
|
|
|
default_style.add_cell_style('FGR-TextContents',cell)
|
|
|
|
|
|
|
|
cell = BaseDoc.TableCellStyle()
|
|
|
|
cell.set_padding(0.1)
|
|
|
|
cell.set_bottom_border(0)
|
|
|
|
cell.set_left_border(1)
|
|
|
|
cell.set_padding(0.1)
|
|
|
|
default_style.add_cell_style('FGR-TextChild1',cell)
|
|
|
|
|
|
|
|
cell = BaseDoc.TableCellStyle()
|
|
|
|
cell.set_padding(0.1)
|
|
|
|
cell.set_bottom_border(1)
|
|
|
|
cell.set_left_border(1)
|
|
|
|
cell.set_padding(0.1)
|
|
|
|
default_style.add_cell_style('FGR-TextChild2',cell)
|
|
|
|
|
|
|
|
cell = BaseDoc.TableCellStyle()
|
|
|
|
cell.set_padding(0.1)
|
|
|
|
cell.set_bottom_border(1)
|
|
|
|
cell.set_right_border(1)
|
|
|
|
cell.set_left_border(1)
|
|
|
|
default_style.add_cell_style('FGR-TextContentsEnd',cell)
|
|
|
|
|
|
|
|
cell = BaseDoc.TableCellStyle()
|
|
|
|
cell.set_padding(0.2)
|
|
|
|
cell.set_bottom_border(1)
|
|
|
|
cell.set_right_border(1)
|
|
|
|
cell.set_left_border(1)
|
|
|
|
default_style.add_cell_style('FGR-ChildName',cell)
|
|
|
|
|
|
|
|
table = BaseDoc.TableStyle()
|
|
|
|
table.set_width(100)
|
|
|
|
table.set_columns(3)
|
|
|
|
table.set_column_width(0,20)
|
|
|
|
table.set_column_width(1,40)
|
|
|
|
table.set_column_width(2,40)
|
|
|
|
default_style.add_table_style('FGR-ParentTable',table)
|
|
|
|
|
|
|
|
table = BaseDoc.TableStyle()
|
|
|
|
table.set_width(100)
|
|
|
|
table.set_columns(4)
|
|
|
|
table.set_column_width(0,7)
|
|
|
|
table.set_column_width(1,18)
|
|
|
|
table.set_column_width(2,35)
|
|
|
|
table.set_column_width(3,40)
|
|
|
|
default_style.add_table_style('FGR-ChildTable',table)
|
2003-07-07 03:25:52 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
2002-10-20 19:55:16 +05:30
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
register_report(
|
2005-01-02 01:28:53 +05:30
|
|
|
name = 'family_group',
|
2006-06-01 10:09:40 +05:30
|
|
|
category = CATEGORY_TEXT,
|
2005-01-02 01:28:53 +05:30
|
|
|
report_class = FamilyGroup,
|
|
|
|
options_class = FamilyGroupOptions,
|
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 = _("Family Group Report"),
|
2005-12-06 12:08:09 +05:30
|
|
|
status = _("Stable"),
|
2005-01-02 01:28:53 +05:30
|
|
|
author_name = "Donald N. Allingham",
|
2005-12-06 12:08:09 +05:30
|
|
|
author_email = "don@gramps-project.org",
|
|
|
|
description=_("Creates a family group report, showing information "
|
|
|
|
"on a set of parents and their children."),
|
2002-10-20 19:55:16 +05:30
|
|
|
)
|