Convert DescendReport and AncestorReport to use MenuOption.
svn: r9599
This commit is contained in:
parent
65f93ebe47
commit
3708d4f73f
@ -1,3 +1,8 @@
|
|||||||
|
2007-12-27 Brian Matherly <brian@gramps-project.org>
|
||||||
|
* src/plugins/DescendReport.py:
|
||||||
|
* src/plugins/AncestorReport.py:
|
||||||
|
Convert to use MenuOption
|
||||||
|
|
||||||
2007-12-27 Douglas S. Blank <dblank@cs.brynmawr.edu>
|
2007-12-27 Douglas S. Blank <dblank@cs.brynmawr.edu>
|
||||||
* src/DataViews/MyGrampsView.py:
|
* src/DataViews/MyGrampsView.py:
|
||||||
* src/DataViews/SourceView.py:
|
* src/DataViews/SourceView.py:
|
||||||
|
@ -37,8 +37,8 @@ from gettext import gettext as _
|
|||||||
# gramps modules
|
# gramps modules
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
from PluginUtils import register_report
|
from PluginUtils import register_report, NumberOption, BooleanOption
|
||||||
from ReportBase import Report, ReportUtils, ReportOptions, \
|
from ReportBase import Report, ReportUtils, ReportOptions, MenuReportOptions, \
|
||||||
CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
|
CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
|
||||||
import BaseDoc
|
import BaseDoc
|
||||||
from BasicUtils import name_displayer
|
from BasicUtils import name_displayer
|
||||||
@ -76,7 +76,7 @@ class AncestorReport(Report):
|
|||||||
Report.__init__(self,database,person,options_class)
|
Report.__init__(self,database,person,options_class)
|
||||||
|
|
||||||
self.map = {}
|
self.map = {}
|
||||||
self.max_generations = options_class.handler.options_dict['gen']
|
self.max_generations = options_class.handler.options_dict['maxgen']
|
||||||
self.pgbrk = options_class.handler.options_dict['pagebbg']
|
self.pgbrk = options_class.handler.options_dict['pagebbg']
|
||||||
self.opt_namebrk = options_class.handler.options_dict['namebrk']
|
self.opt_namebrk = options_class.handler.options_dict['namebrk']
|
||||||
|
|
||||||
@ -211,31 +211,34 @@ class AncestorReport(Report):
|
|||||||
|
|
||||||
self.doc.end_paragraph()
|
self.doc.end_paragraph()
|
||||||
|
|
||||||
class AncestorOptions(ReportOptions):
|
#------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# AncestorOptions
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
class AncestorOptions(MenuReportOptions):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Defines options and provides handling interface.
|
Defines options and provides handling interface.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,name,person_id=None):
|
def __init__(self,name,person_id=None):
|
||||||
ReportOptions.__init__(self,name,person_id)
|
MenuReportOptions.__init__(self,name,person_id)
|
||||||
|
|
||||||
# Options specific for this report
|
def add_menu_options(self,menu):
|
||||||
self.options_dict = {
|
category_name = _("Report Options")
|
||||||
'gen' : 10,
|
|
||||||
'pagebbg' : 0,
|
maxgen = NumberOption(_("Generations"),10,1,15)
|
||||||
'namebrk' : 0,
|
maxgen.set_help(_("The number of generations to include in the report"))
|
||||||
}
|
menu.add_option(category_name,"maxgen",maxgen)
|
||||||
self.options_help = {
|
|
||||||
'gen' : ("=int","Generations",
|
pagebbg = BooleanOption(_("Page break between generations"),False)
|
||||||
"The number of generations to include in the report",
|
pagebbg.set_help(_("Whether to start a new page after each generation."))
|
||||||
True),
|
menu.add_option(category_name,"pagebbg",pagebbg)
|
||||||
'pagebbg' : ("=0/1","Page Break Between Generations",
|
|
||||||
["No line break", "Insert line break"],
|
namebrk = BooleanOption(_("Add linebreak after each name"),False)
|
||||||
False),
|
namebrk.set_help(_("Indicates if a line break should follow the name."))
|
||||||
'namebrk' : ("=0/1","Indicates if a line break should follow the name.",
|
menu.add_option(category_name,"namebrk",namebrk)
|
||||||
["No line break", "Insert line break"],
|
|
||||||
False),
|
|
||||||
}
|
|
||||||
|
|
||||||
def make_default_style(self,default_style):
|
def make_default_style(self,default_style):
|
||||||
"""
|
"""
|
||||||
@ -304,32 +307,6 @@ class AncestorOptions(ReportOptions):
|
|||||||
para.set_description(_('The basic style used for the text display.'))
|
para.set_description(_('The basic style used for the text display.'))
|
||||||
default_style.add_paragraph_style("AHN-Entry",para)
|
default_style.add_paragraph_style("AHN-Entry",para)
|
||||||
|
|
||||||
def add_user_options(self,dialog):
|
|
||||||
"""
|
|
||||||
Override the base class add_user_options task to add a check box to
|
|
||||||
the dialog that for the LineBreak option.
|
|
||||||
"""
|
|
||||||
self.max_gen = gtk.SpinButton(gtk.Adjustment(1,1,100,1))
|
|
||||||
self.max_gen.set_value(self.options_dict['gen'])
|
|
||||||
dialog.add_option(_('Generations'),self.max_gen)
|
|
||||||
|
|
||||||
self.cb_pagebreak = gtk.CheckButton (_("Page break between generations"))
|
|
||||||
self.cb_pagebreak.set_active (self.options_dict['pagebbg'])
|
|
||||||
dialog.add_option ('', self.cb_pagebreak)
|
|
||||||
|
|
||||||
self.cb_break = gtk.CheckButton (_("Add linebreak after each name"))
|
|
||||||
self.cb_break.set_active (self.options_dict['namebrk'])
|
|
||||||
dialog.add_option ('', self.cb_break)
|
|
||||||
|
|
||||||
def parse_user_options(self,dialog):
|
|
||||||
"""
|
|
||||||
Parses the custom options that we have added. Set the value in the
|
|
||||||
options dictionary.
|
|
||||||
"""
|
|
||||||
self.options_dict['gen'] = self.max_gen.get_value_as_int()
|
|
||||||
self.options_dict['pagebbg'] = int(self.cb_pagebreak.get_active ())
|
|
||||||
self.options_dict['namebrk'] = int(self.cb_break.get_active ())
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Register the plugin
|
# Register the plugin
|
||||||
|
@ -36,8 +36,8 @@ from gettext import gettext as _
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
from PluginUtils import register_report
|
from PluginUtils import register_report, NumberOption
|
||||||
from ReportBase import Report, ReportUtils, ReportOptions, \
|
from ReportBase import Report, ReportUtils, ReportOptions, MenuReportOptions, \
|
||||||
CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
|
CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
|
||||||
import BaseDoc
|
import BaseDoc
|
||||||
import Errors
|
import Errors
|
||||||
@ -186,42 +186,24 @@ class DescendantReport(Report):
|
|||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
# AncestorOptions
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
class DescendantOptions(ReportOptions):
|
class DescendantOptions(MenuReportOptions):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Defines options and provides handling interface.
|
Defines options and provides handling interface.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,name,person_id=None):
|
def __init__(self,name,person_id=None):
|
||||||
ReportOptions.__init__(self,name,person_id)
|
MenuReportOptions.__init__(self,name,person_id)
|
||||||
|
|
||||||
# Options specific for this report
|
def add_menu_options(self,menu):
|
||||||
self.options_dict = {
|
category_name = _("Report Options")
|
||||||
'gen' : 10,
|
|
||||||
}
|
|
||||||
self.options_help = {
|
|
||||||
'gen' : ("=int","Generations",
|
|
||||||
"The number of generations to include in the report",
|
|
||||||
True),
|
|
||||||
}
|
|
||||||
|
|
||||||
def add_user_options(self,dialog):
|
gen = NumberOption(_("Generations"),10,1,15)
|
||||||
"""
|
gen.set_help(_("The number of generations to include in the report"))
|
||||||
Override the base class add_user_options task to add generations option
|
menu.add_option(category_name,"gen",gen)
|
||||||
"""
|
|
||||||
self.max_gen = gtk.SpinButton(gtk.Adjustment(1,1,100,1))
|
|
||||||
self.max_gen.set_value(self.options_dict['gen'])
|
|
||||||
dialog.add_option(_('Generations'),self.max_gen)
|
|
||||||
|
|
||||||
def parse_user_options(self,dialog):
|
|
||||||
"""
|
|
||||||
Parses the custom options that we have added. Set the value in the
|
|
||||||
options dictionary.
|
|
||||||
"""
|
|
||||||
self.options_dict['gen'] = 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 Descendant Report."""
|
"""Make the default output style for the Descendant Report."""
|
||||||
|
Loading…
Reference in New Issue
Block a user