* src/SubstKeywords.py (__init__): Convert to db.
* src/plugins/AncestorChart.py: Convert to db. * src/plugins/AncestorChart2.py: Convert to db. * src/GraphLayout.py: Convert to db. * src/plugins/DesGraph.py: Convert to db. * src/plugins/FanChart.py: Convert to db. * src/Sort.py: Add converted sort.py to CVS. * src/sort.py: Remove file (obsolete). * src/plugins/TimeLine.py: Convert to db. svn: r3127
This commit is contained in:
parent
1c2b7bce2c
commit
c7fa1403b3
@ -14,6 +14,16 @@
|
|||||||
* src/plugins/IndivSummary.py (get_xpm_image): Remove
|
* src/plugins/IndivSummary.py (get_xpm_image): Remove
|
||||||
function, import it from Utils.py instead; Convert to db.
|
function, import it from Utils.py instead; Convert to db.
|
||||||
|
|
||||||
|
* src/SubstKeywords.py (__init__): Convert to db.
|
||||||
|
* src/plugins/AncestorChart.py: Convert to db.
|
||||||
|
* src/plugins/AncestorChart2.py: Convert to db.
|
||||||
|
* src/GraphLayout.py: Convert to db.
|
||||||
|
* src/plugins/DesGraph.py: Convert to db.
|
||||||
|
* src/plugins/FanChart.py: Convert to db.
|
||||||
|
* src/Sort.py: Add converted sort.py to CVS.
|
||||||
|
* src/sort.py: Remove file (obsolete).
|
||||||
|
* src/plugins/TimeLine.py: Convert to db.
|
||||||
|
|
||||||
2004-05-03 Alex Roitman <shura@alex.neuro.umn.edu>
|
2004-05-03 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
* src/plugins/DetDescendantReport.py: Convert to db interface.
|
* src/plugins/DetDescendantReport.py: Convert to db interface.
|
||||||
* src/plugins/DetAncestralReport.py: Translate string.
|
* src/plugins/DetAncestralReport.py: Translate string.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000 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,11 +18,14 @@
|
|||||||
# 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$
|
||||||
|
|
||||||
class GraphLayout:
|
class GraphLayout:
|
||||||
|
|
||||||
def __init__(self,plist,person):
|
def __init__(self,database,plist,person_id):
|
||||||
|
self.database = database
|
||||||
self.plist = plist
|
self.plist = plist
|
||||||
self.person = person
|
self.person_id = person_id
|
||||||
self.v = []
|
self.v = []
|
||||||
self.e = []
|
self.e = []
|
||||||
self.maxx = 0
|
self.maxx = 0
|
||||||
@ -38,33 +41,37 @@ class DescendLine(GraphLayout):
|
|||||||
|
|
||||||
def layout(self):
|
def layout(self):
|
||||||
self.elist = [(0,0)]
|
self.elist = [(0,0)]
|
||||||
self.space_for(self.person)
|
self.space_for(self.person_id)
|
||||||
return (self.v,self.e[1:])
|
return (self.v,self.e[1:])
|
||||||
|
|
||||||
def space_for(self,person,level=1.0,pos=1.0):
|
def space_for(self,person_id,level=1.0,pos=1.0):
|
||||||
last = self.elist[-1]
|
last = self.elist[-1]
|
||||||
self.elist.append((level,pos))
|
self.elist.append((level,pos))
|
||||||
self.e.append((last[0],last[1],level,pos))
|
self.e.append((last[0],last[1],level,pos))
|
||||||
self.v.append((person,level,pos))
|
self.v.append((person_id,level,pos))
|
||||||
if level > self.maxx:
|
if level > self.maxx:
|
||||||
self.maxx = level
|
self.maxx = level
|
||||||
if pos > self.maxy:
|
if pos > self.maxy:
|
||||||
self.maxy = pos
|
self.maxy = pos
|
||||||
|
|
||||||
for family in person.get_family_id_list():
|
person = self.database.find_person_from_id(person_id)
|
||||||
for child in family.get_child_id_list():
|
for family_id in person.get_family_id_list():
|
||||||
self.space_for(child,level+1.0,pos)
|
family = self.database.find_family_from_id(family_id)
|
||||||
pos = pos + max(self.depth(child),1)
|
for child_id in family.get_child_id_list():
|
||||||
|
self.space_for(child_id,level+1.0,pos)
|
||||||
|
pos = pos + max(self.depth(child_id),1)
|
||||||
if pos > self.maxy:
|
if pos > self.maxy:
|
||||||
self.maxy = pos
|
self.maxy = pos
|
||||||
self.elist.pop()
|
self.elist.pop()
|
||||||
|
|
||||||
def depth(self,person,val=0):
|
def depth(self,person_id,val=0):
|
||||||
for family in person.get_family_id_list():
|
person = self.database.find_person_from_id(person_id)
|
||||||
|
for family_id in person.get_family_id_list():
|
||||||
|
family = self.database.find_family_from_id(family_id)
|
||||||
clist = family.get_child_id_list()
|
clist = family.get_child_id_list()
|
||||||
val = val + len(clist)
|
val = val + len(clist)
|
||||||
for child in clist:
|
for child_id in clist:
|
||||||
d=self.depth(child)
|
d = self.depth(child_id)
|
||||||
if d > 0:
|
if d > 0:
|
||||||
val = val + d - 1 #first child is always on the same
|
val = val + d - 1 #first child is always on the same
|
||||||
return val #row as the parent, so subtract 1
|
return val #row as the parent, so subtract 1
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000 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
|
||||||
@ -17,6 +17,9 @@
|
|||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# 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$
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Provides sorting routines for use in GRAMPS. Since these functions are
|
Provides sorting routines for use in GRAMPS. Since these functions are
|
||||||
intended to provide fast sorting, they tend to bypass access methods,
|
intended to provide fast sorting, they tend to bypass access methods,
|
||||||
@ -68,9 +71,17 @@ def build_sort_date(n):
|
|||||||
d = 99
|
d = 99
|
||||||
return "%04d%02d%02d" % (y,m,d)
|
return "%04d%02d%02d" % (y,m,d)
|
||||||
|
|
||||||
def by_last_name(first, second):
|
class Sort:
|
||||||
|
def __init__(self,database):
|
||||||
|
self.database = database
|
||||||
|
|
||||||
|
|
||||||
|
def by_last_name(self,first_id,second_id):
|
||||||
"""Sort routine for comparing two last names. If last names are equal,
|
"""Sort routine for comparing two last names. If last names are equal,
|
||||||
uses the given name and suffix"""
|
uses the given name and suffix"""
|
||||||
|
first = self.database.find_person_from_id(first_id)
|
||||||
|
second = self.database.find_person_from_id(second_id)
|
||||||
|
|
||||||
name1 = first.get_primary_name()
|
name1 = first.get_primary_name()
|
||||||
name2 = second.get_primary_name()
|
name2 = second.get_primary_name()
|
||||||
|
|
||||||
@ -80,19 +91,32 @@ def by_last_name(first, second):
|
|||||||
if fsn == ssn :
|
if fsn == ssn :
|
||||||
ffn = name1.get_first_name().upper()
|
ffn = name1.get_first_name().upper()
|
||||||
sfn = name2.get_first_name().upper()
|
sfn = name2.get_first_name().upper()
|
||||||
if ffn == sfn :
|
if ffn == sfn:
|
||||||
return cmp(name1.get_suffix().upper(), name2.get_suffix().upper())
|
return cmp(name1.get_suffix().upper(), name2.get_suffix().upper())
|
||||||
else :
|
else:
|
||||||
return cmp(ffn, sfn)
|
return cmp(ffn, sfn)
|
||||||
else :
|
else:
|
||||||
return cmp(fsn, ssn)
|
return cmp(fsn, ssn)
|
||||||
|
|
||||||
def by_birthdate(first, second) :
|
def by_birthdate(self,first_id,second_id):
|
||||||
"""Sort routine for comparing two people by birth dates. If the birth dates
|
"""Sort routine for comparing two people by birth dates. If the birth dates
|
||||||
are equal, sorts by name"""
|
are equal, sorts by name"""
|
||||||
date1 = first.get_birth().get_date_object()
|
first = self.database.find_person_from_id(first_id)
|
||||||
date2 = second.get_birth().get_date_object()
|
second = self.database.find_person_from_id(second_id)
|
||||||
|
|
||||||
|
birth_id1 = first.get_birth_id()
|
||||||
|
if birth_id1:
|
||||||
|
date1 = self.database.find_event_from_id(birth_id1).get_date_object()
|
||||||
|
else:
|
||||||
|
date1 = Date.Date()
|
||||||
|
|
||||||
|
birth_id2 = second.get_birth_id()
|
||||||
|
if birth_id2:
|
||||||
|
date2 = self.database.find_event_from_id(birth_id2).get_date_object()
|
||||||
|
else:
|
||||||
|
date2 = Date.Date()
|
||||||
|
|
||||||
val = Date.compare_dates(date1,date2)
|
val = Date.compare_dates(date1,date2)
|
||||||
if val == 0:
|
if val == 0:
|
||||||
return by_last_name(first,second)
|
return self.by_last_name(first_id,second_id)
|
||||||
return val
|
return val
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2000 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$
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Provides the SubstKeywords class that will replace keywords in a passed
|
Provides the SubstKeywords class that will replace keywords in a passed
|
||||||
string with informatin about the person. For sample:
|
string with informatin about the person. For sample:
|
||||||
@ -63,36 +65,61 @@ class SubstKeywords:
|
|||||||
$M -> Place of preferred marriage
|
$M -> Place of preferred marriage
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,person):
|
def __init__(self,database,person_id):
|
||||||
"""Creates a new object and associates a person with it."""
|
"""Creates a new object and associates a person with it."""
|
||||||
|
|
||||||
|
person = database.find_person_from_id(person_id)
|
||||||
self.n = person.get_primary_name().get_regular_name()
|
self.n = person.get_primary_name().get_regular_name()
|
||||||
self.N = person.get_primary_name().get_name()
|
self.N = person.get_primary_name().get_name()
|
||||||
self.b = person.get_birth().get_date()
|
self.b = ""
|
||||||
self.d = person.get_death().get_date()
|
self.B = ""
|
||||||
self.B = person.get_birth().get_place_name()
|
self.d = ""
|
||||||
self.D = person.get_death().get_place_name()
|
self.D = ""
|
||||||
self.i = str(person.get_id())
|
|
||||||
|
|
||||||
self.s = ""
|
self.s = ""
|
||||||
self.S = ""
|
self.S = ""
|
||||||
self.m = ""
|
self.m = ""
|
||||||
self.M = ""
|
self.M = ""
|
||||||
|
|
||||||
|
birth_id = person.get_birth_id()
|
||||||
|
if birth_id:
|
||||||
|
birth = database.find_event_from_id(birth_id)
|
||||||
|
self.b = birth.get_date()
|
||||||
|
bplace_id = birth.get_place_id()
|
||||||
|
if bplace_id:
|
||||||
|
self.B = database.find_place_from_id(bplace_id).get_title()
|
||||||
|
death_id = person.get_death_id()
|
||||||
|
if death_id:
|
||||||
|
death = database.find_event_from_id(death_id)
|
||||||
|
self.d = death.get_date()
|
||||||
|
dplace_id = death.get_place_id()
|
||||||
|
if dplace_id:
|
||||||
|
self.D = database.find_place_from_id(dplace_id).get_title()
|
||||||
|
self.i = str(person_id)
|
||||||
|
|
||||||
if person.get_family_id_list():
|
if person.get_family_id_list():
|
||||||
f = person.get_family_id_list()[0]
|
f_id = person.get_family_id_list()[0]
|
||||||
if f.get_father_id() == person:
|
f = database.find_family_from_id(f_id)
|
||||||
if f.get_mother_id():
|
father_id = f.get_father_id()
|
||||||
self.s = f.get_mother_id().get_primary_name().get_regular_name()
|
mother_id = f.get_mother_id
|
||||||
self.S = f.get_mother_id().get_primary_name().get_name()
|
if father_id == person_id:
|
||||||
|
if mother_id:
|
||||||
|
mother = database.find_person_from_id(mother_id)
|
||||||
|
self.s = mother.get_primary_name().get_regular_name()
|
||||||
|
self.S = mother.get_primary_name().get_name()
|
||||||
else:
|
else:
|
||||||
if f.get_father_id():
|
if father_id:
|
||||||
self.s = f.get_father_id().get_primary_name().get_regular_name()
|
father = database.find_person_from_id(father_id)
|
||||||
self.S = f.get_father_id().get_primary_name().get_name()
|
self.s = father.get_primary_name().get_regular_name()
|
||||||
for e in f.get_event_list():
|
self.S = father.get_primary_name().get_name()
|
||||||
|
for e_id in f.get_event_list():
|
||||||
|
if not e_id:
|
||||||
|
continue
|
||||||
|
e = database.find_event_from_id(e_id)
|
||||||
if e.get_name() == 'Marriage':
|
if e.get_name() == 'Marriage':
|
||||||
self.m = e.get_date()
|
self.m = e.get_date()
|
||||||
self.M = e.get_place_name()
|
mplace_id = e.get_place_id()
|
||||||
|
if mplace_id:
|
||||||
|
self.M = database.find_place_from_id(mplace_id).get_title()
|
||||||
|
|
||||||
def replace(self,line):
|
def replace(self,line):
|
||||||
"""Returns a new line of text with the substitutions performed."""
|
"""Returns a new line of text with the substitutions performed."""
|
||||||
|
@ -49,6 +49,7 @@ import Errors
|
|||||||
import FontScale
|
import FontScale
|
||||||
from QuestionDialog import ErrorDialog
|
from QuestionDialog import ErrorDialog
|
||||||
from SubstKeywords import SubstKeywords
|
from SubstKeywords import SubstKeywords
|
||||||
|
from Utils import get_xpm_image
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
_BORN = _('b.')
|
_BORN = _('b.')
|
||||||
@ -70,6 +71,7 @@ def pt2cm(pt):
|
|||||||
class AncestorChart:
|
class AncestorChart:
|
||||||
|
|
||||||
def __init__(self,database,person,max,display,doc,output,newpage=0):
|
def __init__(self,database,person,max,display,doc,output,newpage=0):
|
||||||
|
self.database = database
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.doc.creator(database.get_researcher().get_name())
|
self.doc.creator(database.get_researcher().get_name())
|
||||||
self.map = {}
|
self.map = {}
|
||||||
@ -89,18 +91,18 @@ class AncestorChart:
|
|||||||
self.standalone = 0
|
self.standalone = 0
|
||||||
self.calc()
|
self.calc()
|
||||||
|
|
||||||
def filter(self,person,index):
|
def filter(self,person_id,index):
|
||||||
"""traverse the ancestors recursively until either the end
|
"""traverse the ancestors recursively until either the end
|
||||||
of a line is found, or until we reach the maximum number of
|
of a line is found, or until we reach the maximum number of
|
||||||
generations that we want to deal with"""
|
generations that we want to deal with"""
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
self.text[index] = []
|
self.text[index] = []
|
||||||
|
|
||||||
subst = SubstKeywords(person)
|
subst = SubstKeywords(self.database,person_id)
|
||||||
|
|
||||||
for line in self.display:
|
for line in self.display:
|
||||||
self.text[index].append(subst.replace(line))
|
self.text[index].append(subst.replace(line))
|
||||||
@ -111,8 +113,10 @@ class AncestorChart:
|
|||||||
|
|
||||||
self.lines = max(self.lines,len(self.text[index]))
|
self.lines = max(self.lines,len(self.text[index]))
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
@ -144,7 +148,7 @@ class AncestorChart:
|
|||||||
that and the page dimensions, calculate the proper place to put
|
that and the page dimensions, calculate the proper place to put
|
||||||
the elements on a page.
|
the elements on a page.
|
||||||
"""
|
"""
|
||||||
self.filter(self.start,1)
|
self.filter(self.start.get_id(),1)
|
||||||
|
|
||||||
self.height = self.lines*pt2cm((125.0*self.font.get_size())/100.0)
|
self.height = self.lines*pt2cm((125.0*self.font.get_size())/100.0)
|
||||||
self.box_width = pt2cm(self.box_width+20)
|
self.box_width = pt2cm(self.box_width+20)
|
||||||
@ -407,148 +411,6 @@ def write_book_item(database,person,doc,options,newpage=0):
|
|||||||
import DisplayTrace
|
import DisplayTrace
|
||||||
DisplayTrace.DisplayTrace()
|
DisplayTrace.DisplayTrace()
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#------------------------------------------------------------------------
|
|
||||||
def get_xpm_image():
|
|
||||||
return [
|
|
||||||
"48 48 85 1",
|
|
||||||
" c None",
|
|
||||||
". c #887D6C",
|
|
||||||
"+ c #8C8A87",
|
|
||||||
"@ c #787775",
|
|
||||||
"# c #766D5F",
|
|
||||||
"$ c #67655F",
|
|
||||||
"% c #5E5A54",
|
|
||||||
"& c #55524C",
|
|
||||||
"* c #BBBAB8",
|
|
||||||
"= c #B7AFA2",
|
|
||||||
"- c #A9A5A0",
|
|
||||||
"; c #99948A",
|
|
||||||
"> c #FAFAFA",
|
|
||||||
", c #F8F6F2",
|
|
||||||
"' c #F6F2EC",
|
|
||||||
") c #E6E5E5",
|
|
||||||
"! c #D2CCBF",
|
|
||||||
"~ c #C7C6C3",
|
|
||||||
"{ c #413F3F",
|
|
||||||
"] c #DCD9D4",
|
|
||||||
"^ c #322E2B",
|
|
||||||
"/ c #4F4E4C",
|
|
||||||
"( c #908F8D",
|
|
||||||
"_ c #989897",
|
|
||||||
": c #8A8986",
|
|
||||||
"< c #898885",
|
|
||||||
"[ c #F5EEE5",
|
|
||||||
"} c #F5F5F5",
|
|
||||||
"| c #979695",
|
|
||||||
"1 c #888784",
|
|
||||||
"2 c #8B8A87",
|
|
||||||
"3 c #1A1A1A",
|
|
||||||
"4 c #858582",
|
|
||||||
"5 c #949390",
|
|
||||||
"6 c #858480",
|
|
||||||
"7 c #92918E",
|
|
||||||
"8 c #8F8E8B",
|
|
||||||
"9 c #8E8D8A",
|
|
||||||
"0 c #797773",
|
|
||||||
"a c #7B7975",
|
|
||||||
"b c #81807C",
|
|
||||||
"c c #817F7C",
|
|
||||||
"d c #989796",
|
|
||||||
"e c #807E7B",
|
|
||||||
"f c #8C8B88",
|
|
||||||
"g c #E3CAA5",
|
|
||||||
"h c #F2EADF",
|
|
||||||
"i c #DDCDB4",
|
|
||||||
"j c #8E8E8B",
|
|
||||||
"k c #888785",
|
|
||||||
"l c #EFE4D2",
|
|
||||||
"m c #969694",
|
|
||||||
"n c #9F9F9D",
|
|
||||||
"o c #E6D4B7",
|
|
||||||
"p c #A5967E",
|
|
||||||
"q c #8A8987",
|
|
||||||
"r c #EBDCC4",
|
|
||||||
"s c #878683",
|
|
||||||
"t c #9B9995",
|
|
||||||
"u c #9A9892",
|
|
||||||
"v c #807F7B",
|
|
||||||
"w c #7E7C79",
|
|
||||||
"x c #8E8C88",
|
|
||||||
"y c #8F8E8C",
|
|
||||||
"z c #8D8B88",
|
|
||||||
"A c #B59871",
|
|
||||||
"B c #878581",
|
|
||||||
"C c #8E8B87",
|
|
||||||
"D c #848480",
|
|
||||||
"E c #898785",
|
|
||||||
"F c #8A8886",
|
|
||||||
"G c #7D7B77",
|
|
||||||
"H c #8D8C89",
|
|
||||||
"I c #8B8A86",
|
|
||||||
"J c #918F8B",
|
|
||||||
"K c #989795",
|
|
||||||
"L c #BBA382",
|
|
||||||
"M c #8D8B86",
|
|
||||||
"N c #868480",
|
|
||||||
"O c #8E8C87",
|
|
||||||
"P c #8E8B86",
|
|
||||||
"Q c #8A8985",
|
|
||||||
"R c #807F7A",
|
|
||||||
"S c #8D8A84",
|
|
||||||
"T c #898884",
|
|
||||||
" ",
|
|
||||||
" ",
|
|
||||||
" .+....@@#####$$$%$%&$@ ",
|
|
||||||
" .**************=*-;+%%@ ",
|
|
||||||
" .*>>,>>>>>>,>>>>')!*..;& ",
|
|
||||||
" .*>>>>>>>>>>>>>>>,)!=@~;{ ",
|
|
||||||
" .*,>>>>>>>>>>>>>>>,]]%)~+^ ",
|
|
||||||
" .*>>>>>>>>>>>>>>>>>))/>)~+^ ",
|
|
||||||
" .*>>>>>>>>>>>>>>>>>(_/>>)~+^ ",
|
|
||||||
" .*>>>>>>>>>>>>>>>>>:>/)>>)~+{ ",
|
|
||||||
" @*>>>>>>>>>>>>>>>>><>/]'>>)~;& ",
|
|
||||||
" @*>>>>>>>>>>>>>>>>>:>/~][>>)~;$ ",
|
|
||||||
" #*>>>>>>>>>}}|1<<2>:>/33^{{%$@$@ ",
|
|
||||||
" .*>>>>>>>>>4:<<<<<56>)~*-;+@$%{$ ",
|
|
||||||
" #*>>>>>>>>><>|<1<7>8>>)!~=-;+@&{ ",
|
|
||||||
" #*>>>>>>>>><>>>>>>>9>>,]!~*-;+${ ",
|
|
||||||
" #*>>>>>>>>><>>>>>>>8>>,))~~*-;@^ ",
|
|
||||||
" #*>>>>>>>>><>>>>>>>:>(000a!~*-@^ ",
|
|
||||||
" #*>>>>>>>>>1>>>>>>>b2<<<1c]~~*.^ ",
|
|
||||||
" #*>>>>>>>>><>>>>>>>,>de<<f]g~*+^ ",
|
|
||||||
" #*>>>>>>>>><>>>>>>,,,''[h]]ii~+^ ",
|
|
||||||
" $*>>jkkkkj><>>>>>,>'''[[hl]]ig;^ ",
|
|
||||||
" $*>>mkkkkjn<>>>>>,,'''h[hl]o!!p^ ",
|
|
||||||
" $*>>jkkkkq><>>>>,'''[)[hhll]i!p^ ",
|
|
||||||
" $*>>>>>>>>><>>>,,'),[hh)llrro!p^ ",
|
|
||||||
" $*>>>>>>>>><>>,,'''h[hhhllrriip^ ",
|
|
||||||
" $*>>>>>>>>><>,'''h[hhlllllrroip^ ",
|
|
||||||
" %*>>>>>>>>><,''''[[hh|<s<2rroip^ ",
|
|
||||||
" %*>>>>>>>>><'''hhh)tu<<v0wrroip^ ",
|
|
||||||
" $*>>>>>>>>,<''['[[hxly<<<zroooA^ ",
|
|
||||||
" %*>>>>>>>,,<'hh)hhlxllrrrrrroiA^ ",
|
|
||||||
" %*>>>>>>,''1[[[[hllxlrlrroooooA^ ",
|
|
||||||
" %*>>>>>,,''<hqk<<BlClrrrrrooooA^ ",
|
|
||||||
" %*>>>>,'''hDEF<<<GHIrrrroooogiA^ ",
|
|
||||||
" %*>>>,,'''h)hJ<1<KrCrrorooooggL^ ",
|
|
||||||
" &*>>,''[[h[[hllllrlCroroooggogA^ ",
|
|
||||||
" &*>,,''[h[hlhllrlrrCroooooggggA^ ",
|
|
||||||
" &=,''[[[[hlhllllrrrMoqkk1NogggL^ ",
|
|
||||||
" &*''''h)hhlllrrrrrrOPQ<ksRggggA^ ",
|
|
||||||
" /=''h[[[h)llrllrrrooo2STE6ggggA^ ",
|
|
||||||
" &=''h)hlhlllrrrrorooooggggggggA^ ",
|
|
||||||
" /=[[[[hhllrrlrroroooogggggg*ggA^ ",
|
|
||||||
" /=hhhllllllrrrroooogogggggggggA^ ",
|
|
||||||
" /=*=======LLLLLLLLLLLLAAAAAAAAA^ ",
|
|
||||||
" ^^^^^^^^^^^^^^^^^^^^^^^^^^3^^3^^ ",
|
|
||||||
" ",
|
|
||||||
" ",
|
|
||||||
" "]
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -46,6 +46,7 @@ import Errors
|
|||||||
import FontScale
|
import FontScale
|
||||||
from QuestionDialog import ErrorDialog
|
from QuestionDialog import ErrorDialog
|
||||||
from SubstKeywords import SubstKeywords
|
from SubstKeywords import SubstKeywords
|
||||||
|
from Utils import get_xpm_image
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
_BORN = _('b.')
|
_BORN = _('b.')
|
||||||
@ -172,6 +173,7 @@ class AncestorChart:
|
|||||||
|
|
||||||
def __init__(self,database,person,max,display,doc,output,scale,compress,
|
def __init__(self,database,person,max,display,doc,output,scale,compress,
|
||||||
title,newpage=0):
|
title,newpage=0):
|
||||||
|
self.database = database
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.title = title.strip()
|
self.title = title.strip()
|
||||||
self.doc.creator(database.get_researcher().get_name())
|
self.doc.creator(database.get_researcher().get_name())
|
||||||
@ -193,7 +195,7 @@ class AncestorChart:
|
|||||||
self.font = self.doc.style_list["AC2-Normal"].get_font()
|
self.font = self.doc.style_list["AC2-Normal"].get_font()
|
||||||
self.tfont = self.doc.style_list["AC2-Title"].get_font()
|
self.tfont = self.doc.style_list["AC2-Title"].get_font()
|
||||||
|
|
||||||
self.filter(self.start,1)
|
self.filter(self.start.get_id(),1)
|
||||||
|
|
||||||
keys = self.map.keys()
|
keys = self.map.keys()
|
||||||
keys.sort()
|
keys.sort()
|
||||||
@ -204,18 +206,18 @@ class AncestorChart:
|
|||||||
self.genchart.set(key,self.map[key])
|
self.genchart.set(key,self.map[key])
|
||||||
self.calc()
|
self.calc()
|
||||||
|
|
||||||
def filter(self,person,index):
|
def filter(self,person_id,index):
|
||||||
"""traverse the ancestors recursively until either the end
|
"""traverse the ancestors recursively until either the end
|
||||||
of a line is found, or until we reach the maximum number of
|
of a line is found, or until we reach the maximum number of
|
||||||
generations that we want to deal with"""
|
generations that we want to deal with"""
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
self.text[index] = []
|
self.text[index] = []
|
||||||
|
|
||||||
subst = SubstKeywords(person)
|
subst = SubstKeywords(self.database,person_id)
|
||||||
|
|
||||||
for line in self.display:
|
for line in self.display:
|
||||||
self.text[index].append(subst.replace(line))
|
self.text[index].append(subst.replace(line))
|
||||||
@ -225,8 +227,10 @@ class AncestorChart:
|
|||||||
|
|
||||||
self.lines = max(self.lines,len(self.text[index]))
|
self.lines = max(self.lines,len(self.text[index]))
|
||||||
|
|
||||||
family = person.get_main_parents_family_id()
|
person = self.database.find_person_from_id(person_id)
|
||||||
if family:
|
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)
|
||||||
|
|
||||||
@ -692,148 +696,6 @@ def write_book_item(database,person,doc,options,newpage=0):
|
|||||||
import DisplayTrace
|
import DisplayTrace
|
||||||
DisplayTrace.DisplayTrace()
|
DisplayTrace.DisplayTrace()
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#------------------------------------------------------------------------
|
|
||||||
def get_xpm_image():
|
|
||||||
return [
|
|
||||||
"48 48 85 1",
|
|
||||||
" c None",
|
|
||||||
". c #887D6C",
|
|
||||||
"+ c #8C8A87",
|
|
||||||
"@ c #787775",
|
|
||||||
"# c #766D5F",
|
|
||||||
"$ c #67655F",
|
|
||||||
"% c #5E5A54",
|
|
||||||
"& c #55524C",
|
|
||||||
"* c #BBBAB8",
|
|
||||||
"= c #B7AFA2",
|
|
||||||
"- c #A9A5A0",
|
|
||||||
"; c #99948A",
|
|
||||||
"> c #FAFAFA",
|
|
||||||
", c #F8F6F2",
|
|
||||||
"' c #F6F2EC",
|
|
||||||
") c #E6E5E5",
|
|
||||||
"! c #D2CCBF",
|
|
||||||
"~ c #C7C6C3",
|
|
||||||
"{ c #413F3F",
|
|
||||||
"] c #DCD9D4",
|
|
||||||
"^ c #322E2B",
|
|
||||||
"/ c #4F4E4C",
|
|
||||||
"( c #908F8D",
|
|
||||||
"_ c #989897",
|
|
||||||
": c #8A8986",
|
|
||||||
"< c #898885",
|
|
||||||
"[ c #F5EEE5",
|
|
||||||
"} c #F5F5F5",
|
|
||||||
"| c #979695",
|
|
||||||
"1 c #888784",
|
|
||||||
"2 c #8B8A87",
|
|
||||||
"3 c #1A1A1A",
|
|
||||||
"4 c #858582",
|
|
||||||
"5 c #949390",
|
|
||||||
"6 c #858480",
|
|
||||||
"7 c #92918E",
|
|
||||||
"8 c #8F8E8B",
|
|
||||||
"9 c #8E8D8A",
|
|
||||||
"0 c #797773",
|
|
||||||
"a c #7B7975",
|
|
||||||
"b c #81807C",
|
|
||||||
"c c #817F7C",
|
|
||||||
"d c #989796",
|
|
||||||
"e c #807E7B",
|
|
||||||
"f c #8C8B88",
|
|
||||||
"g c #E3CAA5",
|
|
||||||
"h c #F2EADF",
|
|
||||||
"i c #DDCDB4",
|
|
||||||
"j c #8E8E8B",
|
|
||||||
"k c #888785",
|
|
||||||
"l c #EFE4D2",
|
|
||||||
"m c #969694",
|
|
||||||
"n c #9F9F9D",
|
|
||||||
"o c #E6D4B7",
|
|
||||||
"p c #A5967E",
|
|
||||||
"q c #8A8987",
|
|
||||||
"r c #EBDCC4",
|
|
||||||
"s c #878683",
|
|
||||||
"t c #9B9995",
|
|
||||||
"u c #9A9892",
|
|
||||||
"v c #807F7B",
|
|
||||||
"w c #7E7C79",
|
|
||||||
"x c #8E8C88",
|
|
||||||
"y c #8F8E8C",
|
|
||||||
"z c #8D8B88",
|
|
||||||
"A c #B59871",
|
|
||||||
"B c #878581",
|
|
||||||
"C c #8E8B87",
|
|
||||||
"D c #848480",
|
|
||||||
"E c #898785",
|
|
||||||
"F c #8A8886",
|
|
||||||
"G c #7D7B77",
|
|
||||||
"H c #8D8C89",
|
|
||||||
"I c #8B8A86",
|
|
||||||
"J c #918F8B",
|
|
||||||
"K c #989795",
|
|
||||||
"L c #BBA382",
|
|
||||||
"M c #8D8B86",
|
|
||||||
"N c #868480",
|
|
||||||
"O c #8E8C87",
|
|
||||||
"P c #8E8B86",
|
|
||||||
"Q c #8A8985",
|
|
||||||
"R c #807F7A",
|
|
||||||
"S c #8D8A84",
|
|
||||||
"T c #898884",
|
|
||||||
" ",
|
|
||||||
" ",
|
|
||||||
" .+....@@#####$$$%$%&$@ ",
|
|
||||||
" .**************=*-;+%%@ ",
|
|
||||||
" .*>>,>>>>>>,>>>>')!*..;& ",
|
|
||||||
" .*>>>>>>>>>>>>>>>,)!=@~;{ ",
|
|
||||||
" .*,>>>>>>>>>>>>>>>,]]%)~+^ ",
|
|
||||||
" .*>>>>>>>>>>>>>>>>>))/>)~+^ ",
|
|
||||||
" .*>>>>>>>>>>>>>>>>>(_/>>)~+^ ",
|
|
||||||
" .*>>>>>>>>>>>>>>>>>:>/)>>)~+{ ",
|
|
||||||
" @*>>>>>>>>>>>>>>>>><>/]'>>)~;& ",
|
|
||||||
" @*>>>>>>>>>>>>>>>>>:>/~][>>)~;$ ",
|
|
||||||
" #*>>>>>>>>>}}|1<<2>:>/33^{{%$@$@ ",
|
|
||||||
" .*>>>>>>>>>4:<<<<<56>)~*-;+@$%{$ ",
|
|
||||||
" #*>>>>>>>>><>|<1<7>8>>)!~=-;+@&{ ",
|
|
||||||
" #*>>>>>>>>><>>>>>>>9>>,]!~*-;+${ ",
|
|
||||||
" #*>>>>>>>>><>>>>>>>8>>,))~~*-;@^ ",
|
|
||||||
" #*>>>>>>>>><>>>>>>>:>(000a!~*-@^ ",
|
|
||||||
" #*>>>>>>>>>1>>>>>>>b2<<<1c]~~*.^ ",
|
|
||||||
" #*>>>>>>>>><>>>>>>>,>de<<f]g~*+^ ",
|
|
||||||
" #*>>>>>>>>><>>>>>>,,,''[h]]ii~+^ ",
|
|
||||||
" $*>>jkkkkj><>>>>>,>'''[[hl]]ig;^ ",
|
|
||||||
" $*>>mkkkkjn<>>>>>,,'''h[hl]o!!p^ ",
|
|
||||||
" $*>>jkkkkq><>>>>,'''[)[hhll]i!p^ ",
|
|
||||||
" $*>>>>>>>>><>>>,,'),[hh)llrro!p^ ",
|
|
||||||
" $*>>>>>>>>><>>,,'''h[hhhllrriip^ ",
|
|
||||||
" $*>>>>>>>>><>,'''h[hhlllllrroip^ ",
|
|
||||||
" %*>>>>>>>>><,''''[[hh|<s<2rroip^ ",
|
|
||||||
" %*>>>>>>>>><'''hhh)tu<<v0wrroip^ ",
|
|
||||||
" $*>>>>>>>>,<''['[[hxly<<<zroooA^ ",
|
|
||||||
" %*>>>>>>>,,<'hh)hhlxllrrrrrroiA^ ",
|
|
||||||
" %*>>>>>>,''1[[[[hllxlrlrroooooA^ ",
|
|
||||||
" %*>>>>>,,''<hqk<<BlClrrrrrooooA^ ",
|
|
||||||
" %*>>>>,'''hDEF<<<GHIrrrroooogiA^ ",
|
|
||||||
" %*>>>,,'''h)hJ<1<KrCrrorooooggL^ ",
|
|
||||||
" &*>>,''[[h[[hllllrlCroroooggogA^ ",
|
|
||||||
" &*>,,''[h[hlhllrlrrCroooooggggA^ ",
|
|
||||||
" &=,''[[[[hlhllllrrrMoqkk1NogggL^ ",
|
|
||||||
" &*''''h)hhlllrrrrrrOPQ<ksRggggA^ ",
|
|
||||||
" /=''h[[[h)llrllrrrooo2STE6ggggA^ ",
|
|
||||||
" &=''h)hlhlllrrrrorooooggggggggA^ ",
|
|
||||||
" /=[[[[hhllrrlrroroooogggggg*ggA^ ",
|
|
||||||
" /=hhhllllllrrrroooogogggggggggA^ ",
|
|
||||||
" /=*=======LLLLLLLLLLLLAAAAAAAAA^ ",
|
|
||||||
" ^^^^^^^^^^^^^^^^^^^^^^^^^^3^^3^^ ",
|
|
||||||
" ",
|
|
||||||
" ",
|
|
||||||
" "]
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -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"
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
@ -46,6 +48,7 @@ import BaseDoc
|
|||||||
import Errors
|
import Errors
|
||||||
|
|
||||||
from SubstKeywords import SubstKeywords
|
from SubstKeywords import SubstKeywords
|
||||||
|
from Utils import get_xpm_image
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
from QuestionDialog import ErrorDialog
|
from QuestionDialog import ErrorDialog
|
||||||
|
|
||||||
@ -75,6 +78,7 @@ def pt2cm(pt):
|
|||||||
class DescendantReport:
|
class DescendantReport:
|
||||||
|
|
||||||
def __init__(self,database,person,display,doc,output,newpage=0):
|
def __init__(self,database,person,display,doc,output,newpage=0):
|
||||||
|
self.database = database
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.doc.creator(database.get_researcher().get_name())
|
self.doc.creator(database.get_researcher().get_name())
|
||||||
self.map = {}
|
self.map = {}
|
||||||
@ -92,24 +96,24 @@ class DescendantReport:
|
|||||||
else:
|
else:
|
||||||
self.standalone = 0
|
self.standalone = 0
|
||||||
|
|
||||||
plist = database.get_person_id_map().values()
|
plist = self.database.get_person_keys()
|
||||||
self.layout = GraphLayout.DescendLine(plist,person)
|
self.layout = GraphLayout.DescendLine(self.database,plist,person.get_id())
|
||||||
(self.v,self.e) = self.layout.layout()
|
(self.v,self.e) = self.layout.layout()
|
||||||
|
|
||||||
self.text = {}
|
self.text = {}
|
||||||
for (p,x,y) in self.v:
|
for (p_id,x,y) in self.v:
|
||||||
|
|
||||||
self.text[p.get_id()] = []
|
self.text[p_id] = []
|
||||||
subst = SubstKeywords(p)
|
subst = SubstKeywords(self.database,p_id)
|
||||||
for line in self.display:
|
for line in self.display:
|
||||||
self.text[p.get_id()].append(subst.replace(line))
|
self.text[p_id].append(subst.replace(line))
|
||||||
|
|
||||||
self.font = self.doc.style_list["DG-Normal"].get_font()
|
self.font = self.doc.style_list["DG-Normal"].get_font()
|
||||||
for line in self.text[p.get_id()]:
|
for line in self.text[p_id]:
|
||||||
new_width = FontScale.string_width(self.font,line)
|
new_width = FontScale.string_width(self.font,line)
|
||||||
self.box_width = max(self.box_width,new_width)
|
self.box_width = max(self.box_width,new_width)
|
||||||
|
|
||||||
self.lines = max(self.lines,len(self.text[p.get_id()]))
|
self.lines = max(self.lines,len(self.text[p_id]))
|
||||||
|
|
||||||
def write_report(self):
|
def write_report(self):
|
||||||
|
|
||||||
@ -129,7 +133,7 @@ class DescendantReport:
|
|||||||
self.pg.append([None]*(cols+1))
|
self.pg.append([None]*(cols+1))
|
||||||
self.ln.append([None]*(cols+1))
|
self.ln.append([None]*(cols+1))
|
||||||
|
|
||||||
for (p,x,y) in self.v:
|
for (p_id,x,y) in self.v:
|
||||||
r = int((y-1)/self.maxy)
|
r = int((y-1)/self.maxy)
|
||||||
c = int((x-1)/self.maxx)
|
c = int((x-1)/self.maxx)
|
||||||
|
|
||||||
@ -137,9 +141,9 @@ class DescendantReport:
|
|||||||
ny = y - (self.maxy)*r
|
ny = y - (self.maxy)*r
|
||||||
l = self.pg[r]
|
l = self.pg[r]
|
||||||
if l[c] == None:
|
if l[c] == None:
|
||||||
l[c] = [(p,nx,ny)]
|
l[c] = [(p_id,nx,ny)]
|
||||||
else:
|
else:
|
||||||
l[c].append((p,nx,ny))
|
l[c].append((p_id,nx,ny))
|
||||||
|
|
||||||
for (x1,y1,x2,y2) in self.e:
|
for (x1,y1,x2,y2) in self.e:
|
||||||
r1 = int((y1-1)/self.maxy)
|
r1 = int((y1-1)/self.maxy)
|
||||||
@ -254,8 +258,8 @@ class DescendantReport:
|
|||||||
right = self.doc.get_usable_width() - (2*_sep)
|
right = self.doc.get_usable_width() - (2*_sep)
|
||||||
|
|
||||||
if plist:
|
if plist:
|
||||||
for (p,x,y) in plist:
|
for (p_id,x,y) in plist:
|
||||||
name = string.join(self.text[p.get_id()],"\n")
|
name = string.join(self.text[p_id],"\n")
|
||||||
x = (x-1)*delta + left + _sep
|
x = (x-1)*delta + left + _sep
|
||||||
y = (y-1)*(self.height+_sep)+top
|
y = (y-1)*(self.height+_sep)+top
|
||||||
self.doc.draw_box("box",name,x,y)
|
self.doc.draw_box("box",name,x,y)
|
||||||
@ -483,96 +487,6 @@ def write_book_item(database,person,doc,options,newpage=0):
|
|||||||
import DisplayTrace
|
import DisplayTrace
|
||||||
DisplayTrace.DisplayTrace()
|
DisplayTrace.DisplayTrace()
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#------------------------------------------------------------------------
|
|
||||||
def get_xpm_image():
|
|
||||||
return [
|
|
||||||
"48 48 33 1",
|
|
||||||
" c None",
|
|
||||||
". c #1A1A1A",
|
|
||||||
"+ c #7E7C76",
|
|
||||||
"@ c #918E8A",
|
|
||||||
"# c #B6AEA2",
|
|
||||||
"$ c #E2CAA6",
|
|
||||||
"% c #E6D6B6",
|
|
||||||
"& c #322E2A",
|
|
||||||
"* c #423E3E",
|
|
||||||
"= c #EADEC6",
|
|
||||||
"- c #F2EADE",
|
|
||||||
"; c #4E4E4E",
|
|
||||||
"> c #56524E",
|
|
||||||
", c #5E5A56",
|
|
||||||
"' c #F6EEE6",
|
|
||||||
") c #9A968A",
|
|
||||||
"! c #66665E",
|
|
||||||
"~ c #F6F2EE",
|
|
||||||
"{ c #C6C6C1",
|
|
||||||
"] c #A6967E",
|
|
||||||
"^ c #8D8A86",
|
|
||||||
"/ c #736D62",
|
|
||||||
"( c #E6E6E6",
|
|
||||||
"_ c #FAFAF9",
|
|
||||||
": c #DEDAD6",
|
|
||||||
"< c #AAA6A2",
|
|
||||||
"[ c #EEE6D2",
|
|
||||||
"} c #BABABA",
|
|
||||||
"| c #878680",
|
|
||||||
"1 c #8A7E6E",
|
|
||||||
"2 c #78756F",
|
|
||||||
"3 c #B89D78",
|
|
||||||
"4 c #D9CEB9",
|
|
||||||
" ",
|
|
||||||
" ",
|
|
||||||
" 1^111122/////!!!,!,>!2 ",
|
|
||||||
" 1}}}}}}}}}}}}}}#}<)^,,2 ",
|
|
||||||
" 1}__~___________~(4}11)> ",
|
|
||||||
" 1}_______________~(4#+{)* ",
|
|
||||||
" 1}~_______________~::,({^& ",
|
|
||||||
" 1}_________________((;_({^& ",
|
|
||||||
" 1}__|++++___+2//2___+;__({^& ",
|
|
||||||
" 1}__++++2|||///2/|2|2;(__({^* ",
|
|
||||||
" +}__|++++_@_+2/22_^_+;:~__({)> ",
|
|
||||||
" 2}________@_______|__;{:'__({)! ",
|
|
||||||
" /}________@_______|__;..&**,!2!2 ",
|
|
||||||
" 1}________@_______|__({}<)^2!,*! ",
|
|
||||||
" /}________@_______|_|222+#<)^2>* ",
|
|
||||||
" /}________@_______^^|+22/{}<)@!* ",
|
|
||||||
" /}________@_________|++++{{}<)+& ",
|
|
||||||
" /}________@___________~'(:4{}<2& ",
|
|
||||||
" /}________@__________~~((::{{}1& ",
|
|
||||||
" /}________^_|+2++__~_~_--%:${}^& ",
|
|
||||||
" /}________+@2++++__~_~~'-::44{^& ",
|
|
||||||
" !}________@_+++++~_~~~''-=::$$)& ",
|
|
||||||
" !}________@_______~~~~-'-[:%{4]& ",
|
|
||||||
" !}________@_____~~~~'('--=[:4{]& ",
|
|
||||||
" !}________@_____~~(~'--([[==%4]& ",
|
|
||||||
" !}________@~+++++~~'++2+2===$4]& ",
|
|
||||||
" !}________2@+++++||)2+|2/[==%4]& ",
|
|
||||||
" ,}________+_2++2|''[+222+=%=%$]& ",
|
|
||||||
" ,}________+~~'~---(-[[[=[==%%4]& ",
|
|
||||||
" !}________+~~~'~''-=[[===%=%%%3& ",
|
|
||||||
" ,}_______~+~~--(--[[{=====%=%$]& ",
|
|
||||||
" ,}_______~+~|+222[[=+1222%%$%%3& ",
|
|
||||||
" ,}_____~_~++/+++/+/+/222/=%%%$3& ",
|
|
||||||
" ,}_____~~~-'+2221[2=2212/%%%$$3& ",
|
|
||||||
" ,}___~_~~~-('-[[[=+=%=%%%%%%$$3& ",
|
|
||||||
" >}___~~''-''-=[=[=2==%=%%%$$%$3& ",
|
|
||||||
" >}_~_~~'-'-[-[[===2==%$%$%$$$$3& ",
|
|
||||||
" >#_~~-'''-[-[[=[==2%22+22$$$$$3& ",
|
|
||||||
" >}~~~~-(--[[======12/2/2/$$$$$3& ",
|
|
||||||
" ;#~~-'''-(=[=[==%=%%2+2//$$$$$]& ",
|
|
||||||
" >#~~-(-=-[[[====%%%%%%$$$$$$$$3& ",
|
|
||||||
" ;#-~''--[===[==$=%%$%$$$$$$}$$3& ",
|
|
||||||
" ;#---[[[[[==%==%%$%$%$$$$$$$$$3& ",
|
|
||||||
" ;#}#######3333333333333333333]3& ",
|
|
||||||
" &&&&&&&&&*&&*&&*&*&&&&&&&&.&&.&& ",
|
|
||||||
" ",
|
|
||||||
" ",
|
|
||||||
" "]
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2003 Donald N. Allingham
|
# Copyright (C) 2003-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$
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# gnome/gtk
|
# gnome/gtk
|
||||||
@ -57,6 +59,7 @@ def pt2cm(pt):
|
|||||||
class FanChart:
|
class FanChart:
|
||||||
|
|
||||||
def __init__(self,database,person,display,doc,output,newpage=0):
|
def __init__(self,database,person,display,doc,output,newpage=0):
|
||||||
|
self.database = database
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
self.doc.creator(database.get_researcher().get_name())
|
self.doc.creator(database.get_researcher().get_name())
|
||||||
self.map = {}
|
self.map = {}
|
||||||
@ -140,18 +143,18 @@ class FanChart:
|
|||||||
if self.standalone:
|
if self.standalone:
|
||||||
self.doc.init()
|
self.doc.init()
|
||||||
|
|
||||||
def filter(self,person,index):
|
def filter(self,person_id,index):
|
||||||
"""traverse the ancestors recursively until either the end
|
"""traverse the ancestors recursively until either the end
|
||||||
of a line is found, or until we reach the maximum number of
|
of a line is found, or until we reach the maximum number of
|
||||||
generations that we want to deal with"""
|
generations that we want to deal with"""
|
||||||
|
|
||||||
if person == None or index >= 32:
|
if (not person_id) or (index >= 32):
|
||||||
return
|
return
|
||||||
self.map[index-1] = person
|
self.map[index-1] = person_id
|
||||||
|
|
||||||
self.text[index-1] = []
|
self.text[index-1] = []
|
||||||
|
|
||||||
subst = SubstKeywords(person)
|
subst = SubstKeywords(self.database,person_id)
|
||||||
|
|
||||||
for line in self.display:
|
for line in self.display:
|
||||||
self.text[index-1].append(subst.replace(line))
|
self.text[index-1].append(subst.replace(line))
|
||||||
@ -162,14 +165,16 @@ class FanChart:
|
|||||||
|
|
||||||
self.lines = max(self.lines,len(self.text[index-1]))
|
self.lines = max(self.lines,len(self.text[index-1]))
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
def write_report(self):
|
def write_report(self):
|
||||||
|
|
||||||
self.filter(self.start,1)
|
self.filter(self.start.get_id(),1)
|
||||||
|
|
||||||
block_size = self.doc.get_usable_width()/14.0
|
block_size = self.doc.get_usable_width()/14.0
|
||||||
|
|
||||||
@ -196,14 +201,25 @@ class FanChart:
|
|||||||
if self.standalone:
|
if self.standalone:
|
||||||
self.doc.close()
|
self.doc.close()
|
||||||
|
|
||||||
def get_info(self,person):
|
def get_info(self,person_id):
|
||||||
|
person = self.database.find_person_from_id(person_id)
|
||||||
pn = person.get_primary_name()
|
pn = person.get_primary_name()
|
||||||
b = person.get_birth().get_date_object().getYear()
|
|
||||||
d = person.get_death().get_date_object().getYear()
|
birth_id = person.get_birth_id()
|
||||||
|
if birth_id:
|
||||||
|
b = self.database.find_event_from_id(birth_id).get_date_object().get_year()
|
||||||
if b == Calendar.UNDEF:
|
if b == Calendar.UNDEF:
|
||||||
b = ""
|
b = ""
|
||||||
|
else:
|
||||||
|
b = ""
|
||||||
|
|
||||||
|
death_id = person.get_death_id()
|
||||||
|
if death_id:
|
||||||
|
d = self.database.find_event_from_id(death_id).get_date_object().get_year()
|
||||||
if d == Calendar.UNDEF:
|
if d == Calendar.UNDEF:
|
||||||
d = ""
|
d = ""
|
||||||
|
else:
|
||||||
|
d = ""
|
||||||
|
|
||||||
if b or d:
|
if b or d:
|
||||||
val = "%s - %s" % (str(b),str(d))
|
val = "%s - %s" % (str(b),str(d))
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
# Copyright (C) 2003 Donald N. Allingham
|
# Copyright (C) 2003-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
|
||||||
@ -50,7 +50,7 @@ import GenericFilter
|
|||||||
import Errors
|
import Errors
|
||||||
import Date
|
import Date
|
||||||
import FontScale
|
import FontScale
|
||||||
import sort
|
import Sort
|
||||||
from QuestionDialog import ErrorDialog
|
from QuestionDialog import ErrorDialog
|
||||||
|
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
@ -183,9 +183,19 @@ class TimeLine:
|
|||||||
|
|
||||||
self.plist.sort(self.sort_func)
|
self.plist.sort(self.sort_func)
|
||||||
|
|
||||||
for p in self.plist:
|
for p_id in self.plist:
|
||||||
b = p.get_birth().get_date_object().getYear()
|
p = self.db.find_person_from_id(p_id)
|
||||||
d = p.get_death().get_date_object().getYear()
|
b_id = p.get_birth_id()
|
||||||
|
if b_id:
|
||||||
|
b = self.db.find_event_from_id(b_id).get_date_object().get_year()
|
||||||
|
else:
|
||||||
|
b = Date.UNDEF
|
||||||
|
|
||||||
|
d_id = p.get_death_id()
|
||||||
|
if d_id:
|
||||||
|
d = self.db.find_event_from_id(d_id).get_date_object().get_year()
|
||||||
|
else:
|
||||||
|
d = Date.UNDEF
|
||||||
|
|
||||||
n = p.get_primary_name().get_name()
|
n = p.get_primary_name().get_name()
|
||||||
self.d.draw_text('TLG-text',n,incr+pad,self.header + (incr+pad)*index)
|
self.d.draw_text('TLG-text',n,incr+pad,self.header + (incr+pad)*index)
|
||||||
@ -269,11 +279,21 @@ class TimeLine:
|
|||||||
low = 999999
|
low = 999999
|
||||||
high = -999999
|
high = -999999
|
||||||
|
|
||||||
self.plist = self.filter.apply(self.db,self.db.get_person_id_map().values())
|
self.plist = self.filter.apply(self.db,self.db.get_person_keys())
|
||||||
|
|
||||||
for p in self.plist:
|
for p_id in self.plist:
|
||||||
b = p.get_birth().get_date_object().getYear()
|
p = self.db.find_person_from_id(p_id)
|
||||||
d = p.get_death().get_date_object().getYear()
|
b_id = p.get_birth_id()
|
||||||
|
if b_id:
|
||||||
|
b = self.db.find_event_from_id(b_id).get_date_object().get_year()
|
||||||
|
else:
|
||||||
|
b = Date.UNDEF
|
||||||
|
|
||||||
|
d_id = p.get_death_id()
|
||||||
|
if d_id:
|
||||||
|
d = self.db.find_event_from_id(d_id).get_date_object().get_year()
|
||||||
|
else:
|
||||||
|
d = Date.UNDEF
|
||||||
|
|
||||||
if b != Date.UNDEF:
|
if b != Date.UNDEF:
|
||||||
low = min(low,b)
|
low = min(low,b)
|
||||||
@ -294,13 +314,14 @@ class TimeLine:
|
|||||||
return (low,high)
|
return (low,high)
|
||||||
|
|
||||||
def name_size(self):
|
def name_size(self):
|
||||||
self.plist = self.filter.apply(self.db,self.db.get_person_id_map().values())
|
self.plist = self.filter.apply(self.db,self.db.get_person_keys())
|
||||||
|
|
||||||
style_name = self.d.draw_styles['TLG-text'].get_paragraph_style()
|
style_name = self.d.draw_styles['TLG-text'].get_paragraph_style()
|
||||||
font = self.d.style_list[style_name].get_font()
|
font = self.d.style_list[style_name].get_font()
|
||||||
|
|
||||||
size = 0
|
size = 0
|
||||||
for p in self.plist:
|
for p_id in self.plist:
|
||||||
|
p = self.db.find_person_from_id(p_id)
|
||||||
n = p.get_primary_name().get_name()
|
n = p.get_primary_name().get_name()
|
||||||
size = max(FontScale.string_width(font,n),size)
|
size = max(FontScale.string_width(font,n),size)
|
||||||
return pt2cm(size)
|
return pt2cm(size)
|
||||||
@ -372,7 +393,7 @@ def _get_report_filters(person):
|
|||||||
# Builds list of sorting functions for this report
|
# Builds list of sorting functions for this report
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
def _get_sort_functions():
|
def _get_sort_functions(sort):
|
||||||
return [
|
return [
|
||||||
(_("Birth Date"),sort.by_birthdate),
|
(_("Birth Date"),sort.by_birthdate),
|
||||||
(_("Name"),sort.by_last_name),
|
(_("Name"),sort.by_last_name),
|
||||||
@ -388,6 +409,7 @@ class TimeLineDialog(Report.DrawReportDialog):
|
|||||||
report_options = {}
|
report_options = {}
|
||||||
|
|
||||||
def __init__(self,database,person):
|
def __init__(self,database,person):
|
||||||
|
self.database = database
|
||||||
Report.DrawReportDialog.__init__(self,database,person,self.report_options)
|
Report.DrawReportDialog.__init__(self,database,person,self.report_options)
|
||||||
|
|
||||||
def get_title(self):
|
def get_title(self):
|
||||||
@ -421,7 +443,7 @@ class TimeLineDialog(Report.DrawReportDialog):
|
|||||||
self.sort_style = gtk.OptionMenu()
|
self.sort_style = gtk.OptionMenu()
|
||||||
self.sort_menu = gtk.Menu()
|
self.sort_menu = gtk.Menu()
|
||||||
|
|
||||||
sort_functions = _get_sort_functions()
|
sort_functions = _get_sort_functions(Sort.Sort(self.database))
|
||||||
for item in sort_functions:
|
for item in sort_functions:
|
||||||
menuitem = gtk.MenuItem(item[0])
|
menuitem = gtk.MenuItem(item[0])
|
||||||
menuitem.set_data('sort',item[1])
|
menuitem.set_data('sort',item[1])
|
||||||
@ -564,7 +586,7 @@ class TimeLineBareDialog(Report.BareReportDialog):
|
|||||||
self.sort_style = gtk.OptionMenu()
|
self.sort_style = gtk.OptionMenu()
|
||||||
self.sort_menu = gtk.Menu()
|
self.sort_menu = gtk.Menu()
|
||||||
|
|
||||||
sort_functions = _get_sort_functions()
|
sort_functions = _get_sort_functions(Sort.Sort(self.db))
|
||||||
for item in sort_functions:
|
for item in sort_functions:
|
||||||
menuitem = gtk.MenuItem(item[0])
|
menuitem = gtk.MenuItem(item[0])
|
||||||
menuitem.set_data('sort',item[1])
|
menuitem.set_data('sort',item[1])
|
||||||
|
Loading…
Reference in New Issue
Block a user