2003-06-14 06:46:30 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2004-02-16 03:22:43 +05:30
|
|
|
# Copyright (C) 2003-2004 Donald N. Allingham
|
2003-06-14 06:46:30 +05:30
|
|
|
# Copyright (C) 2003 Tim Waugh
|
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
2003-06-27 16:48:58 +05:30
|
|
|
import gtk
|
|
|
|
|
2003-06-14 06:46:30 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2003-07-23 19:22:17 +05:30
|
|
|
import const
|
2003-06-14 06:46:30 +05:30
|
|
|
import Report
|
2003-09-02 06:17:09 +05:30
|
|
|
import BaseDoc
|
2003-06-14 06:46:30 +05:30
|
|
|
import RelLib
|
|
|
|
import Errors
|
2004-02-16 03:22:43 +05:30
|
|
|
import Plugins
|
2004-09-13 21:16:00 +05:30
|
|
|
import Calendar
|
2003-06-14 06:46:30 +05:30
|
|
|
from QuestionDialog import ErrorDialog
|
2003-08-17 07:44:33 +05:30
|
|
|
from gettext import gettext as _
|
2003-06-14 06:46:30 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
2003-07-17 15:30:53 +05:30
|
|
|
# ComprehensiveAncestorsReport
|
2003-06-14 06:46:30 +05:30
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2003-07-17 15:30:53 +05:30
|
|
|
class ComprehensiveAncestorsReport (Report.Report):
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-06-27 16:48:58 +05:30
|
|
|
def __init__(self,database,person,max,pgbrk,cite,doc,output,newpage=0):
|
2003-06-14 06:46:30 +05:30
|
|
|
self.map = {}
|
|
|
|
self.database = database
|
|
|
|
self.start = person
|
|
|
|
self.max_generations = max
|
|
|
|
self.pgbrk = pgbrk
|
2003-06-27 16:48:58 +05:30
|
|
|
self.opt_cite = cite
|
2003-06-14 06:46:30 +05:30
|
|
|
self.doc = doc
|
2003-06-27 03:43:58 +05:30
|
|
|
self.sources = []
|
2003-06-27 16:48:58 +05:30
|
|
|
self.sourcerefs = []
|
2003-07-06 04:40:43 +05:30
|
|
|
self.newpage = newpage
|
2004-02-16 03:22:43 +05:30
|
|
|
self.RelClass = Plugins.relationship_class
|
|
|
|
self.relationship = self.RelClass(database)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
table = BaseDoc.TableStyle ()
|
2003-06-14 06:46:30 +05:30
|
|
|
table.set_column_widths ([15, 85])
|
|
|
|
table.set_width (100)
|
2003-07-18 19:13:13 +05:30
|
|
|
doc.add_table_style ("AR-PersonNoSpouse", table)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
table = BaseDoc.TableStyle ()
|
2003-06-14 06:46:30 +05:30
|
|
|
table.set_column_widths ([10, 15, 75])
|
|
|
|
table.set_width (100)
|
2003-07-18 19:13:13 +05:30
|
|
|
doc.add_table_style ("AR-ChildNoSpouse", table)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-06-26 19:43:05 +05:30
|
|
|
for nspouse in range (1, 3):
|
2003-09-02 06:17:09 +05:30
|
|
|
table = BaseDoc.TableStyle ()
|
2003-06-26 19:43:05 +05:30
|
|
|
table.set_width (100)
|
|
|
|
widths = [15, 100 - 15 * (nspouse + 1)]
|
|
|
|
widths.extend ([15] * nspouse)
|
|
|
|
table.set_column_widths (widths)
|
2003-07-18 19:13:13 +05:30
|
|
|
doc.add_table_style ("AR-PersonWithSpouse%d" % nspouse, table)
|
2003-06-26 19:43:05 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
table = BaseDoc.TableStyle ()
|
2003-06-26 19:43:05 +05:30
|
|
|
table.set_width (100)
|
|
|
|
widths = [10, 15, 90 - 15 * (nspouse + 1)]
|
|
|
|
widths.extend ([15] * nspouse)
|
|
|
|
table.set_column_widths (widths)
|
2003-07-18 19:13:13 +05:30
|
|
|
doc.add_table_style ("AR-ChildWithSpouse%d"% nspouse, table)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
cell = BaseDoc.TableCellStyle ()
|
2003-06-14 06:46:30 +05:30
|
|
|
cell.set_padding (1) # each side makes 2cm, the size of the photo
|
2003-07-18 19:13:13 +05:30
|
|
|
doc.add_cell_style ("AR-PaddedCell", cell)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
cell = BaseDoc.TableCellStyle ()
|
2003-07-05 03:46:32 +05:30
|
|
|
cell.set_padding (0.1)
|
2003-06-21 14:27:35 +05:30
|
|
|
cell.set_left_border (1)
|
|
|
|
cell.set_top_border (1)
|
|
|
|
cell.set_right_border (1)
|
|
|
|
cell.set_bottom_border (1)
|
2003-07-18 19:13:13 +05:30
|
|
|
doc.add_cell_style ("AR-NoPhoto", cell)
|
2003-06-21 14:27:35 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
cell = BaseDoc.TableCellStyle ()
|
2003-06-27 16:48:58 +05:30
|
|
|
cell.set_padding (0.1)
|
2003-07-18 19:13:13 +05:30
|
|
|
doc.add_cell_style ("AR-Photo", cell)
|
2003-06-14 19:28:24 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
cell = BaseDoc.TableCellStyle ()
|
2003-06-27 16:48:58 +05:30
|
|
|
cell.set_padding (0.1)
|
2003-07-18 19:13:13 +05:30
|
|
|
doc.add_cell_style ("AR-Entry", cell)
|
2003-06-14 19:28:24 +05:30
|
|
|
|
2003-06-14 06:46:30 +05:30
|
|
|
if output:
|
|
|
|
self.standalone = 1
|
|
|
|
self.doc.open(output)
|
2003-09-13 10:27:30 +05:30
|
|
|
self.doc.init()
|
2003-06-14 06:46:30 +05:30
|
|
|
else:
|
|
|
|
self.standalone = 0
|
2003-07-06 04:40:43 +05:30
|
|
|
|
2003-06-14 06:46:30 +05:30
|
|
|
def write_report(self):
|
2003-07-06 04:40:43 +05:30
|
|
|
if self.newpage:
|
|
|
|
self.doc.page_break()
|
|
|
|
|
2003-06-27 03:43:58 +05:30
|
|
|
self.sources = []
|
2004-07-28 07:59:07 +05:30
|
|
|
name = self.person_name (self.start.get_handle())
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph("AR-Title")
|
2003-06-14 06:46:30 +05:30
|
|
|
title = _("Ancestors of %s") % name
|
|
|
|
self.doc.write_text(title)
|
|
|
|
self.doc.end_paragraph()
|
|
|
|
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph ("AR-Heading")
|
2003-07-22 17:10:03 +05:30
|
|
|
self.doc.write_text (_("Generation 1"))
|
2003-06-14 06:46:30 +05:30
|
|
|
self.doc.end_paragraph ()
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
self.write_paragraphs (self.person (self.start.get_handle(), suppress_children = 1,
|
2003-06-14 06:46:30 +05:30
|
|
|
needs_name = 1))
|
2004-07-28 07:59:07 +05:30
|
|
|
family_handles = [self.start.get_main_parents_family_handle ()]
|
|
|
|
if len (family_handles) > 0:
|
|
|
|
self.generation (self.max_generations, family_handles, [], [self.start.get_handle()])
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-06-27 03:43:58 +05:30
|
|
|
if len (self.sources) > 0:
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph ("AR-Heading")
|
2003-07-22 17:10:03 +05:30
|
|
|
self.doc.write_text (_("Sources"))
|
2003-06-27 03:43:58 +05:30
|
|
|
self.doc.end_paragraph ()
|
|
|
|
|
|
|
|
i = 1
|
2004-07-28 07:59:07 +05:30
|
|
|
for source_handle in self.sources:
|
2004-08-07 10:46:57 +05:30
|
|
|
source = self.database.get_source_from_handle(source_handle)
|
2003-07-20 17:49:12 +05:30
|
|
|
self.doc.start_paragraph ("AR-Entry")
|
2004-02-14 11:10:30 +05:30
|
|
|
self.doc.write_text ("[%d] %s" % (i, source.get_title ()))
|
|
|
|
author = source.get_author ()
|
|
|
|
pubinfo = source.get_publication_info ()
|
2003-07-23 19:22:17 +05:30
|
|
|
extra = author
|
|
|
|
if pubinfo:
|
|
|
|
if extra:
|
|
|
|
extra += ', '
|
|
|
|
extra += pubinfo
|
|
|
|
if extra:
|
|
|
|
self.doc.write_text ('; %s' % extra)
|
2003-07-20 17:49:12 +05:30
|
|
|
self.doc.end_paragraph ()
|
2003-06-27 03:43:58 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
note = source.get_note ()
|
|
|
|
format = source.get_note_format ()
|
2003-07-20 17:49:12 +05:30
|
|
|
if note:
|
2003-12-17 16:54:23 +05:30
|
|
|
self.doc.write_note (note, format, "AR-Details")
|
2003-07-20 17:49:12 +05:30
|
|
|
|
|
|
|
i += 1
|
2003-06-27 03:43:58 +05:30
|
|
|
|
2003-06-14 06:46:30 +05:30
|
|
|
if self.standalone:
|
|
|
|
self.doc.close()
|
|
|
|
return
|
|
|
|
|
|
|
|
def write_paragraphs (self, paragraphs):
|
|
|
|
for (fn, params) in paragraphs:
|
|
|
|
if len (params) == 0:
|
|
|
|
fn ()
|
|
|
|
elif len (params) == 1:
|
|
|
|
fn (params[0])
|
|
|
|
elif len (params) == 2:
|
|
|
|
fn (params[0], params[1])
|
|
|
|
elif len (params) == 3:
|
|
|
|
fn (params[0], params[1], params[2])
|
|
|
|
elif len (params) == 4:
|
|
|
|
fn (params[0], params[1], params[2], params[3])
|
|
|
|
else:
|
|
|
|
self.doc.write_text ("Call to %s with params %s" %
|
|
|
|
(str (fn), str (params)))
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
def family (self, family_handle, already_described):
|
2003-06-14 06:46:30 +05:30
|
|
|
ret = []
|
2004-08-20 03:05:16 +05:30
|
|
|
family = self.database.get_family_from_handle(family_handle)
|
2003-07-06 04:40:43 +05:30
|
|
|
if not family:
|
|
|
|
return ret
|
2004-07-28 07:59:07 +05:30
|
|
|
father_handle = family.get_father_handle ()
|
|
|
|
mother_handle = family.get_mother_handle ()
|
2004-08-07 10:46:57 +05:30
|
|
|
father = self.database.get_person_from_handle(father_handle)
|
|
|
|
mother = self.database.get_person_from_handle(mother_handle)
|
2003-06-14 06:46:30 +05:30
|
|
|
if father:
|
2004-07-28 07:59:07 +05:30
|
|
|
ret.extend (self.person (father_handle,
|
|
|
|
short_form = father_handle in already_described,
|
2003-06-14 06:46:30 +05:30
|
|
|
already_described = already_described,
|
|
|
|
needs_name = not mother,
|
|
|
|
from_family = family))
|
|
|
|
|
|
|
|
if mother:
|
2004-07-28 07:59:07 +05:30
|
|
|
ret.extend (self.person (mother_handle,
|
|
|
|
short_form = mother_handle in already_described,
|
2003-06-14 06:46:30 +05:30
|
|
|
already_described = already_described,
|
|
|
|
needs_name = not father,
|
|
|
|
from_family = family))
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
children_ids = family.get_child_handle_list ()
|
2004-02-16 07:35:35 +05:30
|
|
|
if len (children_ids):
|
2003-07-18 19:13:13 +05:30
|
|
|
ret.append ((self.doc.start_paragraph, ['AR-ChildTitle']))
|
2003-07-22 17:10:03 +05:30
|
|
|
ret.append ((self.doc.write_text, [_('Their children:')]))
|
2003-06-14 06:46:30 +05:30
|
|
|
ret.append ((self.doc.end_paragraph, []))
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
for child_handle in children_ids:
|
2004-08-07 10:46:57 +05:30
|
|
|
child = self.database.get_person_from_handle(child_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
ret.extend (self.person (child_handle, suppress_children = 1,
|
|
|
|
short_form=child_handle in already_described,
|
2003-06-14 06:46:30 +05:30
|
|
|
already_described = already_described,
|
|
|
|
needs_name = 1,
|
|
|
|
from_family = family))
|
|
|
|
|
|
|
|
return ret
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
def generation (self, generations, pfamily_handles, mfamily_handles,
|
2003-09-02 02:27:51 +05:30
|
|
|
already_described, thisgen = 2):
|
2004-07-28 07:59:07 +05:30
|
|
|
if generations > 1 and (len (pfamily_handles) + len (mfamily_handles)):
|
2003-06-14 06:46:30 +05:30
|
|
|
people = []
|
2004-07-28 07:59:07 +05:30
|
|
|
for family_handle in pfamily_handles:
|
|
|
|
people.extend (self.family (family_handle, already_described))
|
2003-09-02 02:27:51 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
if thisgen > 2 and len (mfamily_handles):
|
2004-08-20 03:05:16 +05:30
|
|
|
for self.gp in [self.database.get_family_from_handle(mfamily_handles[0]).get_father_handle (),
|
|
|
|
self.database.get_family_from_handle(mfamily_handles[0]).get_mother_handle ()]:
|
2003-09-02 02:27:51 +05:30
|
|
|
if self.gp:
|
|
|
|
break
|
|
|
|
|
2004-02-16 03:22:43 +05:30
|
|
|
relstring = self.relationship.get_grandparents_string (self.start,
|
2004-08-07 10:46:57 +05:30
|
|
|
self.database.get_person_from_handle(self.gp))[0]
|
2003-09-02 02:27:51 +05:30
|
|
|
heading = _("%(name)s's maternal %(grandparents)s") % \
|
|
|
|
{ 'name': self.first_name_or_nick (self.start),
|
|
|
|
'grandparents': relstring }
|
|
|
|
people.append ((self.doc.start_paragraph, ['AR-Heading']))
|
|
|
|
people.append ((self.doc.write_text, [heading]))
|
|
|
|
people.append ((self.doc.end_paragraph, []))
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
for family_handle in mfamily_handles:
|
|
|
|
people.extend (self.family (family_handle, already_described))
|
2003-06-14 06:46:30 +05:30
|
|
|
|
|
|
|
if len (people):
|
2003-06-25 16:36:42 +05:30
|
|
|
if self.pgbrk:
|
|
|
|
self.doc.page_break()
|
2003-07-18 19:13:13 +05:30
|
|
|
self.doc.start_paragraph ("AR-Heading")
|
2004-07-28 07:59:07 +05:30
|
|
|
family_handles = pfamily_handles
|
|
|
|
family_handles.extend (mfamily_handles)
|
2004-08-20 03:05:16 +05:30
|
|
|
for self.gp in [self.database.get_family_from_handle(family_handles[0]).get_father_handle (),
|
|
|
|
self.database.get_family_from_handle(family_handles[0]).get_mother_handle ()]:
|
2003-08-11 22:40:17 +05:30
|
|
|
if self.gp:
|
|
|
|
break
|
2003-09-02 02:27:51 +05:30
|
|
|
|
2004-02-16 07:35:35 +05:30
|
|
|
relstring = self.relationship.get_grandparents_string (self.start,
|
2004-08-07 10:46:57 +05:30
|
|
|
self.database.get_person_from_handle(self.gp))[0]
|
2003-09-02 02:27:51 +05:30
|
|
|
if thisgen == 2:
|
|
|
|
heading = _("%(name)s's %(parents)s") % \
|
|
|
|
{ 'name': self.first_name_or_nick (self.start),
|
|
|
|
'parents': relstring }
|
|
|
|
else:
|
|
|
|
heading = _("%(name)s's paternal %(grandparents)s") % \
|
|
|
|
{ 'name': self.first_name_or_nick (self.start),
|
|
|
|
'grandparents': relstring }
|
|
|
|
|
2003-07-17 15:30:53 +05:30
|
|
|
self.doc.write_text (heading)
|
2003-06-14 06:46:30 +05:30
|
|
|
self.doc.end_paragraph ()
|
|
|
|
self.write_paragraphs (people)
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
next_pfamily_handles = []
|
|
|
|
next_mfamily_handles = []
|
|
|
|
for family_handle in family_handles:
|
2004-08-20 03:05:16 +05:30
|
|
|
family = self.database.get_family_from_handle(family_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
father_handle = family.get_father_handle ()
|
2004-08-07 10:46:57 +05:30
|
|
|
father = self.database.get_person_from_handle(father_handle)
|
2003-06-14 06:46:30 +05:30
|
|
|
if father:
|
2004-07-28 07:59:07 +05:30
|
|
|
already_described.append (father_handle)
|
|
|
|
father_family_handle = father.get_main_parents_family_handle ()
|
2004-08-20 03:05:16 +05:30
|
|
|
father_family = self.database.get_family_from_handle(father_family_handle)
|
2003-06-14 06:46:30 +05:30
|
|
|
if father_family:
|
2004-07-28 07:59:07 +05:30
|
|
|
next_pfamily_handles.append (father_family_handle)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
mother_handle = family.get_mother_handle ()
|
2004-08-07 10:46:57 +05:30
|
|
|
mother = self.database.get_person_from_handle(mother_handle)
|
2003-06-14 06:46:30 +05:30
|
|
|
if mother:
|
2004-07-28 07:59:07 +05:30
|
|
|
already_described.append (mother_handle)
|
|
|
|
mother_family_handle = mother.get_main_parents_family_handle ()
|
2004-08-20 03:05:16 +05:30
|
|
|
mother_family = self.database.get_family_from_handle(mother_family_handle)
|
2003-06-14 06:46:30 +05:30
|
|
|
if mother_family:
|
2004-07-28 07:59:07 +05:30
|
|
|
next_mfamily_handles.append (mother_family_handle)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
self.generation (generations - 1, next_pfamily_handles,
|
|
|
|
next_mfamily_handles, already_described,
|
2003-09-02 02:27:51 +05:30
|
|
|
thisgen + 1)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
def person (self, person_handle,
|
2003-06-14 06:46:30 +05:30
|
|
|
suppress_children = 0,
|
|
|
|
short_form = 0,
|
|
|
|
already_described = [],
|
|
|
|
needs_name = 0,
|
|
|
|
from_family = None):
|
|
|
|
ret = []
|
2004-08-07 10:46:57 +05:30
|
|
|
person = self.database.get_person_from_handle(person_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
name = self.person_name (person_handle)
|
2003-06-14 06:46:30 +05:30
|
|
|
if name:
|
2004-02-21 11:41:59 +05:30
|
|
|
photos = person.get_media_list ()
|
2003-06-14 06:46:30 +05:30
|
|
|
|
|
|
|
bits = ''
|
|
|
|
bits += self.short_occupation (person)
|
|
|
|
bits += self.long_born_died (person)
|
|
|
|
if not suppress_children:
|
2004-07-28 07:59:07 +05:30
|
|
|
bits += self.parents_of (person_handle)
|
2003-06-14 06:46:30 +05:30
|
|
|
else:
|
|
|
|
bits += '.'
|
2003-06-26 19:43:05 +05:30
|
|
|
bits += self.married_whom (person, from_family, suppress_children)
|
2003-06-14 06:46:30 +05:30
|
|
|
bits += self.inline_notes (person)
|
|
|
|
|
|
|
|
longnotes = self.long_notes (person, suppress_children,
|
|
|
|
already_described)
|
|
|
|
|
|
|
|
if (bits != '.' or longnotes or photos or
|
|
|
|
suppress_children or needs_name):
|
|
|
|
# We have something to say about this person.
|
|
|
|
|
|
|
|
spouse = []
|
|
|
|
if from_family:
|
2004-07-28 07:59:07 +05:30
|
|
|
from_family_father = from_family.get_father_handle ()
|
|
|
|
from_family_mother = from_family.get_mother_handle ()
|
2003-06-14 06:46:30 +05:30
|
|
|
else:
|
|
|
|
from_family_father = from_family_mother = None
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
for family_handle in person.get_family_handle_list ():
|
2004-08-20 03:05:16 +05:30
|
|
|
family = self.database.get_family_from_handle(family_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
for partner_id in [family.get_father_handle (),
|
|
|
|
family.get_mother_handle ()]:
|
2004-08-07 10:46:57 +05:30
|
|
|
partner = self.database.get_person_from_handle(partner_id)
|
2004-07-28 07:59:07 +05:30
|
|
|
if partner_id == person_handle or not partner:
|
2003-06-14 06:46:30 +05:30
|
|
|
continue
|
|
|
|
|
|
|
|
if (suppress_children or
|
|
|
|
(partner != from_family_father and
|
|
|
|
partner != from_family_mother)):
|
2004-04-25 11:07:51 +05:30
|
|
|
for media_ref in partner.get_media_list ()[:1]:
|
2004-07-28 07:59:07 +05:30
|
|
|
object_handle = media_ref.get_reference_handle()
|
2004-08-07 10:46:57 +05:30
|
|
|
mobject = self.database.get_object_from_handle(object_handle)
|
2004-04-25 10:18:02 +05:30
|
|
|
if mobject.get_mime_type()[0:5] == "image":
|
2004-02-21 11:41:59 +05:30
|
|
|
spouse.append ((self.doc.add_media_object,
|
2004-04-25 10:18:02 +05:30
|
|
|
[mobject.get_path (),
|
2003-10-27 09:18:13 +05:30
|
|
|
'right', 2, 2]))
|
2003-06-14 06:46:30 +05:30
|
|
|
|
|
|
|
if suppress_children and len (already_described):
|
2003-07-18 19:13:13 +05:30
|
|
|
style = "AR-Child"
|
2003-06-14 06:46:30 +05:30
|
|
|
else:
|
2003-07-18 19:13:13 +05:30
|
|
|
style = "AR-Person"
|
2003-06-14 06:46:30 +05:30
|
|
|
if len (spouse):
|
2003-06-26 19:43:05 +05:30
|
|
|
style += "WithSpouse%d" % len (spouse)
|
2003-06-14 06:46:30 +05:30
|
|
|
else:
|
|
|
|
style += "NoSpouse"
|
|
|
|
|
|
|
|
ret.append ((self.doc.start_table, [style, style]))
|
|
|
|
ret.append ((self.doc.start_row, []))
|
|
|
|
|
|
|
|
if suppress_children and len (already_described):
|
2003-09-02 06:17:09 +05:30
|
|
|
# Can't do proper formatting with BaseDoc, so cheat.
|
2003-07-18 19:13:13 +05:30
|
|
|
ret.append ((self.doc.start_cell, ["AR-PaddedCell"]))
|
2003-06-14 06:46:30 +05:30
|
|
|
ret.append ((self.doc.end_cell, []))
|
|
|
|
|
|
|
|
if len (photos) == 0:
|
2003-07-18 19:13:13 +05:30
|
|
|
ret.append ((self.doc.start_cell, ["AR-NoPhoto"]))
|
|
|
|
ret.append ((self.doc.start_paragraph, ["AR-NoPhotoText"]))
|
2003-07-22 17:10:03 +05:30
|
|
|
ret.append ((self.doc.write_text, [_("(no photo)")]))
|
2003-06-30 20:26:32 +05:30
|
|
|
ret.append ((self.doc.end_paragraph, []))
|
2003-06-14 06:46:30 +05:30
|
|
|
ret.append ((self.doc.end_cell, []))
|
|
|
|
else:
|
2003-07-18 19:13:13 +05:30
|
|
|
ret.append ((self.doc.start_cell, ["AR-Photo"]))
|
2004-04-25 11:07:51 +05:30
|
|
|
for media_ref in photos[:1]:
|
2004-07-28 07:59:07 +05:30
|
|
|
object_handle = media_ref.get_reference_handle()
|
2004-08-07 10:46:57 +05:30
|
|
|
mobject = self.database.get_object_from_handle(object_handle)
|
2004-04-25 10:18:02 +05:30
|
|
|
if mobject.get_mime_type()[0:5] == "image":
|
2004-02-21 11:41:59 +05:30
|
|
|
ret.append ((self.doc.add_media_object,
|
2004-04-25 10:18:02 +05:30
|
|
|
[mobject.get_path (), 'left', 2, 2]))
|
2003-06-14 06:46:30 +05:30
|
|
|
ret.append ((self.doc.end_cell, []))
|
|
|
|
|
2003-07-18 19:13:13 +05:30
|
|
|
ret.append ((self.doc.start_cell, ["AR-Entry"]))
|
|
|
|
ret.append ((self.doc.start_paragraph, ["AR-Entry"]))
|
2003-06-14 06:46:30 +05:30
|
|
|
ret.append ((self.doc.write_text, [name]))
|
|
|
|
if short_form:
|
2003-07-22 17:10:03 +05:30
|
|
|
ret.append ((self.doc.write_text,
|
|
|
|
[_(" (mentioned above).")]))
|
2003-06-14 06:46:30 +05:30
|
|
|
else:
|
|
|
|
ret.append ((self.doc.write_text, [bits]))
|
|
|
|
|
|
|
|
ret.append ((self.doc.end_paragraph, []))
|
|
|
|
ret.append ((self.doc.end_cell, []))
|
|
|
|
|
2003-06-26 19:43:05 +05:30
|
|
|
for s in spouse:
|
2003-07-18 19:13:13 +05:30
|
|
|
ret.append ((self.doc.start_cell, ["AR-Photo"]))
|
2003-06-26 19:43:05 +05:30
|
|
|
ret.append (s)
|
2003-06-14 06:46:30 +05:30
|
|
|
ret.append ((self.doc.end_cell, []))
|
|
|
|
|
|
|
|
ret.append ((self.doc.end_row, []))
|
|
|
|
ret.append ((self.doc.end_table, []))
|
|
|
|
|
|
|
|
if not short_form:
|
|
|
|
ret.extend (longnotes)
|
|
|
|
|
|
|
|
return ret
|
|
|
|
|
|
|
|
def short_occupation (self, person):
|
|
|
|
occupation = ''
|
2004-07-28 07:59:07 +05:30
|
|
|
for event_handle in person.get_event_list ():
|
|
|
|
if not event_handle:
|
2004-04-25 10:18:02 +05:30
|
|
|
continue
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
event = self.database.get_event_from_handle(event_handle)
|
2004-02-14 11:10:30 +05:30
|
|
|
if event.get_name () == 'Occupation':
|
2003-06-14 06:46:30 +05:30
|
|
|
if occupation:
|
|
|
|
return ''
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
occupation = event.get_description ()
|
2003-06-14 06:46:30 +05:30
|
|
|
|
|
|
|
if occupation:
|
|
|
|
return ' (%s)' % occupation
|
|
|
|
|
|
|
|
return ''
|
|
|
|
|
|
|
|
def event_info (self, event):
|
|
|
|
info = ''
|
2004-02-14 11:10:30 +05:30
|
|
|
name = event.get_name ()
|
|
|
|
description = event.get_description ()
|
2003-06-14 06:46:30 +05:30
|
|
|
if name != 'Birth' and name != 'Death' and name != 'Marriage':
|
2003-07-23 19:22:17 +05:30
|
|
|
info += const.display_pevent (name)
|
2003-06-14 06:46:30 +05:30
|
|
|
if description:
|
|
|
|
info += ': ' + description
|
2003-07-17 16:24:41 +05:30
|
|
|
description = None
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
dateobj = event.get_date_object ()
|
2003-06-14 06:46:30 +05:30
|
|
|
if dateobj:
|
2004-02-14 11:10:30 +05:30
|
|
|
text = dateobj.get_text()
|
2003-06-14 06:46:30 +05:30
|
|
|
if text:
|
2003-06-21 14:21:23 +05:30
|
|
|
info += ' ' + text[0].lower() + text[1:]
|
2004-04-25 10:18:02 +05:30
|
|
|
elif dateobj.get_valid ():
|
2004-09-13 21:16:00 +05:30
|
|
|
if (dateobj.isRange () or
|
|
|
|
dateobj.get_start_date ().getModeVal () != Calendar.EXACT):
|
2004-02-14 11:10:30 +05:30
|
|
|
info += ' ' + dateobj.get_date ()
|
2004-04-25 10:18:02 +05:30
|
|
|
elif (dateobj.get_day_valid () and
|
|
|
|
dateobj.get_month_valid () and
|
|
|
|
dateobj.get_year_valid ()):
|
2003-07-22 23:10:05 +05:30
|
|
|
info += _(' on %(specific_date)s') % \
|
2004-02-14 11:10:30 +05:30
|
|
|
{'specific_date': dateobj.get_date ()}
|
2003-06-14 06:46:30 +05:30
|
|
|
else:
|
2003-07-22 23:10:05 +05:30
|
|
|
info += _(' in %(month_or_year)s') % \
|
2004-02-14 11:10:30 +05:30
|
|
|
{'month_or_year': dateobj.get_date ()}
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2004-08-23 22:34:14 +05:30
|
|
|
place = self.database.get_place_from_handle(event.get_place_handle())
|
|
|
|
if place:
|
|
|
|
placename = place.get_title()
|
|
|
|
if placename:
|
|
|
|
info += _(' in %(place)s') % {'place': placename}
|
2004-02-14 11:10:30 +05:30
|
|
|
note = event.get_note ()
|
|
|
|
note_format = event.get_note_format ()
|
2003-12-17 16:54:23 +05:30
|
|
|
inline_note = note and (note_format == 0)
|
|
|
|
if inline_note or description:
|
2003-07-17 16:24:41 +05:30
|
|
|
info += ' ('
|
|
|
|
if description:
|
|
|
|
info += description
|
|
|
|
if note:
|
|
|
|
if description:
|
|
|
|
info += '; '
|
|
|
|
info += note
|
|
|
|
info += ')'
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
info += self.cite_sources (event.get_source_references ())
|
2003-06-14 06:46:30 +05:30
|
|
|
return info
|
|
|
|
|
2003-07-17 15:30:53 +05:30
|
|
|
def address_info (self, address):
|
2004-02-14 11:10:30 +05:30
|
|
|
info = _('Address:') + ' %s %s %s %s' % (address.get_street (),
|
|
|
|
address.get_city (),
|
|
|
|
address.get_state (),
|
|
|
|
address.get_country ())
|
2003-07-17 15:30:53 +05:30
|
|
|
|
|
|
|
info = info.rstrip ()
|
2004-02-14 11:10:30 +05:30
|
|
|
date = address.get_date ()
|
2003-07-17 15:30:53 +05:30
|
|
|
if date:
|
|
|
|
info += ', ' + date
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
info += self.cite_sources (address.get_source_references ())
|
2003-07-17 15:30:53 +05:30
|
|
|
return info
|
|
|
|
|
2003-07-17 16:36:50 +05:30
|
|
|
def abbrev_born_died (self, person):
|
|
|
|
ret = ''
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
birth_handle = person.get_birth_handle ()
|
|
|
|
if birth_handle:
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
birth = self.database.get_event_from_handle(birth_handle)
|
2004-04-25 10:18:02 +05:30
|
|
|
date = birth.get_date ()
|
|
|
|
if date:
|
|
|
|
ret += _(" b. %(date)s") % {'date': date}
|
|
|
|
ret += self.cite_sources (birth.get_source_references ())
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
death_handle = person.get_death_handle ()
|
|
|
|
if death_handle:
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
death = self.database.get_event_from_handle(death_handle)
|
2004-04-25 10:18:02 +05:30
|
|
|
date = death.get_date ()
|
|
|
|
if date:
|
|
|
|
ret += _(" d. %(date)s)") % {'date': date}
|
|
|
|
ret += self.cite_sources (death.get_source_references ())
|
2003-07-17 16:36:50 +05:30
|
|
|
|
|
|
|
return ret
|
|
|
|
|
2003-06-14 06:46:30 +05:30
|
|
|
def long_born_died (self, person):
|
|
|
|
ret = ''
|
2004-07-28 07:59:07 +05:30
|
|
|
birth_handle = person.get_birth_handle ()
|
|
|
|
if birth_handle:
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
birth = self.database.get_event_from_handle(birth_handle)
|
2004-04-25 10:18:02 +05:30
|
|
|
born_info = self.event_info (birth)
|
2003-06-14 06:46:30 +05:30
|
|
|
if born_info:
|
2004-04-25 10:18:02 +05:30
|
|
|
ret = ", " + _("born") + born_info
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
death_handle = person.get_death_handle()
|
|
|
|
if death_handle:
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
death = self.database.get_event_from_handle(death_handle)
|
2004-04-25 10:18:02 +05:30
|
|
|
died_info = self.event_info (death)
|
|
|
|
if died_info:
|
|
|
|
if born_info:
|
|
|
|
ret += '; '
|
|
|
|
else:
|
|
|
|
ret += ', '
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2004-04-25 10:18:02 +05:30
|
|
|
ret += _('died') + died_info
|
2003-06-14 06:46:30 +05:30
|
|
|
|
|
|
|
return ret
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
def parents_of (self, person_handle):
|
* src/RelLib.py (try_to_find_person_from_id): Remove transaction;
(try_to_find_source_from_id, try_to_find_object_from_id,
try_to_find_place_from_id): Add functions.
* src/plugins/WriteCD.py, src/plugins/WritePkg.py,
src/plugins/WebPage.py, src/plugins/Verify.py,
src/plugins/TimeLine.py, src/plugins/Summary.py,
src/plugins/SoundGen.py, src/plugins/RelGraph.py,
src/plugins/RelCalc.py, src/plugins/PatchNames.py,
src/plugins/Merge.py, src/plugins/IndivSummary.py,
src/plugins/IndivComplete.py, src/plugins/GraphViz.py,
src/plugins/FtmStyleDescendants.py,
src/plugins/FtmStyleAncestors.py, src/plugins/FilterEditor.py,
src/plugins/FanChart.py, src/plugins/FamilyGroup.py,
src/plugins/EventCmp.py, src/plugins/DetDescendantReport.py,
src/plugins/DetAncestralReport.py, src/plugins/DescendReport.py,
src/plugins/Desbrowser.py, src/plugins/CountAncestors.py,
src/plugins/Check.py, src/plugins/ChangeTypes.py,
src/plugins/BookReport.py, src/plugins/Ancestors.py,
src/plugins/AncestorReport.py, src/plugins/AncestorChart.py,
src/plugins/AncestorChart2.py, src/Relationship.py,
src/Sort.py, src/GenericFilter.py, src/SubstKeywords.py,
src/GraphLayout.py: Switch from find_* to try_to_find_* methods.
svn: r3191
2004-05-26 07:35:02 +05:30
|
|
|
ret = '. '
|
2004-08-07 10:46:57 +05:30
|
|
|
person = self.database.get_person_from_handle(person_handle)
|
2004-02-14 11:10:30 +05:30
|
|
|
gender = person.get_gender ()
|
2003-07-22 23:10:05 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
family_handle = person.get_main_parents_family_handle ()
|
|
|
|
if family_handle:
|
2004-08-20 03:05:16 +05:30
|
|
|
family = self.database.get_family_from_handle(family_handle)
|
2003-06-14 06:46:30 +05:30
|
|
|
fathername = mothername = None
|
2004-07-28 07:59:07 +05:30
|
|
|
father_handle = family.get_father_handle ()
|
|
|
|
if father_handle:
|
2004-08-07 10:46:57 +05:30
|
|
|
#father = self.database.get_person_from_handle(father_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
fathername = self.person_name (father_handle)
|
|
|
|
mother_handle = family.get_mother_handle ()
|
|
|
|
if mother_handle:
|
2004-08-07 10:46:57 +05:30
|
|
|
#mother = self.database.get_person_from_handle(mother_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
mothername = self.person_name (mother_handle)
|
|
|
|
|
|
|
|
if not mother_handle and not father_handle:
|
2003-06-14 06:46:30 +05:30
|
|
|
pass
|
2004-07-28 07:59:07 +05:30
|
|
|
elif not father_handle:
|
2003-07-22 23:10:05 +05:30
|
|
|
if gender == RelLib.Person.female:
|
|
|
|
ret += _("She is the daughter of %(mother)s.") % \
|
|
|
|
{'mother': mothername}
|
|
|
|
else:
|
|
|
|
ret += _("He is the son of %(mother)s.") % \
|
|
|
|
{'mother': mothername}
|
2004-07-28 07:59:07 +05:30
|
|
|
elif not mother_handle:
|
2003-07-22 23:10:05 +05:30
|
|
|
if gender == RelLib.Person.female:
|
|
|
|
ret += _("She is the daughter of %(father)s.") % \
|
|
|
|
{'father': fathername}
|
|
|
|
else:
|
|
|
|
ret += _("He is the son of %(father)s.") % \
|
|
|
|
{'father': fathername}
|
2003-06-14 06:46:30 +05:30
|
|
|
else:
|
2003-07-22 23:10:05 +05:30
|
|
|
if gender == RelLib.Person.female:
|
|
|
|
ret += \
|
|
|
|
_("She is the daughter of %(father)s and %(mother)s.")%\
|
|
|
|
{'father': fathername,
|
|
|
|
'mother': mothername}
|
|
|
|
else:
|
|
|
|
ret +=_("He is the son of %(father)s and %(mother)s.") % \
|
|
|
|
{'father': fathername,
|
|
|
|
'mother': mothername}
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-07-22 23:10:05 +05:30
|
|
|
return ret
|
2003-06-14 06:46:30 +05:30
|
|
|
|
|
|
|
def first_name_or_nick (self, person):
|
2004-02-14 11:10:30 +05:30
|
|
|
nickname = person.get_nick_name ()
|
2003-06-14 06:46:30 +05:30
|
|
|
if nickname:
|
|
|
|
return nickname
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
name = person.get_primary_name ().get_first_name ()
|
2003-06-14 06:46:30 +05:30
|
|
|
return name.split (' ')[0]
|
|
|
|
|
|
|
|
def title (self, person):
|
2004-02-14 11:10:30 +05:30
|
|
|
name = person.get_primary_name ()
|
|
|
|
t = name.get_title ()
|
2003-06-14 06:46:30 +05:30
|
|
|
if t:
|
|
|
|
return t
|
2003-07-17 22:45:09 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
gender = person.get_gender ()
|
2003-07-17 22:45:09 +05:30
|
|
|
if gender == RelLib.Person.female:
|
2004-02-14 11:10:30 +05:30
|
|
|
if name.get_type () == 'Married Name':
|
2003-07-22 23:10:05 +05:30
|
|
|
return _('Mrs.')
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-07-22 23:10:05 +05:30
|
|
|
return _('Miss')
|
2003-07-17 22:45:09 +05:30
|
|
|
elif gender == RelLib.Person.male:
|
2003-07-22 23:10:05 +05:30
|
|
|
return _('Mr.')
|
2003-07-17 22:45:09 +05:30
|
|
|
else:
|
2003-07-22 23:10:05 +05:30
|
|
|
return _('(gender unknown)')
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-06-27 03:43:58 +05:30
|
|
|
def cite_sources (self, sourcereflist):
|
|
|
|
citation = ""
|
2003-06-27 16:48:58 +05:30
|
|
|
if self.opt_cite:
|
|
|
|
for ref in sourcereflist:
|
|
|
|
if ref in self.sourcerefs:
|
|
|
|
continue
|
|
|
|
|
|
|
|
self.sourcerefs.append (ref)
|
2004-07-28 07:59:07 +05:30
|
|
|
source_handle = ref.get_base_handle ()
|
|
|
|
if source_handle in self.sources:
|
|
|
|
ind = self.sources.index (source_handle) + 1
|
2003-06-27 16:48:58 +05:30
|
|
|
else:
|
2004-07-28 07:59:07 +05:30
|
|
|
self.sources.append (source_handle)
|
2003-06-27 16:48:58 +05:30
|
|
|
ind = len (self.sources)
|
2003-06-27 03:43:58 +05:30
|
|
|
|
2003-06-27 16:48:58 +05:30
|
|
|
citation += "[%d" % ind
|
2004-02-14 11:10:30 +05:30
|
|
|
comments = ref.get_comments ()
|
2003-06-27 16:48:58 +05:30
|
|
|
if comments and comments.find ('\n') == -1:
|
2004-04-25 11:08:17 +05:30
|
|
|
# Work around rstrip('.') which is not working
|
|
|
|
# with python2.2.1 and earlier
|
2004-04-25 11:07:51 +05:30
|
|
|
#citation += " - %s" % comments.rstrip ('.')
|
|
|
|
comments = comments.rstrip()
|
|
|
|
if comments[-1] == '.':
|
|
|
|
comments = comments[:-1]
|
|
|
|
citation += " - %s" % comments
|
2003-06-27 16:48:58 +05:30
|
|
|
|
|
|
|
citation += "]"
|
2003-06-27 03:43:58 +05:30
|
|
|
|
|
|
|
return citation
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
def person_name (self, person_handle):
|
2004-08-07 10:46:57 +05:30
|
|
|
person = self.database.get_person_from_handle(person_handle)
|
2004-02-14 11:10:30 +05:30
|
|
|
primary = person.get_primary_name ()
|
2003-06-21 14:13:48 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
name = primary.get_title ()
|
2003-06-21 14:13:48 +05:30
|
|
|
if name:
|
|
|
|
name += ' '
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
first = primary.get_first_name ()
|
|
|
|
last = primary.get_surname ()
|
2003-06-14 06:46:30 +05:30
|
|
|
first_replaced = first.replace ('?', '')
|
|
|
|
if first_replaced == '':
|
|
|
|
name += self.title (person)
|
|
|
|
else:
|
|
|
|
name += first
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
nick = person.get_nick_name ()
|
2003-07-17 15:30:53 +05:30
|
|
|
if nick:
|
2004-04-25 11:07:51 +05:30
|
|
|
#nick = nick.strip ('"')
|
|
|
|
# Work around strip('"') which is not working
|
|
|
|
# with python2.2.1 and earlier
|
|
|
|
nick = nick.strip()
|
|
|
|
if nick[0] == '"':
|
2004-04-25 11:08:17 +05:30
|
|
|
nick = nick[1:]
|
2004-04-25 11:07:51 +05:30
|
|
|
if nick[-1] == '"':
|
|
|
|
nick = nick[:-1]
|
|
|
|
name += ' ("%s")' % nick
|
2003-07-17 15:30:53 +05:30
|
|
|
|
2003-06-14 06:46:30 +05:30
|
|
|
if last.replace ('?', '') == '':
|
|
|
|
if first_replaced == '':
|
2003-07-22 23:10:05 +05:30
|
|
|
name += _(' (unknown)')
|
2003-06-14 06:46:30 +05:30
|
|
|
else:
|
|
|
|
name += ' ' + last
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
suffix = primary.get_suffix ()
|
2003-06-21 14:13:48 +05:30
|
|
|
if suffix:
|
|
|
|
name += ', ' + suffix
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
type = primary.get_type ()
|
2003-06-14 06:46:30 +05:30
|
|
|
if type != 'Birth Name':
|
2004-08-21 03:25:29 +05:30
|
|
|
name += ' (%s)' % const.NameTypesMap.find_value (type)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
name += self.cite_sources (primary.get_source_references ())
|
2003-06-14 06:46:30 +05:30
|
|
|
return name
|
|
|
|
|
2003-06-26 19:43:05 +05:30
|
|
|
def married_whom (self, person, from_family, listing_children = 0):
|
2004-02-14 11:10:30 +05:30
|
|
|
gender = person.get_gender ()
|
2003-06-14 06:46:30 +05:30
|
|
|
first_marriage = 1
|
|
|
|
ret = ''
|
2004-07-28 07:59:07 +05:30
|
|
|
for family_handle in person.get_family_handle_list ():
|
2004-08-20 03:05:16 +05:30
|
|
|
family = self.database.get_family_from_handle(family_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
mother_handle = family.get_mother_handle ()
|
2004-08-07 10:46:57 +05:30
|
|
|
mother = self.database.get_person_from_handle(mother_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
for spouse_id in [family.get_father_handle (), mother_handle]:
|
2004-08-07 10:46:57 +05:30
|
|
|
spouse = self.database.get_person_from_handle(spouse_id)
|
2004-07-28 07:59:07 +05:30
|
|
|
if spouse_id == person.get_handle() or not spouse_id:
|
2003-06-14 06:46:30 +05:30
|
|
|
continue
|
|
|
|
|
|
|
|
children = ''
|
2004-07-28 07:59:07 +05:30
|
|
|
childlist = family.get_child_handle_list ()
|
2003-06-14 06:46:30 +05:30
|
|
|
child_count = len (childlist)
|
2003-06-26 19:43:05 +05:30
|
|
|
if ((listing_children or family != from_family) and
|
|
|
|
child_count > 0):
|
2003-06-14 06:46:30 +05:30
|
|
|
if child_count == 1:
|
2003-07-22 23:10:05 +05:30
|
|
|
children = _(', and they had a child named ')
|
2003-06-14 06:46:30 +05:30
|
|
|
else:
|
2003-07-22 23:10:05 +05:30
|
|
|
children += _(', and they had %d children: ') % \
|
|
|
|
child_count
|
2003-06-14 06:46:30 +05:30
|
|
|
|
|
|
|
count = 1
|
2004-07-28 07:59:07 +05:30
|
|
|
for child_handle in childlist:
|
2004-08-07 10:46:57 +05:30
|
|
|
child = self.database.get_person_from_handle(child_handle)
|
2003-06-14 06:46:30 +05:30
|
|
|
children += self.first_name_or_nick (child)
|
2004-02-14 11:10:30 +05:30
|
|
|
children += self.cite_sources (child.get_primary_name ().
|
|
|
|
get_source_references ())
|
2003-07-17 16:36:50 +05:30
|
|
|
children += self.abbrev_born_died (child)
|
2003-06-14 06:46:30 +05:30
|
|
|
if child_count - count > 1:
|
|
|
|
children += ', '
|
|
|
|
elif child_count - count == 1:
|
2003-07-22 23:10:05 +05:30
|
|
|
children += _(' and ')
|
2003-06-14 06:46:30 +05:30
|
|
|
|
|
|
|
count += 1
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
for event_handle in family.get_event_list():
|
|
|
|
if event_handle:
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
event = self.database.get_event_from_handle(event_handle)
|
2004-04-25 10:18:02 +05:30
|
|
|
if event.get_name() == "Marriage":
|
|
|
|
marriage = event
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
continue
|
|
|
|
|
|
|
|
#marriage = family.get_marriage ()
|
2003-06-14 06:46:30 +05:30
|
|
|
if not first_marriage:
|
2003-07-22 17:23:04 +05:30
|
|
|
if gender == RelLib.Person.female:
|
|
|
|
ret += _(' She later married %(name)s') % \
|
2004-02-16 07:35:35 +05:30
|
|
|
{'name': self.person_name (spouse_id)}
|
2003-07-22 17:23:04 +05:30
|
|
|
else:
|
|
|
|
ret += _(' He later married %(name)s') % \
|
2004-02-16 07:35:35 +05:30
|
|
|
{'name': self.person_name (spouse_id)}
|
2003-07-22 17:23:04 +05:30
|
|
|
|
2003-06-14 06:46:30 +05:30
|
|
|
if marriage:
|
|
|
|
ret += self.event_info (marriage)
|
|
|
|
ret += children + '.'
|
2003-06-26 19:43:05 +05:30
|
|
|
elif (listing_children or
|
2004-07-28 07:59:07 +05:30
|
|
|
spouse_id == mother_handle or
|
|
|
|
family_handle != from_family.get_handle()):
|
2003-07-22 17:23:04 +05:30
|
|
|
if gender == RelLib.Person.female:
|
|
|
|
ret += _(' She married %(name)s') % \
|
2004-02-16 07:35:35 +05:30
|
|
|
{'name': self.person_name (spouse_id)}
|
2003-07-22 17:23:04 +05:30
|
|
|
else:
|
|
|
|
ret += _(' He married %(name)s') % \
|
2004-02-16 07:35:35 +05:30
|
|
|
{'name': self.person_name (spouse_id)}
|
2003-07-22 17:23:04 +05:30
|
|
|
|
2003-06-14 06:46:30 +05:30
|
|
|
if marriage:
|
|
|
|
ret += self.event_info (marriage)
|
|
|
|
ret += children + '.'
|
|
|
|
|
|
|
|
first_marriage = 0
|
|
|
|
|
|
|
|
return ret
|
|
|
|
|
|
|
|
def inline_notes (self, person):
|
2004-02-14 11:10:30 +05:30
|
|
|
name_note = person.get_primary_name ().get_note ()
|
2003-06-26 20:00:27 +05:30
|
|
|
if not (name_note == '' or name_note.find ('\n') != -1):
|
2003-07-22 17:10:03 +05:30
|
|
|
return _(' Note about their name: ') + name_note
|
2004-02-14 11:10:30 +05:30
|
|
|
note = person.get_note ()
|
|
|
|
if not (person.get_note_format () != 0 or
|
2003-12-16 22:36:52 +05:30
|
|
|
note == '' or note.find ('\n') != -1):
|
2003-06-14 06:46:30 +05:30
|
|
|
return ' ' + note
|
|
|
|
|
|
|
|
return ''
|
|
|
|
|
|
|
|
def long_details (self, note, paras):
|
|
|
|
para_end = note.find ('\n')
|
|
|
|
if para_end != -1:
|
|
|
|
paras = self.long_details (note[note.find ('\n') + 1:], paras)
|
2003-12-16 22:36:52 +05:30
|
|
|
else:
|
2003-06-14 06:46:30 +05:30
|
|
|
para_end = len (note)
|
|
|
|
|
|
|
|
paras.insert (0, (self.doc.end_paragraph, []))
|
|
|
|
paras.insert (0, (self.doc.write_text, [note[:para_end]]))
|
2003-07-18 19:13:13 +05:30
|
|
|
paras.insert (0, (self.doc.start_paragraph, ['AR-Details']))
|
2003-06-14 06:46:30 +05:30
|
|
|
return paras
|
|
|
|
|
|
|
|
def long_notes (self, person, suppress_children = 0,
|
|
|
|
already_described = []):
|
2004-02-14 11:10:30 +05:30
|
|
|
note = person.get_note ()
|
|
|
|
format = person.get_note_format ()
|
2003-12-16 22:36:52 +05:30
|
|
|
if format != 0:
|
|
|
|
paras = [ (self.doc.write_note, [note, format, 'AR-Details']) ]
|
|
|
|
elif note != '' and note.find ('\n') != -1:
|
2003-06-14 06:46:30 +05:30
|
|
|
paras = self.long_details (note, [])
|
|
|
|
else:
|
|
|
|
paras = []
|
|
|
|
|
2004-02-14 11:10:30 +05:30
|
|
|
names = person.get_alternate_names ()
|
2004-07-28 07:59:07 +05:30
|
|
|
event_handles = person.get_event_list ()
|
2004-02-14 11:10:30 +05:30
|
|
|
addresses = person.get_address_list ()
|
2004-07-28 07:59:07 +05:30
|
|
|
if (len (event_handles) + len (addresses) + len (names)) > 0:
|
2003-07-18 19:13:13 +05:30
|
|
|
paras.append ((self.doc.start_paragraph, ['AR-SubEntry']))
|
2003-06-14 06:46:30 +05:30
|
|
|
paras.append ((self.doc.write_text,
|
2003-07-22 17:23:04 +05:30
|
|
|
[_("More about %(name)s:") %
|
2003-07-22 17:10:03 +05:30
|
|
|
{'name': self.first_name_or_nick (person)}]))
|
2003-06-14 06:46:30 +05:30
|
|
|
paras.append ((self.doc.end_paragraph, []))
|
|
|
|
|
2003-07-17 16:24:41 +05:30
|
|
|
for name in names:
|
2003-07-18 19:13:13 +05:30
|
|
|
paras.append ((self.doc.start_paragraph, ['AR-Details']))
|
2003-07-23 19:22:17 +05:30
|
|
|
paras.append ((self.doc.write_text,
|
2004-02-14 11:10:30 +05:30
|
|
|
[const.NameTypesMap.find_value(name.get_type ()) +
|
|
|
|
': ' + name.get_regular_name ()]))
|
2003-07-17 16:24:41 +05:30
|
|
|
paras.append ((self.doc.end_paragraph, []))
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
for event_handle in [person.get_birth_handle (), person.get_death_handle ()]:
|
|
|
|
if not event_handle:
|
2004-04-25 10:18:02 +05:30
|
|
|
continue
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
event = self.database.get_event_from_handle(event_handle)
|
2004-02-14 11:10:30 +05:30
|
|
|
note = event.get_note ()
|
|
|
|
note_format = event.get_note_format ()
|
2003-12-17 16:54:23 +05:30
|
|
|
if note and (note_format != 0):
|
|
|
|
paras.append ((self.doc.write_note, [note, format,
|
|
|
|
'AR-Details']))
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
for event_handle in event_handles:
|
|
|
|
if not event_handle:
|
2004-04-25 10:18:02 +05:30
|
|
|
continue
|
* src/AddSpouse.py, src/ChooseParents.py, src/EditPerson.py,
src/EditPlace.py, src/EditSource.py, src/EventEdit.py,
src/FamilyView.py, src/GenericFilter.py,
src/Marriage.py, src/PedView.py, src/PeopleModel.py,
src/PlaceView.py, src/RelLib.py, src/SelectChild.py,
src/Sort.py, src/SourceView.py, src/SubstKeywords.py,
src/WriteGedcom.py, src/WriteXML.py, src/plugins/AncestorReport.py,
src/plugins/Ancestors.py, src/plugins/ChangeTypes.py,
src/plugins/DescendReport.py, src/plugins/DetDescendantReport.py,
src/plugins/EventCmp.py, src/plugins/FamilyGroup.py,
src/plugins/FanChart.py, src/plugins/FtmStyleAncestors.py,
src/plugins/FtmStyleDescendants.py, src/plugins/GraphViz.py,
src/plugins/IndivComplete.py, src/plugins/IndivSummary.py,
src/plugins/Merge.py, src/plugins/RelCalc.py, src/plugins/RelGraph.py,
src/plugins/Summary.py, src/plugins/TimeLine.py, src/plugins/Verify.py,
src/plugins/WebPage.py, src/plugins/WriteCD.py,
src/plugins/WritePkg.py, src/plugins/DetAncestralReport.py:
Use get_event_from_handle (not find_ ).
svn: r3462
2004-08-22 00:26:01 +05:30
|
|
|
event = self.database.get_event_from_handle(event_handle)
|
2003-07-18 19:13:13 +05:30
|
|
|
paras.append ((self.doc.start_paragraph, ['AR-Details']))
|
2003-06-14 06:46:30 +05:30
|
|
|
paras.append ((self.doc.write_text, [self.event_info (event)]))
|
|
|
|
paras.append ((self.doc.end_paragraph, []))
|
2004-02-14 11:10:30 +05:30
|
|
|
note = event.get_note ()
|
|
|
|
note_format = event.get_note_format ()
|
2003-12-17 16:54:23 +05:30
|
|
|
if note and (note_format != 0):
|
|
|
|
paras.append ((self.doc.write_note, [note, format,
|
|
|
|
'AR-Details']))
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-07-17 15:30:53 +05:30
|
|
|
for address in addresses:
|
2003-07-18 19:13:13 +05:30
|
|
|
paras.append ((self.doc.start_paragraph, ['AR-Details']))
|
2003-07-17 15:30:53 +05:30
|
|
|
paras.append ((self.doc.write_text, [self.address_info (address)]))
|
|
|
|
paras.append ((self.doc.end_paragraph, []))
|
|
|
|
|
2003-06-14 06:46:30 +05:30
|
|
|
return paras
|
|
|
|
|
2003-07-06 04:40:43 +05:30
|
|
|
def _make_default_style(default_style):
|
2003-07-17 15:30:53 +05:30
|
|
|
"""Make the default output style for the Comprehensive Ancestors report."""
|
2003-09-02 06:17:09 +05:30
|
|
|
font = BaseDoc.FontStyle()
|
|
|
|
font.set(face=BaseDoc.FONT_SANS_SERIF,size=16,bold=1,italic=1)
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
2003-06-14 06:46:30 +05:30
|
|
|
para.set_font(font)
|
|
|
|
para.set_header_level(1)
|
2003-09-02 06:17:09 +05:30
|
|
|
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
|
2003-06-14 06:46:30 +05:30
|
|
|
para.set(pad=0.5)
|
|
|
|
para.set_description(_('The style used for the title of the page.'))
|
2003-07-18 19:13:13 +05:30
|
|
|
default_style.add_style("AR-Title",para)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
font = BaseDoc.FontStyle()
|
|
|
|
font.set(face=BaseDoc.FONT_SANS_SERIF,size=14,italic=1)
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
2003-06-14 06:46:30 +05:30
|
|
|
para.set_font(font)
|
|
|
|
para.set_header_level(2)
|
|
|
|
para.set(pad=0.5)
|
2003-09-02 06:17:09 +05:30
|
|
|
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
|
2003-06-14 06:46:30 +05:30
|
|
|
para.set_description(_('The style used for the generation header.'))
|
2003-07-18 19:13:13 +05:30
|
|
|
default_style.add_style("AR-Heading",para)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
para = BaseDoc.ParagraphStyle()
|
2003-06-14 06:46:30 +05:30
|
|
|
para.set(lmargin=1.0,pad=0.25)
|
|
|
|
para.set_description(_('The basic style used for the text display.'))
|
2003-07-18 19:13:13 +05:30
|
|
|
default_style.add_style("AR-Entry",para)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
para = BaseDoc.ParagraphStyle ()
|
2003-06-30 20:26:32 +05:30
|
|
|
para.set_description(_('Text style for missing photo.'))
|
2003-07-18 19:13:13 +05:30
|
|
|
default_style.add_style("AR-NoPhotoText", para)
|
2003-06-30 20:26:32 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
details_font = BaseDoc.FontStyle()
|
|
|
|
details_font.set(face=BaseDoc.FONT_SANS_SERIF,size=8,italic=1)
|
|
|
|
para = BaseDoc.ParagraphStyle()
|
2003-07-20 17:49:12 +05:30
|
|
|
para.set(lmargin=2.7,pad=0,font = details_font)
|
2003-06-14 06:46:30 +05:30
|
|
|
para.set_description(_('Style for details about a person.'))
|
2003-07-18 19:13:13 +05:30
|
|
|
default_style.add_style("AR-Details",para)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
para = BaseDoc.ParagraphStyle()
|
2003-07-20 17:49:12 +05:30
|
|
|
para.set(lmargin=2.5,pad=0.25)
|
2003-06-14 06:46:30 +05:30
|
|
|
para.set_description(_('The basic style used for the text display.'))
|
2003-07-20 17:49:12 +05:30
|
|
|
para.set_header_level (4)
|
2003-07-18 19:13:13 +05:30
|
|
|
default_style.add_style("AR-SubEntry",para)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
para = BaseDoc.ParagraphStyle()
|
2003-06-14 06:46:30 +05:30
|
|
|
para.set(pad=0.05)
|
|
|
|
para.set_description(_('The basic style used for the text display.'))
|
2003-07-18 19:13:13 +05:30
|
|
|
default_style.add_style("AR-Endnotes",para)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-09-02 06:17:09 +05:30
|
|
|
para = BaseDoc.ParagraphStyle()
|
2003-07-20 17:49:12 +05:30
|
|
|
para.set(lmargin=1.0,pad=0.05)
|
2003-06-14 06:46:30 +05:30
|
|
|
para.set_description(_('Introduction to the children.'))
|
2003-07-20 17:49:12 +05:30
|
|
|
para.set_header_level (3)
|
2003-07-18 19:13:13 +05:30
|
|
|
default_style.add_style("AR-ChildTitle",para)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2003-07-17 15:30:53 +05:30
|
|
|
class ComprehensiveAncestorsReportDialog(Report.TextReportDialog):
|
2003-10-31 06:50:58 +05:30
|
|
|
|
|
|
|
report_options = {}
|
|
|
|
|
2003-06-14 06:46:30 +05:30
|
|
|
def __init__(self,database,person):
|
2003-10-31 06:50:58 +05:30
|
|
|
Report.TextReportDialog.__init__(self,database,person,self.report_options)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Customization hooks
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
def doc_uses_tables (self):
|
|
|
|
return 1
|
|
|
|
|
|
|
|
def get_title(self):
|
|
|
|
"""The window title for this dialog"""
|
2003-07-17 15:30:53 +05:30
|
|
|
return "%s - %s - GRAMPS" % (_("Comprehensive Ancestors Report"),
|
|
|
|
_("Text Reports"))
|
2003-06-14 06:46:30 +05:30
|
|
|
|
|
|
|
def get_header(self, name):
|
|
|
|
"""The header line at the top of the dialog contents"""
|
|
|
|
return _("Ancestors for %s") % name
|
|
|
|
|
|
|
|
def get_target_browser_title(self):
|
|
|
|
"""The title of the window created when the 'browse' button is
|
|
|
|
clicked in the 'Save As' frame."""
|
|
|
|
return _("Save Ancestor Report")
|
|
|
|
|
|
|
|
def get_stylesheet_savefile(self):
|
|
|
|
"""Where to save styles for this report."""
|
|
|
|
return "ancestors_report.xml"
|
|
|
|
|
|
|
|
def make_default_style(self):
|
2003-07-06 04:40:43 +05:30
|
|
|
_make_default_style(self.default_style)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-06-27 16:48:58 +05:30
|
|
|
def add_user_options (self):
|
|
|
|
self.cb_cite = gtk.CheckButton (_("Cite sources"))
|
|
|
|
self.cb_cite.set_active (gtk.TRUE)
|
|
|
|
self.add_option ('', self.cb_cite)
|
|
|
|
|
|
|
|
def parse_report_options_frame (self):
|
|
|
|
# Call base class
|
|
|
|
Report.ReportDialog.parse_report_options_frame (self)
|
|
|
|
self.opt_cite = self.cb_cite.get_active ()
|
|
|
|
|
2003-06-14 06:46:30 +05:30
|
|
|
def make_report(self):
|
2003-07-17 15:30:53 +05:30
|
|
|
|
|
|
|
"""Create the object that will produce the Comprehensive
|
|
|
|
Ancestors Report. All user dialog has already been handled
|
|
|
|
and the output file opened."""
|
2003-06-14 06:46:30 +05:30
|
|
|
try:
|
2003-07-17 15:30:53 +05:30
|
|
|
MyReport = ComprehensiveAncestorsReport(self.db, self.person,
|
|
|
|
self.max_gen, self.pg_brk,
|
|
|
|
self.opt_cite, self.doc,
|
|
|
|
self.target_path)
|
2003-06-14 06:46:30 +05:30
|
|
|
MyReport.write_report()
|
|
|
|
except Errors.ReportError, msg:
|
|
|
|
(m1,m2) = msg.messages()
|
|
|
|
ErrorDialog(m1,m2)
|
|
|
|
except Errors.FilterError, msg:
|
|
|
|
(m1,m2) = msg.messages()
|
|
|
|
ErrorDialog(m1,m2)
|
|
|
|
except:
|
|
|
|
import DisplayTrace
|
|
|
|
DisplayTrace.DisplayTrace()
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Standalone report function
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
def report(database,person):
|
2003-07-17 15:30:53 +05:30
|
|
|
ComprehensiveAncestorsReportDialog(database,person)
|
2003-06-14 06:46:30 +05:30
|
|
|
|
2003-07-06 04:40:43 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Set up sane defaults for the book_item
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
_style_file = "ancestors_report.xml"
|
|
|
|
_style_name = "default"
|
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
_person_handle = ""
|
2003-07-06 04:40:43 +05:30
|
|
|
_max_gen = 10
|
|
|
|
_pg_brk = 0
|
2004-03-10 07:44:00 +05:30
|
|
|
_opt_cite = 1
|
2003-07-06 04:40:43 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
_options = ( _person_handle, _max_gen, _pg_brk, _opt_cite )
|
2003-07-06 04:40:43 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Book Item Options dialog
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2003-07-17 15:30:53 +05:30
|
|
|
class ComprehensiveAncestorsBareReportDialog(Report.BareReportDialog):
|
2003-07-06 04:40:43 +05:30
|
|
|
|
|
|
|
def __init__(self,database,person,opt,stl):
|
|
|
|
|
|
|
|
self.options = opt
|
|
|
|
self.db = database
|
|
|
|
if self.options[0]:
|
2004-08-07 10:46:57 +05:30
|
|
|
self.person = self.db.get_person_from_handle(self.options[0])
|
2003-07-06 04:40:43 +05:30
|
|
|
else:
|
|
|
|
self.person = person
|
2003-07-11 08:59:33 +05:30
|
|
|
self.style_name = stl
|
|
|
|
|
2003-07-06 04:40:43 +05:30
|
|
|
Report.BareReportDialog.__init__(self,database,self.person)
|
|
|
|
|
|
|
|
self.max_gen = int(self.options[1])
|
|
|
|
self.pg_brk = int(self.options[2])
|
|
|
|
self.opt_cite = int(self.options[3])
|
|
|
|
self.new_person = None
|
|
|
|
|
|
|
|
self.generations_spinbox.set_value(self.max_gen)
|
|
|
|
self.pagebreak_checkbox.set_active(self.pg_brk)
|
|
|
|
self.cb_cite.set_active(self.opt_cite)
|
|
|
|
|
|
|
|
self.window.run()
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Customization hooks
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2003-07-07 22:27:27 +05:30
|
|
|
def make_default_style(self):
|
|
|
|
_make_default_style(self.default_style)
|
|
|
|
|
2003-07-06 04:40:43 +05:30
|
|
|
def get_title(self):
|
|
|
|
"""The window title for this dialog"""
|
2003-07-17 15:30:53 +05:30
|
|
|
return "%s - GRAMPS Book" % (_("Comprehensive Ancestors Report"))
|
2003-07-06 04:40:43 +05:30
|
|
|
|
|
|
|
def get_header(self, name):
|
|
|
|
"""The header line at the top of the dialog contents"""
|
2003-07-17 15:30:53 +05:30
|
|
|
return _("Comprehensive Ancestors Report for GRAMPS Book")
|
2003-07-06 04:40:43 +05:30
|
|
|
|
|
|
|
def get_stylesheet_savefile(self):
|
|
|
|
"""Where to save styles for this report."""
|
|
|
|
return _style_file
|
|
|
|
|
|
|
|
def add_user_options (self):
|
|
|
|
self.cb_cite = gtk.CheckButton (_("Cite sources"))
|
|
|
|
self.add_option ('', self.cb_cite)
|
|
|
|
|
|
|
|
def parse_report_options_frame (self):
|
|
|
|
# Call base class
|
|
|
|
Report.BareReportDialog.parse_report_options_frame (self)
|
|
|
|
self.opt_cite = self.cb_cite.get_active ()
|
|
|
|
|
|
|
|
def on_cancel(self, obj):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def on_ok_clicked(self, obj):
|
|
|
|
"""The user is satisfied with the dialog choices. Parse all options
|
|
|
|
and close the window."""
|
|
|
|
|
|
|
|
# Preparation
|
|
|
|
self.parse_style_frame()
|
|
|
|
self.parse_report_options_frame()
|
|
|
|
|
|
|
|
if self.new_person:
|
|
|
|
self.person = self.new_person
|
2004-07-28 07:59:07 +05:30
|
|
|
self.options = ( self.person.get_handle(), self.max_gen, self.pg_brk, self.opt_cite )
|
2003-07-06 04:40:43 +05:30
|
|
|
self.style_name = self.selected_style.get_name()
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Function to write Book Item
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
def write_book_item(database,person,doc,options,newpage=0):
|
2003-07-17 15:30:53 +05:30
|
|
|
"""Write the Comprehensive Ancestors Report using options set.
|
2003-07-06 04:40:43 +05:30
|
|
|
All user dialog has already been handled and the output file opened."""
|
|
|
|
try:
|
|
|
|
if options[0]:
|
2004-08-07 10:46:57 +05:30
|
|
|
person = database.get_person_from_handle(options[0])
|
2003-07-06 04:40:43 +05:30
|
|
|
max_gen = int(options[1])
|
|
|
|
pg_brk = int(options[2])
|
|
|
|
opt_cite = int(options[3])
|
2003-07-17 15:30:53 +05:30
|
|
|
return ComprehensiveAncestorsReport(database, person,
|
2003-07-06 04:40:43 +05:30
|
|
|
max_gen, pg_brk, opt_cite, doc, None, newpage)
|
|
|
|
except Errors.ReportError, msg:
|
|
|
|
(m1,m2) = msg.messages()
|
|
|
|
ErrorDialog(m1,m2)
|
|
|
|
except Errors.FilterError, msg:
|
|
|
|
(m1,m2) = msg.messages()
|
|
|
|
ErrorDialog(m1,m2)
|
|
|
|
except:
|
|
|
|
import DisplayTrace
|
|
|
|
DisplayTrace.DisplayTrace()
|
|
|
|
|
2003-06-14 06:46:30 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2004-05-14 04:15:51 +05:30
|
|
|
Plugins.register_report(
|
2003-06-14 06:46:30 +05:30
|
|
|
report,
|
2003-07-17 15:30:53 +05:30
|
|
|
_("Comprehensive Ancestors Report"),
|
2003-06-14 06:46:30 +05:30
|
|
|
category=_("Text Reports"),
|
|
|
|
status=(_("Beta")),
|
|
|
|
description= _("Produces a detailed ancestral report."),
|
|
|
|
author_name="Tim Waugh",
|
|
|
|
author_email="twaugh@redhat.com"
|
|
|
|
)
|
2003-07-06 04:40:43 +05:30
|
|
|
|
|
|
|
# (name,category,options_dialog,write_book_item,options,style_name,style_file,make_default_style)
|
2004-05-14 04:15:51 +05:30
|
|
|
Plugins.register_book_item(
|
2003-07-17 15:30:53 +05:30
|
|
|
_("Comprehensive Ancestors Report"),
|
2003-07-06 04:40:43 +05:30
|
|
|
_("Text"),
|
2003-07-17 15:30:53 +05:30
|
|
|
ComprehensiveAncestorsBareReportDialog,
|
2003-07-06 04:40:43 +05:30
|
|
|
write_book_item,
|
|
|
|
_options,
|
|
|
|
_style_name,
|
|
|
|
_style_file,
|
|
|
|
_make_default_style
|
|
|
|
)
|