Refactor various aspects of the report system.
svn: r9496
This commit is contained in:
@@ -219,7 +219,6 @@ class AncestorOptions(ReportOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
ReportOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'gen' : 10,
|
||||
|
||||
@@ -867,7 +867,6 @@ class ComprehensiveAncestorsOptions(ReportOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
ReportOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'cites' : 1,
|
||||
|
||||
@@ -78,6 +78,7 @@ from ReportBase._Constants import CATEGORY_BOOK, MODE_GUI, MODE_CLI
|
||||
from ReportBase._BookFormatComboBox import BookFormatComboBox
|
||||
from ReportBase._BareReportDialog import BareReportDialog
|
||||
from ReportBase._ReportDialog import ReportDialog
|
||||
from ReportBase._DocReportDialog import DocReportDialog
|
||||
from ReportBase._CommandLineReport import CommandLineReport
|
||||
from ReportBase._ReportOptions import ReportOptions
|
||||
|
||||
@@ -137,6 +138,7 @@ class BookItem:
|
||||
self.write_item = item[2]
|
||||
self.name = item[4]
|
||||
self.option_class = item[3](self.name)
|
||||
self.option_class.load_previous_values()
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
@@ -579,7 +581,6 @@ class BookOptions(ReportOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
ReportOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'bookname' : '',
|
||||
@@ -982,7 +983,7 @@ class BookItemDialog(BareReportDialog):
|
||||
# The final dialog - paper, format, target, etc.
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class BookReportDialog(ReportDialog):
|
||||
class BookReportDialog(DocReportDialog):
|
||||
"""
|
||||
A usual Report.Dialog subclass.
|
||||
|
||||
@@ -992,7 +993,7 @@ class BookReportDialog(ReportDialog):
|
||||
def __init__(self,dbstate,uistate,person,book,options):
|
||||
self.options = options
|
||||
self.page_html_added = False
|
||||
BareReportDialog.__init__(self,dbstate,uistate,person,options,
|
||||
DocReportDialog.__init__(self,dbstate,uistate,person,options,
|
||||
'book',_("Book Report"))
|
||||
self.book = book
|
||||
self.database = dbstate.db
|
||||
@@ -1038,7 +1039,6 @@ class BookReportDialog(ReportDialog):
|
||||
self.close()
|
||||
|
||||
def setup_style_frame(self): pass
|
||||
def setup_report_options_frame(self): pass
|
||||
def setup_other_frames(self): pass
|
||||
def parse_style_frame(self): pass
|
||||
|
||||
@@ -1065,11 +1065,8 @@ class BookReportDialog(ReportDialog):
|
||||
|
||||
def make_document(self):
|
||||
"""Create a document of the type requested by the user."""
|
||||
self.doc = self.format(self.selected_style,
|
||||
BaseDoc.PaperStyle(self.paper_size,
|
||||
self.paper_orientation,
|
||||
*self.paper_margins),
|
||||
self.template_name)
|
||||
pstyle = self.paper_frame.get_paper_style()
|
||||
self.doc = self.format(self.selected_style, pstyle, self.template_name)
|
||||
|
||||
self.rptlist = []
|
||||
for item in self.book.get_item_list():
|
||||
|
||||
@@ -180,7 +180,6 @@ class ChangeTypesOptions(Tool.ToolOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
Tool.ToolOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'fromtype' : '',
|
||||
|
||||
@@ -403,7 +403,6 @@ class CheckpointOptions(Tool.ToolOptions):
|
||||
def __init__(self, name, person_id=None):
|
||||
Tool.ToolOptions.__init__(self, name, person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'rcs' : 1,
|
||||
|
||||
@@ -224,7 +224,6 @@ class CmdRefOptions(Tool.ToolOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
Tool.ToolOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'include' : 0,
|
||||
|
||||
@@ -102,7 +102,6 @@ class CustomTextOptions(ReportOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
ReportOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'top' : '',
|
||||
@@ -117,9 +116,12 @@ class CustomTextOptions(ReportOptions):
|
||||
'bot' : ("=str","Final Text",
|
||||
"Whatever String You Wish"),
|
||||
}
|
||||
|
||||
def do_nothing(self):
|
||||
pass
|
||||
|
||||
def add_user_options(self,dialog):
|
||||
dialog.setup_center_person = dialog.setup_paper_frame
|
||||
dialog.setup_center_person = self.do_nothing #Disable center person
|
||||
dialog.notebook = gtk.Notebook()
|
||||
dialog.notebook.set_border_width(6)
|
||||
dialog.window.vbox.add(dialog.notebook)
|
||||
@@ -184,7 +186,7 @@ class CustomTextOptions(ReportOptions):
|
||||
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
|
||||
para.set(pad=0.5)
|
||||
para.set_description(_('The style used for the first portion of the custom text.'))
|
||||
default_style.add_style("CBT-Initial",para)
|
||||
default_style.add_paragraph_style("CBT-Initial",para)
|
||||
|
||||
font = BaseDoc.FontStyle()
|
||||
font.set(face=BaseDoc.FONT_SANS_SERIF,size=12,bold=0,italic=0)
|
||||
@@ -193,7 +195,7 @@ class CustomTextOptions(ReportOptions):
|
||||
para.set(pad=0.5)
|
||||
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
|
||||
para.set_description(_('The style used for the middle portion of the custom text.'))
|
||||
default_style.add_style("CBT-Middle",para)
|
||||
default_style.add_paragraph_style("CBT-Middle",para)
|
||||
|
||||
font = BaseDoc.FontStyle()
|
||||
font.set(face=BaseDoc.FONT_SANS_SERIF,size=12,bold=0,italic=0)
|
||||
@@ -202,7 +204,7 @@ class CustomTextOptions(ReportOptions):
|
||||
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
|
||||
para.set(pad=0.5)
|
||||
para.set_description(_('The style used for the last portion of the custom text.'))
|
||||
default_style.add_style("CBT-Final",para)
|
||||
default_style.add_paragraph_style("CBT-Final",para)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
@@ -198,7 +198,6 @@ class DescendantOptions(ReportOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
ReportOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'gen' : 10,
|
||||
|
||||
@@ -664,7 +664,6 @@ class DetAncestorOptions(ReportOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
ReportOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'gen' : 10,
|
||||
|
||||
@@ -627,7 +627,6 @@ class DetDescendantOptions(ReportOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
ReportOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'gen' : 10,
|
||||
|
||||
@@ -429,7 +429,6 @@ class EventComparisonOptions(Tool.ToolOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
Tool.ToolOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'filter' : 0,
|
||||
|
||||
@@ -625,7 +625,6 @@ class FamilyGroupOptions(ReportOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
ReportOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'family_id' : '',
|
||||
|
||||
@@ -786,7 +786,6 @@ class FamilyLinesOptions(ReportOptions):
|
||||
ReportOptions.__init__(self, name, None)
|
||||
self.dialog = dialog
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'FLfilename' : 'familylines.dot',
|
||||
|
||||
@@ -670,7 +670,6 @@ class MergeOptions(Tool.ToolOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
Tool.ToolOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'soundex' : 1,
|
||||
|
||||
@@ -656,7 +656,6 @@ class GraphVizOptions(ReportOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
ReportOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'filter' : 0,
|
||||
@@ -759,9 +758,6 @@ class GraphVizOptions(ReportOptions):
|
||||
|
||||
}
|
||||
|
||||
def make_doc_menu(self,dialog,active=None):
|
||||
pass
|
||||
|
||||
def add_list(self, options, default):
|
||||
"returns compobox of given options and default value"
|
||||
box = gtk.ComboBox()
|
||||
|
||||
@@ -544,7 +544,6 @@ class IndivCompleteOptions(ReportOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
ReportOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'filter' : 0,
|
||||
|
||||
@@ -328,8 +328,7 @@ class KinshipOptions(ReportOptions):
|
||||
|
||||
def __init__(self,name,person_id=None):
|
||||
ReportOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
|
||||
self.options_dict = {
|
||||
'maxdescend' : 2,
|
||||
'maxascend' : 2,
|
||||
|
||||
@@ -439,7 +439,6 @@ class MarkerOptions(ReportOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
ReportOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'marker' : "",
|
||||
|
||||
@@ -2666,8 +2666,7 @@ class WebReportOptions(ReportOptions):
|
||||
def __init__(self,name,database=None,person_id=None):
|
||||
ReportOptions.__init__(self,name,person_id)
|
||||
self.db = database
|
||||
|
||||
def set_new_options(self):
|
||||
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'NWEBfilter' : 0,
|
||||
@@ -3086,20 +3085,15 @@ class WebReportDialog(ReportDialog):
|
||||
"""The style frame is not used in this dialog."""
|
||||
self.options.handler.options_dict['NWEBarchive'] = int(
|
||||
self.archive.get_active())
|
||||
|
||||
def parse_html_frame(self):
|
||||
pass
|
||||
|
||||
def parse_paper_frame(self):
|
||||
pass
|
||||
|
||||
def setup_html_frame(self):
|
||||
def setup_report_options_frame(self):
|
||||
self.archive = gtk.CheckButton(_('Store web pages in .tar.gz archive'))
|
||||
self.archive.set_alignment(0.0,0.5)
|
||||
self.archive.set_active(
|
||||
self.options.handler.options_dict['NWEBarchive'])
|
||||
self.archive.connect('toggled',self.archive_toggle)
|
||||
self.add_option(None,self.archive)
|
||||
ReportDialog.setup_report_options_frame(self)
|
||||
|
||||
def archive_toggle(self,obj):
|
||||
if obj.get_active():
|
||||
@@ -3121,9 +3115,6 @@ class WebReportDialog(ReportDialog):
|
||||
fname = fname[:-7]
|
||||
self.target_fileentry.set_filename(fname)
|
||||
|
||||
def setup_paper_frame(self):
|
||||
pass
|
||||
|
||||
def get_title(self):
|
||||
"""The window title for this dialog"""
|
||||
return "%s - %s - GRAMPS" % (_("Generate Web Site"),_("Web Page"))
|
||||
|
||||
@@ -364,7 +364,6 @@ class CheckOptions(Tool.ToolOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
Tool.ToolOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'events' : 1,
|
||||
|
||||
@@ -122,7 +122,6 @@ class SimpleBookTitleOptions(ReportOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
ReportOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'title' : _('Title of the Book'),
|
||||
@@ -145,9 +144,12 @@ class SimpleBookTitleOptions(ReportOptions):
|
||||
"0 (to fit the page)."],
|
||||
False),
|
||||
}
|
||||
|
||||
def do_nothing(self):
|
||||
pass
|
||||
|
||||
def add_user_options(self,dialog):
|
||||
dialog.setup_center_person = dialog.setup_paper_frame
|
||||
dialog.setup_center_person = self.do_nothing #Disable center person
|
||||
dialog.notebook = gtk.Notebook()
|
||||
dialog.notebook.set_border_width(6)
|
||||
dialog.window.vbox.add(dialog.notebook)
|
||||
|
||||
@@ -670,8 +670,7 @@ class StatisticsChartOptions(ReportOptions):
|
||||
def __init__(self,name, person_id=None):
|
||||
ReportOptions.__init__(self, name, person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'filter' : 0,
|
||||
'gender' : Person.UNKNOWN,
|
||||
|
||||
@@ -1343,7 +1343,6 @@ class TestcaseGeneratorOptions(Tool.ToolOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
Tool.ToolOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'bugs' : 0,
|
||||
|
||||
@@ -301,7 +301,6 @@ class TimeLineOptions(ReportOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
ReportOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'filter' : 0,
|
||||
|
||||
@@ -697,7 +697,6 @@ class VerifyOptions(Tool.ToolOptions):
|
||||
def __init__(self,name,person_id=None):
|
||||
Tool.ToolOptions.__init__(self,name,person_id)
|
||||
|
||||
def set_new_options(self):
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'oldage' : 90,
|
||||
|
||||
+1
-14
@@ -674,8 +674,7 @@ class WebReportOptions(ReportOptions):
|
||||
def __init__(self,name,database=None,person_id=None):
|
||||
ReportOptions.__init__(self,name,person_id)
|
||||
self.db = database
|
||||
|
||||
def set_new_options(self):
|
||||
|
||||
# Options specific for this report
|
||||
self.options_dict = {
|
||||
'WCfilter' : 0,
|
||||
@@ -1046,21 +1045,9 @@ class WebReportDialog(ReportDialog):
|
||||
break
|
||||
self.close()
|
||||
|
||||
def parse_html_frame(self):
|
||||
pass
|
||||
|
||||
def parse_paper_frame(self):
|
||||
pass
|
||||
|
||||
def setup_html_frame(self):
|
||||
pass
|
||||
|
||||
def dummy_toggle(self,obj):
|
||||
pass
|
||||
|
||||
def setup_paper_frame(self):
|
||||
pass
|
||||
|
||||
def get_title(self):
|
||||
"""The window title for this dialog"""
|
||||
return "%s - GRAMPS" % (_("Generate Web Calendar"))
|
||||
|
||||
Reference in New Issue
Block a user