* src/plugins/DescendChart.py: Fix spacing and line drawing,

added maximum number of generations


svn: r5128
This commit is contained in:
Don Allingham 2005-08-26 20:10:56 +00:00
parent 15a3999422
commit 293f89e73b
2 changed files with 18 additions and 6 deletions

View File

@ -1,5 +1,6 @@
2005-08-26 Don Allingham <don@gramps-project.org> 2005-08-26 Don Allingham <don@gramps-project.org>
* src/plugins/DescendChart.py: Fix spacing and line drawing * src/plugins/DescendChart.py: Fix spacing and line drawing,
added maximum number of generations
2005-08-25 Don Allingham <don@gramps-project.org> 2005-08-25 Don Allingham <don@gramps-project.org>
* src/SubstKeywords: Add new % options * src/SubstKeywords: Add new % options

View File

@ -119,10 +119,10 @@ class DescendChart(Report.Report):
This report needs the following parameters (class variables) This report needs the following parameters (class variables)
that come in the options class. that come in the options class.
gen - Maximum number of generations to include.
dispf - Display format for the output box. dispf - Display format for the output box.
singlep - Whether to scale to fit on a single page. singlep - Whether to scale to fit on a single page.
title - Title of the report displayed on top. title - Title of the report displayed on top.
maxgen - Maximum number of generations to include.
""" """
Report.Report.__init__(self,database,person,options_class) Report.Report.__init__(self,database,person,options_class)
@ -131,6 +131,7 @@ class DescendChart(Report.Report):
self.display = options_class.handler.options_dict['dispf'] self.display = options_class.handler.options_dict['dispf']
self.force_fit = options_class.handler.options_dict['singlep'] self.force_fit = options_class.handler.options_dict['singlep']
self.title = options_class.handler.options_dict['title'].strip() self.title = options_class.handler.options_dict['title'].strip()
self.max_gen = options_class.handler.options_dict['maxgen']
self.map = {} self.map = {}
self.text = {} self.text = {}
@ -154,6 +155,9 @@ class DescendChart(Report.Report):
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 x/2 >= self.max_gen:
return 0
self.genchart.set_xy(x,y,person_handle) self.genchart.set_xy(x,y,person_handle)
person = self.database.get_person_from_handle(person_handle) person = self.database.get_person_from_handle(person_handle)
@ -383,6 +387,7 @@ class DescendChartOptions(ReportOptions.ReportOptions):
self.options_dict = { self.options_dict = {
'singlep' : 1, 'singlep' : 1,
'title' : '', 'title' : '',
'maxgen' : 32,
} }
self.options_help = { self.options_help = {
'singlep' : ("=0/1","Whether to scale to fit on a single page.", 'singlep' : ("=0/1","Whether to scale to fit on a single page.",
@ -410,10 +415,6 @@ class DescendChartOptions(ReportOptions.ReportOptions):
""" """
dialog.get_report_extra_textbox_info = self.get_textbox_info dialog.get_report_extra_textbox_info = self.get_textbox_info
self.scale = gtk.CheckButton(_('Sc_ale to fit on a single page'))
self.scale.set_active(self.options_dict['singlep'])
dialog.add_option('',self.scale)
self.title_box = gtk.Entry() self.title_box = gtk.Entry()
if self.options_dict['title']: if self.options_dict['title']:
self.title_box.set_text(self.options_dict['title']) self.title_box.set_text(self.options_dict['title'])
@ -422,12 +423,22 @@ class DescendChartOptions(ReportOptions.ReportOptions):
self.title_box.set_text(dialog.get_header(name)) self.title_box.set_text(dialog.get_header(name))
dialog.add_option(_('Title'),self.title_box) dialog.add_option(_('Title'),self.title_box)
self.scale = gtk.CheckButton(_('Sc_ale to fit on a single page'))
self.scale.set_active(self.options_dict['singlep'])
dialog.add_option('',self.scale)
self.max_gen = gtk.SpinButton(gtk.Adjustment(1,1,100,1))
self.max_gen.set_value(self.options_dict['maxgen'])
dialog.add_option(_('Generations'),self.max_gen)
def parse_user_options(self,dialog): def parse_user_options(self,dialog):
""" """
Parses the custom options that we have added. Parses the custom options that we have added.
""" """
self.options_dict['singlep'] = int(self.scale.get_active ()) self.options_dict['singlep'] = int(self.scale.get_active ())
self.options_dict['title'] = unicode(self.title_box.get_text()).strip() self.options_dict['title'] = unicode(self.title_box.get_text()).strip()
self.options_dict['maxgen'] = int(self.max_gen.get_value_as_int())
def make_default_style(self,default_style): def make_default_style(self,default_style):
"""Make the default output style for the Ancestor Chart report.""" """Make the default output style for the Ancestor Chart report."""