* src/plugins/IndivComplete.py: Convert to db interface.
* src/plugins/DescendReport.py: Convert to db interface. * src/plugins/DetAncestralReport.py: Convert to db interface. svn: r3110
This commit is contained in:
parent
3bcd45ccfc
commit
162ca85ba0
@ -1,3 +1,8 @@
|
|||||||
|
2004-04-25 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
|
* src/plugins/IndivComplete.py: Convert to db interface.
|
||||||
|
* src/plugins/DescendReport.py: Convert to db interface.
|
||||||
|
* src/plugins/DetAncestralReport.py: Convert to db interface.
|
||||||
|
|
||||||
2004-04-24 Alex Roitman <shura@alex.neuro.umn.edu>
|
2004-04-24 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
* src/docgen/RTFDoc.py: Typo.
|
* src/docgen/RTFDoc.py: Typo.
|
||||||
* src/Utils.py (get_xpm_image): Add function.
|
* src/Utils.py (get_xpm_image): Add function.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000-2003 Donald N. Allingham
|
# Copyright (C) 2000-2004 Donald N. Allingham
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -18,6 +18,8 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# $Id$
|
||||||
|
|
||||||
"Generate files/Descendant Report"
|
"Generate files/Descendant Report"
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
@ -36,7 +38,8 @@ import sort
|
|||||||
import Report
|
import Report
|
||||||
import BaseDoc
|
import BaseDoc
|
||||||
import Errors
|
import Errors
|
||||||
|
import Date
|
||||||
|
from Utils import get_xpm_image
|
||||||
from QuestionDialog import ErrorDialog
|
from QuestionDialog import ErrorDialog
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
@ -58,6 +61,7 @@ _DIED = _('d.')
|
|||||||
class DescendantReport:
|
class DescendantReport:
|
||||||
|
|
||||||
def __init__(self,database,person,max,pgbrk,doc,output,newpage=0):
|
def __init__(self,database,person,max,pgbrk,doc,output,newpage=0):
|
||||||
|
self.database = database
|
||||||
self.creator = database.get_researcher().get_name()
|
self.creator = database.get_researcher().get_name()
|
||||||
self.name = output
|
self.name = output
|
||||||
self.person = person
|
self.person = person
|
||||||
@ -73,16 +77,28 @@ class DescendantReport:
|
|||||||
self.standalone = 0
|
self.standalone = 0
|
||||||
|
|
||||||
def dump_dates(self, person):
|
def dump_dates(self, person):
|
||||||
birth = person.get_birth().get_date_object().get_start_date()
|
birth_id = person.get_birth_id()
|
||||||
death = person.get_death().get_date_object().get_start_date()
|
if birth_id:
|
||||||
if birth.getYearValid() or death.getYearValid():
|
birth = self.database.find_event_from_id(birth_id).get_date_object().get_start_date()
|
||||||
|
birth_year_valid = birth.get_year_valid()
|
||||||
|
else:
|
||||||
|
birth_year_valid = 0
|
||||||
|
|
||||||
|
death_id = person.get_death_id()
|
||||||
|
if death_id:
|
||||||
|
death = self.database.find_event_from_id(death_id).get_date_object().get_start_date()
|
||||||
|
death_year_valid = death.get_year_valid()
|
||||||
|
else:
|
||||||
|
death_year_valid = 0
|
||||||
|
|
||||||
|
if birth_year_valid or death_year_valid:
|
||||||
self.doc.write_text(' (')
|
self.doc.write_text(' (')
|
||||||
if birth.getYearValid():
|
if birth_year_valid:
|
||||||
self.doc.write_text("%s %d" % (_BORN,birth.getYear()))
|
self.doc.write_text("%s %d" % (_BORN,birth.get_year()))
|
||||||
if death.getYearValid():
|
if death_year_valid:
|
||||||
if birth.getYearValid():
|
if birth_year_valid:
|
||||||
self.doc.write_text(', ')
|
self.doc.write_text(', ')
|
||||||
self.doc.write_text("%s %d" % (_DIED,death.getYear()))
|
self.doc.write_text("%s %d" % (_DIED,death.get_year()))
|
||||||
self.doc.write_text(')')
|
self.doc.write_text(')')
|
||||||
|
|
||||||
def write_report(self):
|
def write_report(self):
|
||||||
@ -110,14 +126,38 @@ class DescendantReport:
|
|||||||
return
|
return
|
||||||
|
|
||||||
childlist = []
|
childlist = []
|
||||||
for family in person.get_family_id_list():
|
for family_id in person.get_family_id_list():
|
||||||
for child in family.get_child_id_list():
|
family = self.database.find_family_from_id(family_id)
|
||||||
childlist.append(child)
|
for child_id in family.get_child_id_list():
|
||||||
|
childlist.append(child_id)
|
||||||
|
|
||||||
childlist.sort(sort.by_birthdate)
|
childlist.sort(self.by_birthdate)
|
||||||
for child in childlist:
|
for child_id in childlist:
|
||||||
|
child = self.database.find_person_from_id(child_id)
|
||||||
self.dump(level+1,child)
|
self.dump(level+1,child)
|
||||||
|
|
||||||
|
def by_birthdate(self, first_id, second_id) :
|
||||||
|
"""Sort routine for comparing two people by birth dates.
|
||||||
|
If the birth dates are equal, sorts by name"""
|
||||||
|
first = self.database.find_person_from_id(first_id)
|
||||||
|
second = self.database.find_person_from_id(second_id)
|
||||||
|
birth1_id = first.get_birth_id()
|
||||||
|
if birth1_id:
|
||||||
|
date1 = self.database.find_event_from_id(birth1_id).get_date_object()
|
||||||
|
else:
|
||||||
|
date1 = Date.Date()
|
||||||
|
|
||||||
|
birth2_id = second.get_birth_id()
|
||||||
|
if birth2_id:
|
||||||
|
date2 = self.database.find_event_from_id(birth2_id).get_date_object()
|
||||||
|
else:
|
||||||
|
date2 = Date.Date()
|
||||||
|
|
||||||
|
val = Date.compare_dates(date1,date2)
|
||||||
|
if val == 0:
|
||||||
|
return sort.by_last_name(first,second)
|
||||||
|
return val
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# DescendantReportDialog
|
# DescendantReportDialog
|
||||||
@ -301,96 +341,6 @@ def _make_default_style(default_style):
|
|||||||
p.set_description(_("The style used for the level %d display.") % i)
|
p.set_description(_("The style used for the level %d display.") % i)
|
||||||
default_style.add_style("DR-Level%d" % i,p)
|
default_style.add_style("DR-Level%d" % i,p)
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#------------------------------------------------------------------------
|
|
||||||
def get_xpm_image():
|
|
||||||
return [
|
|
||||||
"48 48 33 1",
|
|
||||||
" c None",
|
|
||||||
". c #1A1A1A",
|
|
||||||
"+ c #6A665E",
|
|
||||||
"@ c #A6A6A6",
|
|
||||||
"# c #BABAB6",
|
|
||||||
"$ c #E9D9C0",
|
|
||||||
"% c #E6E6E6",
|
|
||||||
"& c #7A7262",
|
|
||||||
"* c #867A6E",
|
|
||||||
"= c #C2C2BE",
|
|
||||||
"- c #5C5854",
|
|
||||||
"; c #898783",
|
|
||||||
"> c #EEEEEC",
|
|
||||||
", c #B2966E",
|
|
||||||
"' c #4E4E4E",
|
|
||||||
") c #BCA076",
|
|
||||||
"! c #FAFAFA",
|
|
||||||
"~ c #CECBC1",
|
|
||||||
"{ c #E2CBA5",
|
|
||||||
"] c #DAD6D1",
|
|
||||||
"^ c #D2D1D0",
|
|
||||||
"/ c #9E9286",
|
|
||||||
"( c #ECE1D1",
|
|
||||||
"_ c #423E3E",
|
|
||||||
": c #A29E96",
|
|
||||||
"< c #B7AC9A",
|
|
||||||
"[ c #DAD2C6",
|
|
||||||
"} c #E6E2E2",
|
|
||||||
"| c #E1DFDC",
|
|
||||||
"1 c #322E2A",
|
|
||||||
"2 c #E6D2B6",
|
|
||||||
"3 c #F5F2EF",
|
|
||||||
"4 c #F1EADE",
|
|
||||||
" ",
|
|
||||||
" ",
|
|
||||||
" ;*;*****&&&+&++++---+& ",
|
|
||||||
" *##############<#<:;--& ",
|
|
||||||
" *#!!!!!!!!!!!!!!4}^#;;/' ",
|
|
||||||
" ;#!!!!!!!!!!!!!!!3}^@&~/_ ",
|
|
||||||
" *#!!!!!!!!!!!!!!!!3}^-%~;1 ",
|
|
||||||
" *#!!!!@@@@@@@@@@@@@@@'!}~;1 ",
|
|
||||||
" *#!!!!!!!!!!!!!!!!3!3'!!}~;1 ",
|
|
||||||
" *#!!!!!!!!!!!!!!!!!!!'4!!|~;_ ",
|
|
||||||
" *#!!!!3!!!!!!!!!!!!!!'}4!!}~/' ",
|
|
||||||
" &#!!!!@@:@:@:@:@@@!!3'~}3!!}#/+ ",
|
|
||||||
" &#!!!!!!!!!!!!!!!!!!!'..1_'-&*+& ",
|
|
||||||
" *#!!!!!!!!@@@@@:@@@@%!3#@:;*+-_+ ",
|
|
||||||
" &#!!!!!!!!!!!!!!!!!!!!>|~=:;;*'_ ",
|
|
||||||
" &#!!!!!!!!@:@@@@:@@@^|>%^~#::;+_ ",
|
|
||||||
" &#!!!!!!!!!!!!!!!!!!!!3%>^~#@:&1 ",
|
|
||||||
" &#!!!!!!!!@@@@@@@@@@%>3%|~^~#@*1 ",
|
|
||||||
" &<!!!!!!!!!!!!!!!!!!33!3>>]=~<;1 ",
|
|
||||||
" +#!!!!@@@@@:@@@:@]%33>>>>>[~~~;1 ",
|
|
||||||
" +#!!!!!!!!!!!!!!!!!33333>}^[=#;1 ",
|
|
||||||
" +#!!!!!!!!@@@@@@:@@@]>>>44]2{[/1 ",
|
|
||||||
" +#!!!!!!!!!!!!!!!33333444}(([~/1 ",
|
|
||||||
" +#!!!!33!3@@@@@@:@::]}|}||[2^{:1 ",
|
|
||||||
" +#!!!!!!!!!!!!!!>3333>4}44$[2~,1 ",
|
|
||||||
" +#!!!!!!!!33!>@@@@@@@@@@^}|${[/1 ",
|
|
||||||
" +#!!!!!!!!!!!!33334444(((44$2[,1 ",
|
|
||||||
" -#!!!!3333333%:::::::::/]||$2^,1 ",
|
|
||||||
" +#!!!!!!!!!3333>>44|(((((4($2{:1 ",
|
|
||||||
" -#!!!!!!!!:@@:::::::~]}}|$$$22,1 ",
|
|
||||||
" +#!!!!!!!!33333(44}44(44((($22/1 ",
|
|
||||||
" -#!!!!@@@:@::::::]}|||$||$]222)1 ",
|
|
||||||
" -#!!!!!33333(>4}444((($$$22222,1 ",
|
|
||||||
" -#!!!!!!!!::::::/://]$$$$($2{2,1 ",
|
|
||||||
" -#!!!333333444|((((($$$$[2$22{)1 ",
|
|
||||||
" -#!!!33334::/:::////[[]$2$22{{)1 ",
|
|
||||||
" '#!33333334}(((((($$$2222$22{{,1 ",
|
|
||||||
" -#33333333:::///////{2[{2[{{{{)1 ",
|
|
||||||
" '#3333%44}4((4(($$$$2222222{{{,1 ",
|
|
||||||
" '#33334444(((((2$$222222{{{{{{,1 ",
|
|
||||||
" '<334444((((($$$2$222{{2{{{{{{,1 ",
|
|
||||||
" -@3444444((($4$$$$2222{{{{{{{{,1 ",
|
|
||||||
" '#4444(((4$($$$$2$2${2{{{{{{{{,1 ",
|
|
||||||
" '<##<<<<<<<)))<)))))),,,,,,,,,,1 ",
|
|
||||||
" 11111111111111111111111111.11111 ",
|
|
||||||
" ",
|
|
||||||
" ",
|
|
||||||
" "]
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -74,13 +74,15 @@ class DetAncestorReport(Report.Report):
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
def filter(self,person,index):
|
def filter(self,person_id,index):
|
||||||
if person == None or index >= 2**self.max_generations:
|
if (not person_id) or (index >= 2**self.max_generations):
|
||||||
return
|
return
|
||||||
self.map[index] = person
|
self.map[index] = person_id
|
||||||
|
|
||||||
family = person.get_main_parents_family_id()
|
person = self.database.find_person_from_id(person_id)
|
||||||
if family != None:
|
family_id = person.get_main_parents_family_id()
|
||||||
|
if family_id:
|
||||||
|
family = self.database.find_family_from_id(family_id)
|
||||||
self.filter(family.get_father_id(),index*2)
|
self.filter(family.get_father_id(),index*2)
|
||||||
self.filter(family.get_mother_id(),(index*2)+1)
|
self.filter(family.get_mother_id(),(index*2)+1)
|
||||||
|
|
||||||
@ -109,15 +111,23 @@ class DetAncestorReport(Report.Report):
|
|||||||
NAME 0
|
NAME 0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
num_children= len(family.get_child_id_list())
|
num_children = len(family.get_child_id_list())
|
||||||
if num_children > 0:
|
if num_children > 0:
|
||||||
self.doc.start_paragraph("DAR-ChildTitle")
|
self.doc.start_paragraph("DAR-ChildTitle")
|
||||||
if family.get_mother_id() != None:
|
mother_id = family.get_mother_id()
|
||||||
mother= family.get_mother_id().get_primary_name().get_regular_name()
|
if mother_id:
|
||||||
else: mother= "unknown"
|
mother_obj = self.database.find_person_from_id(mother_id)
|
||||||
if family.get_father_id() != None:
|
mother = mother_obj.get_primary_name().get_regular_name()
|
||||||
father= family.get_father_id().get_primary_name().get_regular_name()
|
else:
|
||||||
else: father= "unknown"
|
mother = "unknown"
|
||||||
|
|
||||||
|
father_id = family.get_father_id()
|
||||||
|
if father_id:
|
||||||
|
father_obj = self.database.find_person_from_id(father_id)
|
||||||
|
father = father_obj.get_primary_name().get_regular_name()
|
||||||
|
else:
|
||||||
|
father = "unknown"
|
||||||
|
|
||||||
self.doc.start_bold()
|
self.doc.start_bold()
|
||||||
if num_children == 1:
|
if num_children == 1:
|
||||||
self.doc.write_text(_("Child of %s and %s is:") % (mother, father))
|
self.doc.write_text(_("Child of %s and %s is:") % (mother, father))
|
||||||
@ -125,80 +135,106 @@ class DetAncestorReport(Report.Report):
|
|||||||
self.doc.end_bold()
|
self.doc.end_bold()
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
for child in family.get_child_id_list():
|
for child_id in family.get_child_id_list():
|
||||||
self.doc.start_paragraph("DAR-ChildList")
|
self.doc.start_paragraph("DAR-ChildList")
|
||||||
name= child.get_primary_name().get_regular_name()
|
child = self.database.find_person_from_id(child_id)
|
||||||
birth= child.get_birth()
|
name = child.get_primary_name().get_regular_name()
|
||||||
death= child.get_death()
|
birth_id = child.get_birth_id()
|
||||||
|
death_id = child.get_death_id()
|
||||||
if rptOptions.childRef == reportOptions.Yes:
|
if rptOptions.childRef == reportOptions.Yes:
|
||||||
childID= child.get_id()
|
if self.prevGenIDs.get(child_id) != None:
|
||||||
if self.prevGenIDs.get(childID) != None:
|
name= "[" + str(self.prevGenIDs.get(child_id)) + "] "+ name
|
||||||
name= "[" + str(self.prevGenIDs.get(childID)) + "] "+ name
|
|
||||||
if birth.get_date() != "":
|
if birth_id:
|
||||||
if birth.get_place_name() != "":
|
birth = self.database.find_event_from_id(birth_id)
|
||||||
if death.get_date() != "":
|
else:
|
||||||
if death.get_place_name() != "":
|
birth = None
|
||||||
|
|
||||||
|
if death_id:
|
||||||
|
death = self.database.find_event_from_id(death_id)
|
||||||
|
else:
|
||||||
|
death = None
|
||||||
|
|
||||||
|
if birth and birth.get_date():
|
||||||
|
if birth.get_place_id():
|
||||||
|
bplace = self.database.find_place_from_id(birth.get_place_id()).get_title()
|
||||||
|
if death and death.get_date():
|
||||||
|
if death.get_place_id():
|
||||||
|
dplace = self.database.find_place_from_id(death.get_place_id()).get_title()
|
||||||
self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \
|
self.doc.write_text(_("- %s Born: %s %s Died: %s %s") % \
|
||||||
(name, birth.get_date(), birth.get_place_name(),
|
(name, birth.get_date(), bplace,
|
||||||
death.get_date(), death.get_place_name())) # f
|
death.get_date(), dplace)) # f
|
||||||
else:
|
else:
|
||||||
self.doc.write_text(_("- %s Born: %s %s Died: %s") % \
|
self.doc.write_text(_("- %s Born: %s %s Died: %s") % \
|
||||||
(name, birth.get_date(), birth.get_place_name(),
|
(name, birth.get_date(), bplace,
|
||||||
death.get_date())) # e
|
death.get_date())) # e
|
||||||
elif death.get_place_name() != "":
|
elif death and death.get_place_id():
|
||||||
self.doc.write_text(_("- %s Born: %s %s Died: %s") % \
|
dplace = self.database.find_place_from_id(death.get_place_id()).get_title()
|
||||||
(name, birth.get_date(), birth.get_place_name(),
|
self.doc.write_text(_("- %s Born: %s %s Died: %s") % \
|
||||||
death.get_place_name())) # d
|
(name, birth.get_date(), bplace,
|
||||||
else: self.doc.write_text(_("- %s Born: %s %s") % \
|
dplace)) # d
|
||||||
(name, birth.get_date(), birth.get_place_name())) # c
|
else:
|
||||||
|
self.doc.write_text(_("- %s Born: %s %s") % \
|
||||||
|
(name, birth.get_date(), bplace)) # c
|
||||||
else:
|
else:
|
||||||
if death.get_date() != "":
|
if death and death.get_date():
|
||||||
if death.get_place_name() != "":
|
if death.get_place_id():
|
||||||
|
dplace = self.database.find_place_from_id(death.get_place_id()).get_title()
|
||||||
self.doc.write_text(_("- %s Born: %s Died: %s %s") % \
|
self.doc.write_text(_("- %s Born: %s Died: %s %s") % \
|
||||||
(name, birth.get_date(), death.get_date(), \
|
(name, birth.get_date(), death.get_date(), \
|
||||||
death.get_place_name())) # b
|
dplace)) # b
|
||||||
else:
|
else:
|
||||||
self.doc.write_text(_("- %s Born: %s Died: %s") % \
|
self.doc.write_text(_("- %s Born: %s Died: %s") % \
|
||||||
(name, birth.get_date(), death.get_date())) # a
|
(name, birth.get_date(), death.get_date())) # a
|
||||||
elif death.get_place_name() != "":
|
elif death and death.get_place_id():
|
||||||
self.doc.write_text(_("- %s Born: %s Died: %s") % \
|
dplace = self.database.find_place_from_id(death.get_place_id()).get_title()
|
||||||
(name, birth.get_date(), death.get_place_name())) # 9
|
self.doc.write_text(_("- %s Born: %s Died: %s") % \
|
||||||
else: self.doc.write_text(_("- %s Born: %s") % \
|
(name, birth.get_date(), dplace)) # 9
|
||||||
(name, birth.get_date())) # 8
|
else:
|
||||||
|
self.doc.write_text(_("- %s Born: %s") % \
|
||||||
|
(name, birth.get_date())) # 8
|
||||||
else:
|
else:
|
||||||
if birth.get_place_name() != "":
|
if birth and birth.get_place_id():
|
||||||
if death.get_date() != "":
|
bplace = self.database.find_place_from_id(birth.get_place_id()).get_title()
|
||||||
if death.get_place_name() != "":
|
if death and death.get_date():
|
||||||
|
if death.get_place_id():
|
||||||
|
dplace = self.database.find_place_from_id(death.get_place_id()).get_title()
|
||||||
self.doc.write_text(_("- %s Born: %s Died: %s %s") % \
|
self.doc.write_text(_("- %s Born: %s Died: %s %s") % \
|
||||||
(name, birth.get_place_name(), \
|
(name, bplace, \
|
||||||
death.get_date(), death.get_place_name())) # 7
|
death.get_date(), dplace)) # 7
|
||||||
else:
|
else:
|
||||||
self.doc.write_text(_("- %s Born: %s Died: %s") % \
|
self.doc.write_text(_("- %s Born: %s Died: %s") % \
|
||||||
(name, birth.get_place_name(), death.get_date())) # 6
|
(name, bplace, death.get_date())) # 6
|
||||||
elif death.get_place_name() != "":
|
elif death and death.get_place_id():
|
||||||
self.doc.write_text(_("- %s Born: %s Died: %s") % \
|
dplace = self.database.find_place_from_id(death.get_place_id()).get_title()
|
||||||
(name, birth.get_place_name(), death.get_place_name())) # 5
|
self.doc.write_text(_("- %s Born: %s Died: %s") % \
|
||||||
else: self.doc.write_text(_("- %s Born: %s") % \
|
(name, bplace, dplace)) # 5
|
||||||
(name, birth.get_place_name())) # 4
|
else:
|
||||||
|
self.doc.write_text(_("- %s Born: %s") % \
|
||||||
|
(name, bplace)) # 4
|
||||||
else:
|
else:
|
||||||
if death.get_date() != "":
|
if death and death.get_date():
|
||||||
if death.get_place_name() != "":
|
if death.get_place_id():
|
||||||
|
dplace = self.database.find_place_from_id(death.get_place_id()).get_title()
|
||||||
self.doc.write_text(_("- %s Died: %s %s") % \
|
self.doc.write_text(_("- %s Died: %s %s") % \
|
||||||
(name, death.get_date(), death.get_place_name())) # 3
|
(name, death.get_date(), dplace)) # 3
|
||||||
else:
|
else:
|
||||||
self.doc.write_text(_("- %s Died: %s") % \
|
self.doc.write_text(_("- %s Died: %s") % \
|
||||||
(name, death.get_date())) # 2
|
(name, death.get_date())) # 2
|
||||||
elif death.get_place_name() != "":
|
elif death.get_place_id():
|
||||||
self.doc.write_text(_("- %s Died: %s") % \
|
dplace = self.database.find_place_from_id(death.get_place_id()).get_title()
|
||||||
(name, death.get_place_name())) # 1
|
self.doc.write_text(_("- %s Died: %s") % \
|
||||||
else: self.doc.write_text(_("- %s") % name) # 0
|
(name, dplace)) # 1
|
||||||
|
else:
|
||||||
|
self.doc.write_text(_("- %s") % name) # 0
|
||||||
|
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
def write_person(self, key, rptOptions):
|
def write_person(self, key, rptOptions):
|
||||||
"""Output birth, death, parentage, marriage and notes information """
|
"""Output birth, death, parentage, marriage and notes information """
|
||||||
|
|
||||||
person = self.map[key]
|
person_id = self.map[key]
|
||||||
|
person = self.database.find_person_from_id(person_id)
|
||||||
if rptOptions.addImages == reportOptions.Yes:
|
if rptOptions.addImages == reportOptions.Yes:
|
||||||
self.insert_images(person)
|
self.insert_images(person)
|
||||||
|
|
||||||
@ -222,17 +258,19 @@ class DetAncestorReport(Report.Report):
|
|||||||
keys = self.map.keys()
|
keys = self.map.keys()
|
||||||
keys.sort()
|
keys.sort()
|
||||||
for dkey in keys:
|
for dkey in keys:
|
||||||
if dkey >= key: break
|
if dkey >= key:
|
||||||
if self.map[key].get_id() == self.map[dkey].get_id():
|
break
|
||||||
|
if self.map[key] == self.map[dkey]:
|
||||||
self.doc.write_text(_(" is the same person as [%s].") % str(dkey))
|
self.doc.write_text(_(" is the same person as [%s].") % str(dkey))
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
return 1 # Duplicate person
|
return 1 # Duplicate person
|
||||||
|
|
||||||
# Check birth record
|
# Check birth record
|
||||||
birth = person.get_birth()
|
birth_id = person.get_birth_id()
|
||||||
if birth:
|
if birth_id:
|
||||||
self.write_birth(person, rptOptions)
|
self.write_birth(person, rptOptions)
|
||||||
self.write_death(person, firstName, rptOptions)
|
if person.get_death_id():
|
||||||
|
self.write_death(person, firstName, rptOptions)
|
||||||
self.write_parents(person, firstName)
|
self.write_parents(person, firstName)
|
||||||
self.write_marriage(person, rptOptions)
|
self.write_marriage(person, rptOptions)
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
@ -262,11 +300,12 @@ class DetAncestorReport(Report.Report):
|
|||||||
was born in ____________.
|
was born in ____________.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
birth = person.get_birth()
|
birth_id = person.get_birth_id()
|
||||||
if birth:
|
if birth_id:
|
||||||
|
birth = self.database.find_event_from_id(birth_id)
|
||||||
date = birth.get_date_object().get_start_date()
|
date = birth.get_date_object().get_start_date()
|
||||||
if birth.get_place_name() != "":
|
if birth.get_place_id():
|
||||||
place = birth.get_place_name()
|
place = self.database.find_place_from_id(birth.get_place_id()).get_title()
|
||||||
if place[-1:] == '.':
|
if place[-1:] == '.':
|
||||||
place = place[:-1]
|
place = place[:-1]
|
||||||
elif rptOptions.blankDate == reportOptions.Yes:
|
elif rptOptions.blankDate == reportOptions.Yes:
|
||||||
@ -274,18 +313,18 @@ class DetAncestorReport(Report.Report):
|
|||||||
else: place= ""
|
else: place= ""
|
||||||
|
|
||||||
if date.get_date() != "":
|
if date.get_date() != "":
|
||||||
if date.getDayValid() and date.getMonthValid() and \
|
if date.get_day_valid() and date.get_month_valid() and \
|
||||||
rptOptions.fullDate == reportOptions.Yes:
|
rptOptions.fullDate == reportOptions.Yes:
|
||||||
if place != "":
|
if place:
|
||||||
self.doc.write_text(_(" was born on %s in %s.") % (date.get_date(), place))
|
self.doc.write_text(_(" was born on %s in %s.") % (date.get_date(), place))
|
||||||
else:
|
else:
|
||||||
self.doc.write_text(_(" was born on %s.") % date.get_date())
|
self.doc.write_text(_(" was born on %s.") % date.get_date())
|
||||||
elif place != "":
|
elif place:
|
||||||
self.doc.write_text(_(" was born in the year %s in %s.") % \
|
self.doc.write_text(_(" was born in the year %s in %s.") % \
|
||||||
(date.getYear(), place))
|
(date.get_year(), place))
|
||||||
else:
|
else:
|
||||||
self.doc.write_text(_(" was born in the year %s.") % date.getYear())
|
self.doc.write_text(_(" was born in the year %s.") % date.get_year())
|
||||||
elif place != "":
|
elif place:
|
||||||
self.doc.write_text(_(" was born in %s.") % place)
|
self.doc.write_text(_(" was born in %s.") % place)
|
||||||
else:
|
else:
|
||||||
self.doc.write_text(_("."))
|
self.doc.write_text(_("."))
|
||||||
@ -320,35 +359,39 @@ class DetAncestorReport(Report.Report):
|
|||||||
.
|
.
|
||||||
"""
|
"""
|
||||||
t= ""
|
t= ""
|
||||||
death = person.get_death()
|
death_id = person.get_death_id()
|
||||||
if death != None:
|
if death_id:
|
||||||
|
death = self.database.find_event_from_id(death_id)
|
||||||
date = death.get_date_object().get_start_date()
|
date = death.get_date_object().get_start_date()
|
||||||
place = death.get_place_name()
|
if death.get_place_id():
|
||||||
if place[-1:] == '.':
|
place = self.database.find_place_from_id(death.get_place_id()).get_title()
|
||||||
place = place[:-1]
|
if place[-1:] == '.':
|
||||||
elif place == "" and rptOptions.blankPlace == reportOptions.Yes:
|
place = place[:-1]
|
||||||
|
elif rptOptions.blankPlace == reportOptions.Yes:
|
||||||
place= "_____________"
|
place= "_____________"
|
||||||
|
else:
|
||||||
|
place = ""
|
||||||
|
|
||||||
if date.get_date() != "":
|
if date.get_date():
|
||||||
if date.getDay() and date.getMonth() and \
|
if date.get_day() and date.get_month() and \
|
||||||
rptOptions.fullDate == reportOptions.Yes:
|
rptOptions.fullDate == reportOptions.Yes:
|
||||||
fulldate= date.get_date()
|
fulldate= date.get_date()
|
||||||
elif date.getMonth() and rptOptions.fullDate == reportOptions.Yes:
|
elif date.get_month() and rptOptions.fullDate == reportOptions.Yes:
|
||||||
fulldate= "%s %s" % (date.getMonth(), date.getYear())
|
fulldate= "%s %s" % (date.get_month(), date.get_year())
|
||||||
else: fulldate= ""
|
else: fulldate= ""
|
||||||
elif rptOptions.blankDate == reportOptions.Yes:
|
elif rptOptions.blankDate == reportOptions.Yes:
|
||||||
fulldate= "_____________"
|
fulldate= "_____________"
|
||||||
else: fulldate= ""
|
else: fulldate= ""
|
||||||
|
|
||||||
if fulldate != "":
|
if fulldate:
|
||||||
if place != "":
|
if place:
|
||||||
t= _(" %s died on %s in %s") % (firstName, fulldate, place)
|
t= _(" %s died on %s in %s") % (firstName, fulldate, place)
|
||||||
else: t= _(" %s died on %s") % (firstName, fulldate)
|
else: t= _(" %s died on %s") % (firstName, fulldate)
|
||||||
elif date.getYear() > 0:
|
elif date.get_year() > 0:
|
||||||
if place != "":
|
if place:
|
||||||
t= _(" %s died in %s in %s") % (firstName, date.getYear(), place)
|
t= _(" %s died in %s in %s") % (firstName, date.get_year(), place)
|
||||||
else: t= _(" %s died in %s") % (firstName, date.getYear())
|
else: t= _(" %s died in %s") % (firstName, date.get_year())
|
||||||
elif place != "":
|
elif place:
|
||||||
t= _(" %s died in %s") % (firstName, place)
|
t= _(" %s died in %s") % (firstName, place)
|
||||||
|
|
||||||
if rptOptions.calcAgeFlag == reportOptions.Yes:
|
if rptOptions.calcAgeFlag == reportOptions.Yes:
|
||||||
@ -356,13 +399,15 @@ class DetAncestorReport(Report.Report):
|
|||||||
|
|
||||||
if t != "":
|
if t != "":
|
||||||
self.doc.write_text(t)
|
self.doc.write_text(t)
|
||||||
else: return
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
t= ""
|
t= ""
|
||||||
famList= person.get_family_id_list()
|
famList = person.get_family_id_list()
|
||||||
if len(famList) > 0:
|
if len(famList) > 0:
|
||||||
for fam in famList:
|
for fam_id in famList:
|
||||||
buried= None
|
fam = self.database.find_family_from_id(fam_id)
|
||||||
|
buried = None
|
||||||
if buried:
|
if buried:
|
||||||
date = buried.get_date_object().get_start_date()
|
date = buried.get_date_object().get_start_date()
|
||||||
place = buried.get_place_name()
|
place = buried.get_place_name()
|
||||||
@ -398,19 +443,24 @@ class DetAncestorReport(Report.Report):
|
|||||||
FIRSTNAME is the daughter of FATHER.
|
FIRSTNAME is the daughter of FATHER.
|
||||||
FIRSTNAME is the daughter of MOTHER.
|
FIRSTNAME is the daughter of MOTHER.
|
||||||
"""
|
"""
|
||||||
ext_family= person.get_main_parents_family_id()
|
ext_family_id = person.get_main_parents_family_id()
|
||||||
if ext_family != None:
|
if ext_family_id:
|
||||||
if ext_family.get_father_id() != None:
|
ext_family = self.database.find_family_from_id(ext_family_id)
|
||||||
father= ext_family.get_father_id().get_primary_name().get_regular_name()
|
if ext_family.get_father_id():
|
||||||
else: father= ""
|
father_obj = self.database.find_person_from_id(ext_family.get_father_id())
|
||||||
if ext_family.get_mother_id() != None:
|
father = father_obj.get_primary_name().get_regular_name()
|
||||||
mother= ext_family.get_mother_id().get_primary_name().get_regular_name()
|
else:
|
||||||
else: mother= ""
|
father= ""
|
||||||
|
if ext_family.get_mother_id():
|
||||||
|
mother_obj = self.database.find_person_from_id(ext_family.get_mother_id())
|
||||||
|
mother = mother_obj.get_primary_name().get_regular_name()
|
||||||
|
else:
|
||||||
|
mother= ""
|
||||||
|
|
||||||
if father != "" or mother != "":
|
if father or mother:
|
||||||
if person.get_gender() == RelLib.Person.male:
|
if person.get_gender() == RelLib.Person.male:
|
||||||
if father != "":
|
if father:
|
||||||
if mother != "":
|
if mother:
|
||||||
self.doc.write_text(_(" %s is the son of %s and %s.") % \
|
self.doc.write_text(_(" %s is the son of %s and %s.") % \
|
||||||
(firstName, father, mother))
|
(firstName, father, mother))
|
||||||
else:
|
else:
|
||||||
@ -420,8 +470,8 @@ class DetAncestorReport(Report.Report):
|
|||||||
self.doc.write_text(_(" %s is the son of %s.") % \
|
self.doc.write_text(_(" %s is the son of %s.") % \
|
||||||
(firstName, mother))
|
(firstName, mother))
|
||||||
else:
|
else:
|
||||||
if father != "":
|
if father:
|
||||||
if mother != "":
|
if mother:
|
||||||
self.doc.write_text(_(" %s is the daughter of %s and %s.") % \
|
self.doc.write_text(_(" %s is the daughter of %s and %s.") % \
|
||||||
(firstName, father, mother))
|
(firstName, father, mother))
|
||||||
else:
|
else:
|
||||||
@ -446,13 +496,15 @@ class DetAncestorReport(Report.Report):
|
|||||||
if len(famList) > 0:
|
if len(famList) > 0:
|
||||||
fam_num= 0
|
fam_num= 0
|
||||||
endOfSent= ""
|
endOfSent= ""
|
||||||
for fam in famList:
|
for fam_id in famList:
|
||||||
|
fam = self.database.find_family_from_id(fam_id)
|
||||||
fam_num= fam_num + 1
|
fam_num= fam_num + 1
|
||||||
spouse= ""
|
spouse= ""
|
||||||
t= ""
|
t= ""
|
||||||
if person.get_gender() == RelLib.Person.male:
|
if person.get_gender() == RelLib.Person.male:
|
||||||
if fam.get_mother_id() != None:
|
if fam.get_mother_id():
|
||||||
spouse= fam.get_mother_id().get_primary_name().get_regular_name()
|
mother = self.database.find_person_from_id(fam.get_mother_id())
|
||||||
|
spouse = mother.get_primary_name().get_regular_name()
|
||||||
if fam_num == 1:
|
if fam_num == 1:
|
||||||
heshe= _("He")
|
heshe= _("He")
|
||||||
elif fam_num < len(famList):
|
elif fam_num < len(famList):
|
||||||
@ -465,45 +517,54 @@ class DetAncestorReport(Report.Report):
|
|||||||
heshe= _(",")
|
heshe= _(",")
|
||||||
else: heshe= _("and she")
|
else: heshe= _("and she")
|
||||||
|
|
||||||
if fam.get_father_id() != None:
|
if fam.get_father_id():
|
||||||
spouse= fam.get_father_id().get_primary_name().get_regular_name()
|
father = self.database.find_person_from_id(fam.get_father_id())
|
||||||
|
spouse = father.get_primary_name().get_regular_name()
|
||||||
|
|
||||||
marriage= fam.get_marriage()
|
for event_id in fam.get_event_list():
|
||||||
fulldate= ""
|
if event_id:
|
||||||
place= ""
|
event = self.database.find_event_from_id(event_id)
|
||||||
if marriage != None:
|
if event.get_name() == "Marriage":
|
||||||
if marriage.get_place_id() != None and \
|
marriage = event
|
||||||
marriage.get_place_name() != "":
|
break
|
||||||
place= marriage.get_place_name()
|
else:
|
||||||
|
marriage = None
|
||||||
|
|
||||||
|
fulldate = ""
|
||||||
|
place = ""
|
||||||
|
if marriage:
|
||||||
|
if marriage.get_place_id():
|
||||||
|
place = self.database.find_place_from_id(marriage.get_place_id()).get_title()
|
||||||
elif rptOptions.blankPlace == reportOptions.Yes:
|
elif rptOptions.blankPlace == reportOptions.Yes:
|
||||||
place= "____________"
|
place= "____________"
|
||||||
|
|
||||||
date= marriage.get_date_object()
|
date = marriage.get_date_object()
|
||||||
if date != None:
|
if date:
|
||||||
if date.getYearValid():
|
if date.get_year_valid():
|
||||||
if date.getDayValid() and date.getMonthValid() and \
|
if date.get_day_valid() and date.get_month_valid() and \
|
||||||
rptOptions.fullDate == reportOptions.Yes:
|
rptOptions.fullDate == reportOptions.Yes:
|
||||||
fulldate= date.get_date()
|
fulldate= date.get_date()
|
||||||
elif rptOptions.blankDate == reportOptions.Yes:
|
elif rptOptions.blankDate == reportOptions.Yes:
|
||||||
fulldate= "__________"
|
fulldate= "__________"
|
||||||
|
|
||||||
if spouse != "":
|
if spouse:
|
||||||
if fulldate == "" and place == "":
|
if not fulldate and not place:
|
||||||
t= _(" %s married %s") % (heshe, spouse)
|
t= _(" %s married %s") % (heshe, spouse)
|
||||||
elif fulldate == "" and place != "":
|
elif not fulldate and place:
|
||||||
t= _(" %s married %s in %s") % (heshe, spouse, place)
|
t= _(" %s married %s in %s") % (heshe, spouse, place)
|
||||||
elif fulldate != "" and place == "":
|
elif fulldate and not place:
|
||||||
t= _(" %s married %s on %s") % (heshe, spouse, fulldate)
|
t= _(" %s married %s on %s") % (heshe, spouse, fulldate)
|
||||||
else: t= _(" %s married %s on %s in %s") % \
|
else:
|
||||||
|
t= _(" %s married %s on %s in %s") % \
|
||||||
(heshe, spouse, fulldate, place)
|
(heshe, spouse, fulldate, place)
|
||||||
else:
|
else:
|
||||||
if fulldate == "" and place == "":
|
if not fulldate and not place:
|
||||||
t= _(" %s married") % heshe
|
t= _(" %s married") % heshe
|
||||||
elif fulldate == "" and place != "":
|
elif not fulldate and place:
|
||||||
t= _(" %s married in %s") % (heshe, place)
|
t= _(" %s married in %s") % (heshe, place)
|
||||||
elif fulldate != "" and place == "":
|
elif fulldate and not place:
|
||||||
t= _(" %s married on %s") % (heshe, fulldate)
|
t= _(" %s married on %s") % (heshe, fulldate)
|
||||||
elif fulldate != "" and place != "":
|
elif fulldate and place:
|
||||||
t= _(" %s married on %s in %s") % \
|
t= _(" %s married on %s in %s") % \
|
||||||
(heshe, fulldate, place)
|
(heshe, fulldate, place)
|
||||||
|
|
||||||
@ -515,24 +576,27 @@ class DetAncestorReport(Report.Report):
|
|||||||
def write_mate(self, mate, rptOptions):
|
def write_mate(self, mate, rptOptions):
|
||||||
"""Output birth, death, parentage, marriage and notes information """
|
"""Output birth, death, parentage, marriage and notes information """
|
||||||
|
|
||||||
famList= mate.get_family_id_list()
|
famList = mate.get_family_id_list()
|
||||||
if len(famList) > 0:
|
if len(famList) > 0:
|
||||||
for fam in famList:
|
for fam_id in famList:
|
||||||
|
fam = self.database.find_family_from_id(fam_id)
|
||||||
person= ""
|
person= ""
|
||||||
if mate.get_gender() == RelLib.Person.male:
|
if mate.get_gender() == RelLib.Person.male:
|
||||||
if fam.get_mother_id() != None:
|
if fam.get_mother_id():
|
||||||
ind= fam.get_mother_id()
|
ind_id= fam.get_mother_id()
|
||||||
person= fam.get_mother_id().get_primary_name().get_regular_name()
|
ind = self.database.find_person_from_id(ind_id)
|
||||||
firstName= fam.get_mother_id().get_primary_name().get_first_name()
|
person = ind.get_primary_name().get_regular_name()
|
||||||
heshe= _("She")
|
firstName = ind.get_primary_name().get_first_name()
|
||||||
|
heshe = _("She")
|
||||||
else:
|
else:
|
||||||
heshe= _("He")
|
heshe= _("He")
|
||||||
if fam.get_father_id() != None:
|
if fam.get_father_id():
|
||||||
ind= fam.get_father_id()
|
ind_id = fam.get_father_id()
|
||||||
person= fam.get_father_id().get_primary_name().get_regular_name()
|
ind = self.database.find_person_from_id(ind_id)
|
||||||
firstName= fam.get_father_id().get_primary_name().get_first_name()
|
person = ind.get_primary_name().get_regular_name()
|
||||||
|
firstName = ind.get_primary_name().get_first_name()
|
||||||
|
|
||||||
if person != "":
|
if person:
|
||||||
if rptOptions.addImages == reportOptions.Yes:
|
if rptOptions.addImages == reportOptions.Yes:
|
||||||
self.insert_images(ind)
|
self.insert_images(ind)
|
||||||
|
|
||||||
@ -579,7 +643,7 @@ class DetAncestorReport(Report.Report):
|
|||||||
if self.newpage:
|
if self.newpage:
|
||||||
self.doc.page_break()
|
self.doc.page_break()
|
||||||
|
|
||||||
self.filter(self.start,1)
|
self.filter(self.start.get_id(),1)
|
||||||
#rptOpt= reportOptions()
|
#rptOpt= reportOptions()
|
||||||
rptOpt = self.rptOpt
|
rptOpt = self.rptOpt
|
||||||
|
|
||||||
@ -607,14 +671,16 @@ class DetAncestorReport(Report.Report):
|
|||||||
self.prevGenIDs= self.genIDs.copy()
|
self.prevGenIDs= self.genIDs.copy()
|
||||||
self.genIDs.clear()
|
self.genIDs.clear()
|
||||||
|
|
||||||
person = self.map[key]
|
person_id = self.map[key]
|
||||||
self.genIDs[person.get_id()]= key
|
person = self.database.find_person_from_id(person_id)
|
||||||
|
self.genIDs[person_id]= key
|
||||||
dupPerson= self.write_person(key, rptOpt)
|
dupPerson= self.write_person(key, rptOpt)
|
||||||
if dupPerson == 0: # Is this a duplicate ind record
|
if dupPerson == 0: # Is this a duplicate ind record
|
||||||
if person.get_gender() == RelLib.Person.female and \
|
if person.get_gender() == RelLib.Person.female and \
|
||||||
rptOpt.listChildren == reportOptions.Yes and \
|
rptOpt.listChildren == reportOptions.Yes and \
|
||||||
len(person.get_family_id_list()) > 0:
|
len(person.get_family_id_list()) > 0:
|
||||||
family= person.get_family_id_list()[0]
|
family_id = person.get_family_id_list()[0]
|
||||||
|
family = self.database.find_family_from_id(family_id)
|
||||||
self.write_children(family, rptOpt)
|
self.write_children(family, rptOpt)
|
||||||
|
|
||||||
#if rptOpt.addImages == reportOptions.Yes:
|
#if rptOpt.addImages == reportOptions.Yes:
|
||||||
@ -691,6 +757,7 @@ class DetAncestorReportDialog(Report.TextReportDialog):
|
|||||||
|
|
||||||
def __init__(self,database,person):
|
def __init__(self,database,person):
|
||||||
Report.TextReportDialog.__init__(self,database,person,self.report_options)
|
Report.TextReportDialog.__init__(self,database,person,self.report_options)
|
||||||
|
self.database = database
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -862,7 +929,7 @@ class DetAncestorReportDialog(Report.TextReportDialog):
|
|||||||
else:
|
else:
|
||||||
self.addImages = reportOptions.No
|
self.addImages = reportOptions.No
|
||||||
|
|
||||||
rptOpt = reportOptions()
|
rptOpt = reportOptions(self.database)
|
||||||
rptOpt.firstName= self.firstName
|
rptOpt.firstName= self.firstName
|
||||||
rptOpt.fullDate= self.fullDate
|
rptOpt.fullDate= self.fullDate
|
||||||
rptOpt.listChildren= self.listChildren
|
rptOpt.listChildren= self.listChildren
|
||||||
@ -1114,7 +1181,7 @@ def write_book_item(database,person,doc,options,newpage=0):
|
|||||||
person = database.get_person(options[0])
|
person = database.get_person(options[0])
|
||||||
max_gen = int(options[1])
|
max_gen = int(options[1])
|
||||||
pg_brk = int(options[2])
|
pg_brk = int(options[2])
|
||||||
rptOpt = reportOptions()
|
rptOpt = reportOptions(database)
|
||||||
rptOpt.firstName = int(options[3])
|
rptOpt.firstName = int(options[3])
|
||||||
rptOpt.fullDate = int(options[4])
|
rptOpt.fullDate = int(options[4])
|
||||||
rptOpt.listChildren = int(options[5])
|
rptOpt.listChildren = int(options[5])
|
||||||
@ -1236,7 +1303,8 @@ class reportOptions:
|
|||||||
Yes = 1
|
Yes = 1
|
||||||
No = 0
|
No = 0
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self,database):
|
||||||
|
self.database = database
|
||||||
### Initialize report options###
|
### Initialize report options###
|
||||||
|
|
||||||
#Use first name in place of he or she in text
|
#Use first name in place of he or she in text
|
||||||
@ -1304,26 +1372,36 @@ class reportOptions:
|
|||||||
null
|
null
|
||||||
"""
|
"""
|
||||||
|
|
||||||
birth= ind.get_birth().get_date_object().get_start_date()
|
birth_id = ind.get_birth_id()
|
||||||
death= ind.get_death().get_date_object().get_start_date()
|
if birth_id:
|
||||||
|
birth = self.database.find_event_from_id(birth_id).get_date_object().get_start_date()
|
||||||
|
birth_year_valid = birth.get_year_valid()
|
||||||
|
else:
|
||||||
|
birth_year_valid = None
|
||||||
|
death_id = ind.get_death_id()
|
||||||
|
if death_id:
|
||||||
|
death = self.database.find_event_from_id(death_id).get_date_object().get_start_date()
|
||||||
|
death_year_valid = death.get_year_valid()
|
||||||
|
else:
|
||||||
|
death_year_valid = None
|
||||||
self.t= ""
|
self.t= ""
|
||||||
if birth.getYearValid() and death.getYearValid():
|
if birth_year_valid and death_year_valid:
|
||||||
self.age= death.getYear() - birth.getYear()
|
self.age = death.get_year() - birth.get_year()
|
||||||
self.units= 3 # year
|
self.units= 3 # year
|
||||||
if birth.getMonthValid() and death.getMonthValid():
|
if birth.get_month_valid() and death.get_month_valid():
|
||||||
if birth.getMonth() > death.getMonth():
|
if birth.get_month() > death.get_month():
|
||||||
self.age= self.age -1
|
self.age = self.age -1
|
||||||
if birth.getDayValid() and death.getDayValid():
|
if birth.get_day_valid() and death.get_day_valid():
|
||||||
if birth.getMonth() == death.getMonth() and birth.getDay() > death.getDay():
|
if birth.get_month() == death.get_month() and birth.get_day() > death.get_day():
|
||||||
self.age= self.age -1
|
self.age = self.age -1
|
||||||
if self.age == 0:
|
if self.age == 0:
|
||||||
self.age= death.getMonth() - birth.getMonth() # calc age in months
|
self.age = death.get_month() - birth.get_month() # calc age in months
|
||||||
if birth.getDay() > death.getDay():
|
if birth.get_day() > death.get_day():
|
||||||
self.age= self.age - 1
|
self.age = self.age - 1
|
||||||
self.units= 2 # month
|
self.units= 2 # month
|
||||||
if self.age == 0:
|
if self.age == 0:
|
||||||
self.age= death.getDay() + 31 - birth.getDay() # calc age in days
|
self.age = death.get-day() + 31 - birth.get_day() # calc age in days
|
||||||
self.units= 1 # day
|
self.units = 1 # day
|
||||||
if self.age > 1:
|
if self.age > 1:
|
||||||
if self.units == 1:
|
if self.units == 1:
|
||||||
self.t= _(" at the age of %d days") % self.age
|
self.t= _(" at the age of %d days") % self.age
|
||||||
|
@ -39,6 +39,7 @@ import StyleEditor
|
|||||||
import Report
|
import Report
|
||||||
import GenericFilter
|
import GenericFilter
|
||||||
import Errors
|
import Errors
|
||||||
|
from Utils import get_xpm_image
|
||||||
from QuestionDialog import ErrorDialog
|
from QuestionDialog import ErrorDialog
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
@ -122,7 +123,11 @@ class IndivComplete(Report.Report):
|
|||||||
return
|
return
|
||||||
name = _(event.get_name())
|
name = _(event.get_name())
|
||||||
date = event.get_date()
|
date = event.get_date()
|
||||||
place = event.get_place_name()
|
place_id = event.get_place_id()
|
||||||
|
if place_id:
|
||||||
|
place = self.database.find_place_from_id(place_id).get_title()
|
||||||
|
else:
|
||||||
|
place = ""
|
||||||
description = event.get_description()
|
description = event.get_description()
|
||||||
if date == "":
|
if date == "":
|
||||||
if place == "":
|
if place == "":
|
||||||
@ -141,7 +146,9 @@ class IndivComplete(Report.Report):
|
|||||||
self.normal_cell(name)
|
self.normal_cell(name)
|
||||||
if self.use_srcs:
|
if self.use_srcs:
|
||||||
for s in event.get_source_references():
|
for s in event.get_source_references():
|
||||||
text = "%s [%s]" % (text,s.get_base_id().get_id())
|
#src_id = s.get_base_id()
|
||||||
|
#src = self.database.find_source_from_id(src_id)
|
||||||
|
text = "%s [%s]" % (text,s.get_base_id())
|
||||||
self.slist.append(s)
|
self.slist.append(s)
|
||||||
self.normal_cell(text)
|
self.normal_cell(text)
|
||||||
self.d.end_row()
|
self.d.end_row()
|
||||||
@ -262,15 +269,17 @@ class IndivComplete(Report.Report):
|
|||||||
self.d.end_cell()
|
self.d.end_cell()
|
||||||
self.d.end_row()
|
self.d.end_row()
|
||||||
|
|
||||||
for family in self.person.get_family_id_list():
|
for family_id in self.person.get_family_id_list():
|
||||||
if self.person == family.get_father_id():
|
family = self.database.find_family_from_id(family_id)
|
||||||
spouse = family.get_mother_id()
|
if self.person.get_id() == family.get_father_id():
|
||||||
|
spouse_id = family.get_mother_id()
|
||||||
else:
|
else:
|
||||||
spouse = family.get_father_id()
|
spouse_id = family.get_father_id()
|
||||||
self.d.start_row()
|
self.d.start_row()
|
||||||
self.d.start_cell("IDS-NormalCell",2)
|
self.d.start_cell("IDS-NormalCell",2)
|
||||||
self.d.start_paragraph("IDS-Spouse")
|
self.d.start_paragraph("IDS-Spouse")
|
||||||
if spouse:
|
if spouse_id:
|
||||||
|
spouse = self.database.find_person_from_id(spouse_id)
|
||||||
text = spouse.get_primary_name().get_regular_name()
|
text = spouse.get_primary_name().get_regular_name()
|
||||||
else:
|
else:
|
||||||
text = _("unknown")
|
text = _("unknown")
|
||||||
@ -279,11 +288,13 @@ class IndivComplete(Report.Report):
|
|||||||
self.d.end_cell()
|
self.d.end_cell()
|
||||||
self.d.end_row()
|
self.d.end_row()
|
||||||
|
|
||||||
for event in family.get_event_list():
|
for event_id in family.get_event_list():
|
||||||
self.write_fact(event)
|
if event_id:
|
||||||
|
event = self.database.find_event_from_id(event_id)
|
||||||
|
self.write_fact(event)
|
||||||
|
|
||||||
child_list = family.get_child_id_list()
|
child_id_list = family.get_child_id_list()
|
||||||
if len(child_list) > 0:
|
if len(child_id_list) > 0:
|
||||||
self.d.start_row()
|
self.d.start_row()
|
||||||
self.normal_cell(_("Children"))
|
self.normal_cell(_("Children"))
|
||||||
|
|
||||||
@ -291,11 +302,12 @@ class IndivComplete(Report.Report):
|
|||||||
self.d.start_paragraph("IDS-Normal")
|
self.d.start_paragraph("IDS-Normal")
|
||||||
|
|
||||||
first = 1
|
first = 1
|
||||||
for child in family.get_child_id_list():
|
for child_id in child_id_list:
|
||||||
if first == 1:
|
if first == 1:
|
||||||
first = 0
|
first = 0
|
||||||
else:
|
else:
|
||||||
self.d.write_text('\n')
|
self.d.write_text('\n')
|
||||||
|
child = self.database.find_person_from_id(child_id)
|
||||||
self.d.write_text(child.get_primary_name().get_regular_name())
|
self.d.write_text(child.get_primary_name().get_regular_name())
|
||||||
self.d.end_paragraph()
|
self.d.end_paragraph()
|
||||||
self.d.end_cell()
|
self.d.end_cell()
|
||||||
@ -320,9 +332,10 @@ class IndivComplete(Report.Report):
|
|||||||
|
|
||||||
for source in self.slist:
|
for source in self.slist:
|
||||||
self.d.start_row()
|
self.d.start_row()
|
||||||
sname = source.get_base_id()
|
s_id = source.get_base_id()
|
||||||
self.normal_cell(sname.get_id())
|
self.normal_cell(s_id)
|
||||||
self.normal_cell(sname.get_title())
|
src = self.database.find_source_from_id(s_id)
|
||||||
|
self.normal_cell(src.get_title())
|
||||||
self.d.end_row()
|
self.d.end_row()
|
||||||
self.d.end_table()
|
self.d.end_table()
|
||||||
|
|
||||||
@ -336,10 +349,12 @@ class IndivComplete(Report.Report):
|
|||||||
self.d.end_cell()
|
self.d.end_cell()
|
||||||
self.d.end_row()
|
self.d.end_row()
|
||||||
|
|
||||||
event_list = [ self.person.get_birth(), self.person.get_death() ]
|
event_id_list = [ self.person.get_birth_id(), self.person.get_death_id() ]
|
||||||
event_list = event_list + self.person.get_event_list()
|
event_id_list = event_id_list + self.person.get_event_list()
|
||||||
for event in event_list:
|
for event_id in event_id_list:
|
||||||
self.write_fact(event)
|
if event_id:
|
||||||
|
event = self.database.find_event_from_id(event_id)
|
||||||
|
self.write_fact(event)
|
||||||
self.d.end_table()
|
self.d.end_table()
|
||||||
self.d.start_paragraph("IDS-Normal")
|
self.d.start_paragraph("IDS-Normal")
|
||||||
self.d.end_paragraph()
|
self.d.end_paragraph()
|
||||||
@ -355,14 +370,16 @@ class IndivComplete(Report.Report):
|
|||||||
if self.newpage:
|
if self.newpage:
|
||||||
self.d.page_break()
|
self.d.page_break()
|
||||||
|
|
||||||
plist = self.database.get_person_id_map().values()
|
#plist = self.database.get_person_id_map().values()
|
||||||
|
plist = self.database.get_person_keys()
|
||||||
if self.filter:
|
if self.filter:
|
||||||
ind_list = self.filter.apply(self.database,plist)
|
ind_list = self.filter.apply(self.database,plist)
|
||||||
else:
|
else:
|
||||||
ind_list = plist
|
ind_list = plist
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
for self.person in ind_list:
|
for person_id in ind_list:
|
||||||
|
self.person = self.database.find_person_from_id(person_id)
|
||||||
self.write_person(count)
|
self.write_person(count)
|
||||||
count = count + 1
|
count = count + 1
|
||||||
self.end()
|
self.end()
|
||||||
@ -399,7 +416,7 @@ class IndivComplete(Report.Report):
|
|||||||
if self.use_srcs:
|
if self.use_srcs:
|
||||||
for s in name.get_source_references():
|
for s in name.get_source_references():
|
||||||
self.slist.append(s)
|
self.slist.append(s)
|
||||||
text = "%s [%s]" % (text,s.get_base_id().get_id())
|
text = "%s [%s]" % (text,s.get_base_id())
|
||||||
self.normal_cell(text)
|
self.normal_cell(text)
|
||||||
self.d.end_row()
|
self.d.end_row()
|
||||||
|
|
||||||
@ -411,15 +428,18 @@ class IndivComplete(Report.Report):
|
|||||||
self.normal_cell(_("Female"))
|
self.normal_cell(_("Female"))
|
||||||
self.d.end_row()
|
self.d.end_row()
|
||||||
|
|
||||||
family = self.person.get_main_parents_family_id()
|
family_id = self.person.get_main_parents_family_id()
|
||||||
if family:
|
if family_id:
|
||||||
father_inst = family.get_father_id()
|
family = self.database.find_family_from_id(family_id)
|
||||||
if father_inst:
|
father_inst_id = family.get_father_id()
|
||||||
|
if father_inst_id:
|
||||||
|
father_inst = self.database.find_person_from_id(father_inst_id)
|
||||||
father = father_inst.get_primary_name().get_regular_name()
|
father = father_inst.get_primary_name().get_regular_name()
|
||||||
else:
|
else:
|
||||||
father = ""
|
father = ""
|
||||||
mother_inst = family.get_mother_id()
|
mother_inst_id = family.get_mother_id()
|
||||||
if mother_inst:
|
if mother_inst_id:
|
||||||
|
mother_inst = self.database.find_person_from_id(mother_inst_id)
|
||||||
mother = mother_inst.get_primary_name().get_regular_name()
|
mother = mother_inst.get_primary_name().get_regular_name()
|
||||||
else:
|
else:
|
||||||
mother = ""
|
mother = ""
|
||||||
@ -719,96 +739,6 @@ def _get_report_filters(person):
|
|||||||
|
|
||||||
return [filt_id,des,ans,all]
|
return [filt_id,des,ans,all]
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#------------------------------------------------------------------------
|
|
||||||
def get_xpm_image():
|
|
||||||
return [
|
|
||||||
"48 48 33 1",
|
|
||||||
" c None",
|
|
||||||
". c #312D2A",
|
|
||||||
"+ c #4773AA",
|
|
||||||
"@ c #A8A7A5",
|
|
||||||
"# c #BABAB6",
|
|
||||||
"$ c #CECECE",
|
|
||||||
"% c #ECDECB",
|
|
||||||
"& c #5C5C60",
|
|
||||||
"* c #7C7262",
|
|
||||||
"= c #F2EADE",
|
|
||||||
"- c #867A6F",
|
|
||||||
"; c #8E887E",
|
|
||||||
"> c #E2CAA2",
|
|
||||||
", c #565354",
|
|
||||||
"' c #4C4E51",
|
|
||||||
") c #6D655E",
|
|
||||||
"! c #B69970",
|
|
||||||
"~ c #F6F2EE",
|
|
||||||
"{ c #9E9286",
|
|
||||||
"] c #416CA3",
|
|
||||||
"^ c #3D4557",
|
|
||||||
"/ c #A29E96",
|
|
||||||
"( c #FAFAFA",
|
|
||||||
"_ c #BA7458",
|
|
||||||
": c #C67C5E",
|
|
||||||
"< c #BDA37E",
|
|
||||||
"[ c #CECABE",
|
|
||||||
"} c #A26E62",
|
|
||||||
"| c #E6E2E2",
|
|
||||||
"1 c #423E43",
|
|
||||||
"2 c #966A60",
|
|
||||||
"3 c #D2D2D2",
|
|
||||||
"4 c #E5D2B8",
|
|
||||||
" ",
|
|
||||||
" ",
|
|
||||||
" ;-;-----***)*))))&,&)* ",
|
|
||||||
" -##############@#@/;&,* ",
|
|
||||||
" -#((((((((((((((=|$#;;{, ",
|
|
||||||
" ;#(((((((((((((((~|3/*[{1 ",
|
|
||||||
" -#((((((((((((((((~|3,|[;. ",
|
|
||||||
" -#((((((((@/@@@@@@/@/'(|[;. ",
|
|
||||||
" -#((((((((((((((((((~'((|[;. ",
|
|
||||||
" -#(((((((((((]+]+]]+('=((|[;1 ",
|
|
||||||
" -#(((((((((((]+]}2&+('|=((|[{, ",
|
|
||||||
" *#(((((((((((]+}<:-+('[|~((|#{) ",
|
|
||||||
" *#(((((((((((+]2_:)+('...1'&*-)* ",
|
|
||||||
" -#(((((((((((]&1(_&+(3@#//--)&1) ",
|
|
||||||
" *#~((((((((((+]1}/^]((|$##/;--'1 ",
|
|
||||||
" *#(((((((((((]]^)11,(((|$[#@/;)1 ",
|
|
||||||
" *#(((((((((((]^.^^&&((~=|$[#@/*. ",
|
|
||||||
" *#(((((((((((((~(((((((|$[$[#/-. ",
|
|
||||||
" *#~(((((((((((((((((~~~~||$[[@;. ",
|
|
||||||
" )#((((@@@@@@/@@/@/@@@@///{;[[[;. ",
|
|
||||||
" )#(((((((((((((((((~~~~==|$$[#;. ",
|
|
||||||
" )#((((@/@@/@@@@@@@@@//////{4>3{. ",
|
|
||||||
" )#(((((((((((((((~~~~==|=||%$[{. ",
|
|
||||||
" )#((((@@@@@/@@@///////////{43>/. ",
|
|
||||||
" )#((((((((((((((~~~~~==|||%>4[!. ",
|
|
||||||
" )#((((@/@@@@@//~~~~======%%%43{. ",
|
|
||||||
" )#((((((((((((~~~~=|==||=%%%44!. ",
|
|
||||||
" ,#((((@@/@@/@/@////////{/{{%4$!. ",
|
|
||||||
" )#~((((((((~~~~~~==||%=%=%%44>/. ",
|
|
||||||
" ,#((((/@@//@///////////{{{{%4>!. ",
|
|
||||||
" )#((((((((~~~=~||=|%%%%%4%%%44{. ",
|
|
||||||
" ,#((((@@@/@/////////{{{{{{{444!. ",
|
|
||||||
" &#(((((~~~~~|~|||%%|%%%%44444%!. ",
|
|
||||||
" ,#(((~/@//////////{{{{{{;{;4>4!. ",
|
|
||||||
" ,#(((~~~~=~|==|%|=%%%4%%44444>!. ",
|
|
||||||
" &#(((~//////////{{{{{{{;{;{4>><. ",
|
|
||||||
" ,#(~~~~~~==||%|%%%%%%44444>4>>!. ",
|
|
||||||
" '#~~~~///////{{{{{{{;!;{;;;>>>!. ",
|
|
||||||
" ,#~~~~||=||%|%=%%4%444>44>>>>>!. ",
|
|
||||||
" '#~~~~====%=%=%4%%444444>>>>>>!. ",
|
|
||||||
" '@~~====|%=%%%%%4%444>>4>>>>>>!. ",
|
|
||||||
" ,@~======%%%%%%>%%4444>>>>>>>>!. ",
|
|
||||||
" '#====||=%%%%4%44444>4>>>>>>>>!. ",
|
|
||||||
" ,@##@<#<<#@<<<<<<<<<<!<!!:!!!!!. ",
|
|
||||||
" ................................ ",
|
|
||||||
" ",
|
|
||||||
" ",
|
|
||||||
" "]
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user