2003-06-13 09:30:24 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2008-01-06 02:12:05 +05:30
|
|
|
# Copyright (C) 2003-2006 Donald N. Allingham
|
|
|
|
# Copyright (C) 2007-2008 Brian G. Matherly
|
2003-06-13 09:30:24 +05:30
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
|
|
|
|
2004-05-05 07:34:30 +05:30
|
|
|
# $Id$
|
|
|
|
|
2005-01-02 12:10:08 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# python modules
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2006-04-07 03:32:46 +05:30
|
|
|
from gettext import gettext as _
|
2005-01-02 12:10:08 +05:30
|
|
|
|
2003-06-13 09:30:24 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2003-08-30 04:17:06 +05:30
|
|
|
import BaseDoc
|
2008-10-02 09:32:10 +05:30
|
|
|
from gen.plug import PluginManager
|
2008-09-27 19:26:17 +05:30
|
|
|
from gen.plug.menu import EnumeratedListOption, NumberOption, PersonOption
|
2008-10-02 09:32:10 +05:30
|
|
|
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_DRAW
|
2003-06-13 09:30:24 +05:30
|
|
|
from SubstKeywords import SubstKeywords
|
2007-09-05 08:32:50 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# private constants
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
FULL_CIRCLE = 0
|
|
|
|
HALF_CIRCLE = 1
|
|
|
|
QUAR_CIRCLE = 2
|
|
|
|
|
|
|
|
BACKGROUND_WHITE = 0
|
|
|
|
BACKGROUND_GEN = 1
|
|
|
|
|
|
|
|
RADIAL_UPRIGHT = 0
|
|
|
|
RADIAL_ROUNDABOUT = 1
|
|
|
|
|
2006-03-10 02:19:29 +05:30
|
|
|
pt2cm = ReportUtils.pt2cm
|
2003-06-13 09:30:24 +05:30
|
|
|
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# FanChart
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2006-06-01 10:09:40 +05:30
|
|
|
class FanChart(Report):
|
2005-01-02 12:10:08 +05:30
|
|
|
|
2008-02-20 10:22:10 +05:30
|
|
|
def __init__(self, database, options_class):
|
2005-01-02 12:10:08 +05:30
|
|
|
"""
|
2008-02-24 19:25:55 +05:30
|
|
|
Create the FanChart object that produces the report.
|
2005-01-02 12:10:08 +05:30
|
|
|
|
|
|
|
The arguments are:
|
|
|
|
|
|
|
|
database - the GRAMPS database instance
|
|
|
|
person - currently selected person
|
|
|
|
options_class - instance of the Options class for this report
|
|
|
|
|
|
|
|
This report needs the following parameters (class variables)
|
|
|
|
that come in the options class.
|
|
|
|
|
2006-07-25 04:48:51 +05:30
|
|
|
maxgen - Maximum number of generations to include.
|
2007-09-05 08:32:50 +05:30
|
|
|
circle - Draw a full circle, half circle, or quarter circle.
|
|
|
|
background - Background color is generation dependent or white.
|
|
|
|
radial - Print radial texts roundabout or as upright as possible.
|
2005-01-02 12:10:08 +05:30
|
|
|
"""
|
2006-07-25 04:48:51 +05:30
|
|
|
|
2008-01-23 11:11:46 +05:30
|
|
|
menu = options_class.menu
|
|
|
|
self.max_generations = menu.get_option_by_name('maxgen').get_value()
|
|
|
|
self.circle = menu.get_option_by_name('circle').get_value()
|
|
|
|
self.background = menu.get_option_by_name('background').get_value()
|
|
|
|
self.radial = menu.get_option_by_name('radial').get_value()
|
|
|
|
pid = menu.get_option_by_name('pid').get_value()
|
2008-01-06 02:12:05 +05:30
|
|
|
self.center_person = database.get_person_from_gramps_id(pid)
|
2006-07-25 04:48:51 +05:30
|
|
|
|
|
|
|
self.background_style = []
|
|
|
|
self.text_style = []
|
|
|
|
for i in range (0, self.max_generations):
|
2007-09-05 08:32:50 +05:30
|
|
|
if self.background == BACKGROUND_WHITE:
|
2007-04-23 17:16:26 +05:30
|
|
|
background_style_name = 'background_style_white'
|
|
|
|
else:
|
|
|
|
background_style_name = 'background_style' + '%d' % i
|
2006-07-25 04:48:51 +05:30
|
|
|
self.background_style.append(background_style_name)
|
|
|
|
text_style_name = 'text_style' + '%d' % i
|
|
|
|
self.text_style.append(text_style_name)
|
|
|
|
|
2008-02-20 10:22:10 +05:30
|
|
|
Report.__init__(self, database, options_class)
|
2005-01-02 12:10:08 +05:30
|
|
|
|
2004-05-05 07:34:30 +05:30
|
|
|
self.height = 0
|
2003-06-13 09:30:24 +05:30
|
|
|
self.lines = 0
|
2005-01-02 12:10:08 +05:30
|
|
|
self.display = "%n"
|
2006-07-25 04:48:51 +05:30
|
|
|
self.map = [None] * 2**self.max_generations
|
2008-01-23 11:11:46 +05:30
|
|
|
self.text = {}
|
2005-01-02 12:10:08 +05:30
|
|
|
self.box_width = 0
|
2003-06-13 09:30:24 +05:30
|
|
|
|
2005-01-02 12:10:08 +05:30
|
|
|
def apply_filter(self,person_handle,index):
|
2003-06-13 09:30:24 +05:30
|
|
|
"""traverse the ancestors recursively until either the end
|
|
|
|
of a line is found, or until we reach the maximum number of
|
|
|
|
generations that we want to deal with"""
|
|
|
|
|
2006-07-25 04:48:51 +05:30
|
|
|
if (not person_handle) or (index >= 2**self.max_generations):
|
2003-06-13 09:30:24 +05:30
|
|
|
return
|
2004-07-28 07:59:07 +05:30
|
|
|
self.map[index-1] = person_handle
|
2003-06-13 09:30:24 +05:30
|
|
|
|
2004-05-05 07:34:30 +05:30
|
|
|
self.text[index-1] = []
|
2003-06-13 09:30:24 +05:30
|
|
|
|
2004-07-28 07:59:07 +05:30
|
|
|
subst = SubstKeywords(self.database,person_handle)
|
2003-06-13 09:30:24 +05:30
|
|
|
|
|
|
|
for line in self.display:
|
|
|
|
self.text[index-1].append(subst.replace(line))
|
|
|
|
|
2007-04-23 17:16:26 +05:30
|
|
|
style_sheet = self.doc.get_style_sheet()
|
|
|
|
self.font = style_sheet.get_paragraph_style('text_style').get_font()
|
2004-05-05 07:34:30 +05:30
|
|
|
for line in self.text[index-1]:
|
2004-08-21 02:56:51 +05:30
|
|
|
self.box_width = max(self.box_width,self.doc.string_width(self.font,line))
|
2003-06-13 09:30:24 +05:30
|
|
|
|
2004-05-05 07:34:30 +05:30
|
|
|
self.lines = max(self.lines,len(self.text[index-1]))
|
2003-06-13 09:30:24 +05:30
|
|
|
|
2004-08-07 10:46:57 +05:30
|
|
|
person = self.database.get_person_from_handle(person_handle)
|
2004-07-28 07:59:07 +05:30
|
|
|
family_handle = person.get_main_parents_family_handle()
|
|
|
|
if family_handle:
|
2004-08-20 03:05:16 +05:30
|
|
|
family = self.database.get_family_from_handle(family_handle)
|
2005-01-02 12:10:08 +05:30
|
|
|
self.apply_filter(family.get_father_handle(),index*2)
|
|
|
|
self.apply_filter(family.get_mother_handle(),(index*2)+1)
|
2003-06-13 09:30:24 +05:30
|
|
|
|
2003-08-30 04:17:06 +05:30
|
|
|
|
2006-07-25 04:48:51 +05:30
|
|
|
def write_report(self):
|
2003-06-13 09:30:24 +05:30
|
|
|
|
|
|
|
self.doc.start_page()
|
|
|
|
|
2008-01-06 02:12:05 +05:30
|
|
|
self.apply_filter(self.center_person.get_handle(),1)
|
|
|
|
n = self.center_person.get_primary_name().get_regular_name()
|
2003-06-13 09:30:24 +05:30
|
|
|
|
2007-09-05 08:32:50 +05:30
|
|
|
if self.circle == FULL_CIRCLE:
|
2006-07-25 04:48:51 +05:30
|
|
|
max_angle = 360.0
|
|
|
|
start_angle = 90
|
|
|
|
max_circular = 5
|
|
|
|
x = self.doc.get_usable_width() / 2.0
|
|
|
|
y = self.doc.get_usable_height() / 2.0
|
|
|
|
min_xy = min (x, y)
|
|
|
|
|
2007-09-05 08:32:50 +05:30
|
|
|
elif self.circle == HALF_CIRCLE:
|
2006-07-25 04:48:51 +05:30
|
|
|
max_angle = 180.0
|
|
|
|
start_angle = 180
|
|
|
|
max_circular = 3
|
|
|
|
x = (self.doc.get_usable_width()/2.0)
|
|
|
|
y = self.doc.get_usable_height()
|
|
|
|
min_xy = min (x, y)
|
|
|
|
|
|
|
|
else: # quarter circle
|
|
|
|
max_angle = 90.0
|
|
|
|
start_angle = 270
|
|
|
|
max_circular = 2
|
|
|
|
x = 0
|
|
|
|
y = self.doc.get_usable_height()
|
|
|
|
min_xy = min (self.doc.get_usable_width(), y)
|
|
|
|
|
2008-02-26 12:52:07 +05:30
|
|
|
if self.circle == FULL_CIRCLE or self.circle == QUAR_CIRCLE:
|
|
|
|
# adjust only if full circle or 1/4 circle in landscape mode
|
|
|
|
if self.doc.get_usable_height() <= self.doc.get_usable_width():
|
|
|
|
# Should be in Landscape now
|
|
|
|
style_sheet = self.doc.get_style_sheet()
|
|
|
|
fontsize = pt2cm(style_sheet.get_paragraph_style('FC-Title').get_font().get_size())
|
|
|
|
# y is vertical distance to center of circle, move center down 1 fontsize
|
|
|
|
y = y + fontsize
|
|
|
|
# min_XY is the diamter of the circle, subtract two fontsize
|
|
|
|
# so we dont draw outside bottom of the paper
|
|
|
|
min_xy = min(min_xy,y-2*fontsize)
|
2006-07-25 04:48:51 +05:30
|
|
|
if self.max_generations > max_circular:
|
|
|
|
block_size = min_xy / (self.max_generations * 2 - max_circular)
|
|
|
|
else:
|
|
|
|
block_size = min_xy / self.max_generations
|
2008-02-11 02:52:28 +05:30
|
|
|
text = _("%(generations)d Generation Fan Chart for %(person)s" ) % \
|
|
|
|
{ 'generations' : self.max_generations, 'person' : n }
|
2007-12-24 03:04:36 +05:30
|
|
|
self.doc.center_text ('t', text, self.doc.get_usable_width() / 2, 0)
|
2006-07-25 04:48:51 +05:30
|
|
|
|
|
|
|
for generation in range (0, min (max_circular, self.max_generations)):
|
|
|
|
self.draw_circular (x, y, start_angle, max_angle, block_size, generation)
|
|
|
|
for generation in range (max_circular, self.max_generations):
|
|
|
|
self.draw_radial (x, y, start_angle, max_angle, block_size, generation)
|
2003-06-13 09:30:24 +05:30
|
|
|
|
|
|
|
self.doc.end_page()
|
|
|
|
|
2006-07-25 04:48:51 +05:30
|
|
|
|
|
|
|
def get_info(self,person_handle,generation):
|
2004-08-07 10:46:57 +05:30
|
|
|
person = self.database.get_person_from_handle(person_handle)
|
2004-02-14 11:10:30 +05:30
|
|
|
pn = person.get_primary_name()
|
2004-05-05 07:34:30 +05:30
|
|
|
|
2006-03-30 10:45:54 +05:30
|
|
|
birth_ref = person.get_birth_ref()
|
|
|
|
if birth_ref:
|
|
|
|
birth = self.database.get_event_from_handle(birth_ref.ref)
|
|
|
|
b = birth.get_date_object().get_year()
|
2004-10-12 06:59:39 +05:30
|
|
|
if b == 0:
|
2004-05-05 07:34:30 +05:30
|
|
|
b = ""
|
|
|
|
else:
|
2003-06-13 09:30:24 +05:30
|
|
|
b = ""
|
2004-05-05 07:34:30 +05:30
|
|
|
|
2006-03-30 10:45:54 +05:30
|
|
|
death_ref = person.get_death_ref()
|
|
|
|
if death_ref:
|
|
|
|
death = self.database.get_event_from_handle(death_ref.ref)
|
|
|
|
d = death.get_date_object().get_year()
|
2004-10-12 06:59:39 +05:30
|
|
|
if d == 0:
|
2004-05-05 07:34:30 +05:30
|
|
|
d = ""
|
|
|
|
else:
|
2003-06-13 09:30:24 +05:30
|
|
|
d = ""
|
|
|
|
|
2006-07-25 04:48:51 +05:30
|
|
|
if b and d:
|
2003-06-13 09:30:24 +05:30
|
|
|
val = "%s - %s" % (str(b),str(d))
|
2006-07-25 04:48:51 +05:30
|
|
|
elif b:
|
|
|
|
val = "* %s" % (str(b))
|
|
|
|
elif d:
|
|
|
|
val = "+ %s" % (str(d))
|
2003-06-13 09:30:24 +05:30
|
|
|
else:
|
|
|
|
val = ""
|
2006-10-16 08:45:58 +05:30
|
|
|
|
2006-07-25 04:48:51 +05:30
|
|
|
if generation == 7:
|
2006-10-16 08:45:58 +05:30
|
|
|
if (pn.get_first_name() != "") and (pn.get_surname() != ""):
|
|
|
|
name = pn.get_first_name() + " " + pn.get_surname()
|
|
|
|
else:
|
|
|
|
name = pn.get_first_name() + pn.get_surname()
|
|
|
|
|
2007-09-05 08:32:50 +05:30
|
|
|
if self.circle == FULL_CIRCLE:
|
2006-10-16 08:45:58 +05:30
|
|
|
return [ name, val ]
|
2007-09-05 08:32:50 +05:30
|
|
|
elif self.circle == HALF_CIRCLE:
|
2006-10-16 08:45:58 +05:30
|
|
|
return [ name, val ]
|
2006-07-25 04:48:51 +05:30
|
|
|
else:
|
2006-10-16 08:45:58 +05:30
|
|
|
if (name != "") and (val != ""):
|
|
|
|
string = name + ", " + val
|
|
|
|
else:
|
|
|
|
string = name + val
|
|
|
|
return [string]
|
2006-07-25 04:48:51 +05:30
|
|
|
elif generation == 6:
|
2007-09-05 08:32:50 +05:30
|
|
|
if self.circle == FULL_CIRCLE:
|
2006-07-25 04:48:51 +05:30
|
|
|
return [ pn.get_first_name(), pn.get_surname(), val ]
|
2007-09-05 08:32:50 +05:30
|
|
|
elif self.circle == HALF_CIRCLE:
|
2006-07-25 04:48:51 +05:30
|
|
|
return [ pn.get_first_name(), pn.get_surname(), val ]
|
|
|
|
else:
|
2006-10-16 08:45:58 +05:30
|
|
|
if (pn.get_first_name() != "") and (pn.get_surname() != ""):
|
|
|
|
name = pn.get_first_name() + " " + pn.get_surname()
|
|
|
|
else:
|
|
|
|
name = pn.get_first_name() + pn.get_surname()
|
|
|
|
return [ name, val ]
|
2006-07-25 04:48:51 +05:30
|
|
|
else:
|
|
|
|
return [ pn.get_first_name(), pn.get_surname(), val ]
|
|
|
|
|
|
|
|
|
|
|
|
def draw_circular(self, x, y, start_angle, max_angle, size, generation):
|
|
|
|
segments = 2**generation
|
|
|
|
delta = max_angle / segments
|
|
|
|
end_angle = start_angle
|
|
|
|
text_angle = start_angle - 270 + (delta / 2.0)
|
|
|
|
rad1 = size * generation
|
|
|
|
rad2 = size * (generation + 1)
|
|
|
|
background_style = self.background_style[generation]
|
|
|
|
text_style = self.text_style[generation]
|
|
|
|
|
|
|
|
for index in range(segments - 1, 2*segments - 1):
|
|
|
|
start_angle = end_angle
|
|
|
|
end_angle = start_angle + delta
|
2007-02-15 09:37:53 +05:30
|
|
|
(xc,yc) = ReportUtils.draw_wedge(self.doc,background_style, x, y, rad2,
|
2006-07-25 04:48:51 +05:30
|
|
|
start_angle, end_angle, rad1)
|
|
|
|
if self.map[index]:
|
2007-09-05 08:32:50 +05:30
|
|
|
if (generation == 0) and self.circle == FULL_CIRCLE:
|
2006-07-25 04:48:51 +05:30
|
|
|
yc = y
|
|
|
|
self.doc.rotate_text(text_style,
|
|
|
|
self.get_info(self.map[index],
|
|
|
|
generation),
|
|
|
|
xc, yc, text_angle)
|
|
|
|
text_angle += delta
|
|
|
|
|
|
|
|
|
|
|
|
def draw_radial(self, x, y, start_angle, max_angle, size, generation):
|
|
|
|
segments = 2**generation
|
|
|
|
delta = max_angle / segments
|
|
|
|
end_angle = start_angle
|
|
|
|
text_angle = start_angle - delta / 2.0
|
|
|
|
background_style = self.background_style[generation]
|
|
|
|
text_style = self.text_style[generation]
|
2007-09-05 08:32:50 +05:30
|
|
|
if self.circle == FULL_CIRCLE:
|
2006-07-25 04:48:51 +05:30
|
|
|
rad1 = size * ((generation * 2) - 5)
|
|
|
|
rad2 = size * ((generation * 2) - 3)
|
2007-09-05 08:32:50 +05:30
|
|
|
elif self.circle == HALF_CIRCLE:
|
2006-07-25 04:48:51 +05:30
|
|
|
rad1 = size * ((generation * 2) - 3)
|
|
|
|
rad2 = size * ((generation * 2) - 1)
|
|
|
|
else: # quarter circle
|
|
|
|
rad1 = size * ((generation * 2) - 2)
|
|
|
|
rad2 = size * (generation * 2)
|
2003-06-13 09:30:24 +05:30
|
|
|
|
2006-07-25 04:48:51 +05:30
|
|
|
for index in range(segments - 1, 2*segments - 1):
|
|
|
|
start_angle = end_angle
|
|
|
|
end_angle = start_angle + delta
|
2007-02-15 09:37:53 +05:30
|
|
|
(xc,yc) = ReportUtils.draw_wedge(self.doc,background_style, x, y, rad2,
|
2006-07-25 04:48:51 +05:30
|
|
|
start_angle, end_angle, rad1)
|
|
|
|
text_angle += delta
|
2003-06-13 09:30:24 +05:30
|
|
|
if self.map[index]:
|
2007-09-05 08:32:50 +05:30
|
|
|
if self.radial == RADIAL_UPRIGHT and (start_angle >= 90) and (start_angle < 270):
|
2006-07-25 04:48:51 +05:30
|
|
|
self.doc.rotate_text(text_style,
|
|
|
|
self.get_info(self.map[index],
|
|
|
|
generation),
|
|
|
|
xc, yc, text_angle + 180)
|
|
|
|
else:
|
|
|
|
self.doc.rotate_text(text_style,
|
|
|
|
self.get_info(self.map[index],
|
|
|
|
generation),
|
|
|
|
xc, yc, text_angle)
|
2003-06-13 09:30:24 +05:30
|
|
|
|
2003-08-30 04:17:06 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2007-11-29 05:03:40 +05:30
|
|
|
class FanChartOptions(MenuReportOptions):
|
2005-01-02 12:10:08 +05:30
|
|
|
|
2008-01-24 18:20:33 +05:30
|
|
|
def __init__(self, name, dbase):
|
2007-04-23 17:16:26 +05:30
|
|
|
self.MAX_GENERATIONS = 8
|
2007-09-05 08:32:50 +05:30
|
|
|
|
2008-01-24 18:20:33 +05:30
|
|
|
MenuReportOptions.__init__(self, name, dbase)
|
2007-09-05 08:32:50 +05:30
|
|
|
|
2008-01-24 18:20:33 +05:30
|
|
|
def add_menu_options(self, menu):
|
2008-01-06 02:12:05 +05:30
|
|
|
"""
|
|
|
|
Add options to the menu for the fan chart.
|
|
|
|
"""
|
2007-09-05 08:32:50 +05:30
|
|
|
category_name = _("Report Options")
|
2008-01-18 11:09:50 +05:30
|
|
|
|
|
|
|
pid = PersonOption(_("Center Person"))
|
|
|
|
pid.set_help(_("The center person for the report"))
|
|
|
|
menu.add_option(category_name, "pid", pid)
|
|
|
|
|
2007-09-05 08:32:50 +05:30
|
|
|
max_gen = NumberOption(_("Generations"),5,1,self.MAX_GENERATIONS)
|
|
|
|
max_gen.set_help(_("The number of generations to include in the report"))
|
|
|
|
menu.add_option(category_name,"maxgen",max_gen)
|
|
|
|
|
|
|
|
circle = EnumeratedListOption(_('Type of graph'),HALF_CIRCLE)
|
|
|
|
circle.add_item(FULL_CIRCLE,_('full circle'))
|
|
|
|
circle.add_item(HALF_CIRCLE,_('half circle'))
|
|
|
|
circle.add_item(QUAR_CIRCLE,_('quarter circle'))
|
|
|
|
circle.set_help( _("The form of the graph: full circle, half circle,"
|
|
|
|
" or quarter circle."))
|
|
|
|
menu.add_option(category_name,"circle",circle)
|
|
|
|
|
|
|
|
background = EnumeratedListOption(_('Background color'),BACKGROUND_GEN)
|
|
|
|
background.add_item(BACKGROUND_WHITE,_('white'))
|
|
|
|
background.add_item(BACKGROUND_GEN,_('generation dependent'))
|
|
|
|
background.set_help(_("Background color is either white or generation"
|
|
|
|
" dependent"))
|
|
|
|
menu.add_option(category_name,"background",background)
|
|
|
|
|
|
|
|
radial = EnumeratedListOption( _('Orientation of radial texts'),
|
|
|
|
RADIAL_UPRIGHT )
|
|
|
|
radial.add_item(RADIAL_UPRIGHT,_('upright'))
|
|
|
|
radial.add_item(RADIAL_ROUNDABOUT,_('roundabout'))
|
2008-12-02 14:55:01 +05:30
|
|
|
radial.set_help(_("Print radial texts upright or roundabout"))
|
2007-09-05 08:32:50 +05:30
|
|
|
menu.add_option(category_name,"radial",radial)
|
2006-07-25 04:48:51 +05:30
|
|
|
|
2005-01-02 12:10:08 +05:30
|
|
|
def make_default_style(self,default_style):
|
|
|
|
"""Make the default output style for the Fan Chart report."""
|
2007-04-23 17:16:26 +05:30
|
|
|
BACKGROUND_COLORS = [
|
|
|
|
(255, 63, 0),
|
|
|
|
(255,175, 15),
|
|
|
|
(255,223, 87),
|
|
|
|
(255,255,111),
|
|
|
|
(159,255,159),
|
|
|
|
(111,215,255),
|
|
|
|
( 79,151,255),
|
|
|
|
(231, 23,255)
|
|
|
|
]
|
|
|
|
|
|
|
|
#Paragraph Styles
|
2005-01-02 12:10:08 +05:30
|
|
|
f = BaseDoc.FontStyle()
|
|
|
|
f.set_size(20)
|
|
|
|
f.set_bold(1)
|
|
|
|
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
|
|
|
|
p = BaseDoc.ParagraphStyle()
|
|
|
|
p.set_font(f)
|
|
|
|
p.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
|
|
|
|
p.set_description(_('The style used for the title.'))
|
2007-04-23 17:16:26 +05:30
|
|
|
default_style.add_paragraph_style("FC-Title",p)
|
2006-07-25 04:48:51 +05:30
|
|
|
|
2007-04-23 17:16:26 +05:30
|
|
|
f = BaseDoc.FontStyle()
|
|
|
|
f.set_size(9)
|
|
|
|
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
|
|
|
|
p = BaseDoc.ParagraphStyle()
|
|
|
|
p.set_font(f)
|
|
|
|
p.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
|
|
|
|
p.set_description(_('The basic style used for the text display.'))
|
|
|
|
default_style.add_paragraph_style("text_style", p)
|
|
|
|
|
|
|
|
# GraphicsStyles
|
|
|
|
g = BaseDoc.GraphicsStyle()
|
|
|
|
g.set_paragraph_style('FC-Title')
|
|
|
|
g.set_line_width(0)
|
|
|
|
default_style.add_draw_style("t",g)
|
|
|
|
|
|
|
|
for i in range (0, self.MAX_GENERATIONS):
|
|
|
|
g = BaseDoc.GraphicsStyle()
|
|
|
|
g.set_fill_color(BACKGROUND_COLORS[i])
|
|
|
|
g.set_paragraph_style('FC-Normal')
|
|
|
|
background_style_name = 'background_style' + '%d' % i
|
|
|
|
default_style.add_draw_style(background_style_name,g)
|
|
|
|
|
|
|
|
g = BaseDoc.GraphicsStyle()
|
|
|
|
g.set_fill_color(BACKGROUND_COLORS[i])
|
|
|
|
g.set_paragraph_style('text_style')
|
|
|
|
g.set_line_width(0)
|
|
|
|
text_style_name = 'text_style' + '%d' % i
|
|
|
|
default_style.add_draw_style(text_style_name,g)
|
|
|
|
|
|
|
|
g = BaseDoc.GraphicsStyle()
|
|
|
|
g.set_fill_color((255,255,255))
|
|
|
|
g.set_paragraph_style('FC-Normal')
|
|
|
|
default_style.add_draw_style('background_style_white',g)
|
2006-07-25 04:48:51 +05:30
|
|
|
|
2003-08-30 04:17:06 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
2008-05-19 00:54:28 +05:30
|
|
|
pmgr = PluginManager.get_instance()
|
|
|
|
pmgr.register_report(
|
2005-01-02 12:10:08 +05:30
|
|
|
name = 'fan_chart',
|
2006-06-01 10:09:40 +05:30
|
|
|
category = CATEGORY_DRAW,
|
2005-01-02 12:10:08 +05:30
|
|
|
report_class = FanChart,
|
|
|
|
options_class = FanChartOptions,
|
2008-10-02 09:32:10 +05:30
|
|
|
modes = PluginManager.REPORT_MODE_GUI | \
|
|
|
|
PluginManager.REPORT_MODE_BKI | \
|
|
|
|
PluginManager.REPORT_MODE_CLI,
|
2008-03-02 04:17:48 +05:30
|
|
|
translated_name = _("Fan Chart"),
|
2005-12-06 12:08:09 +05:30
|
|
|
status = _("Stable"),
|
2005-01-02 12:10:08 +05:30
|
|
|
author_name = "Donald N. Allingham",
|
2005-12-06 12:08:09 +05:30
|
|
|
author_email = "don@gramps-project.org",
|
2006-07-25 04:48:51 +05:30
|
|
|
description = _("Produces fan charts")
|
2003-08-30 04:17:06 +05:30
|
|
|
)
|