* all reports: switch categories from const to Report module.

svn: r5243
This commit is contained in:
Alex Roitman 2005-09-27 04:54:17 +00:00
parent f517351802
commit 4d3a6ffae7
28 changed files with 68 additions and 84 deletions

View File

@ -1,3 +1,6 @@
2005-09-26 Alex Roitman <shura@gramps-project.org>
* all reports: switch categories from const to Report module.
2005-09-26 Don Allingham <don@gramps-project.org>
* src/docgen/PSDrawDoc.py: locale independent floating point
* src/DateDisplay.py: Better french republican date handling

View File

@ -608,8 +608,8 @@ class ArgHandler:
category = item[1]
report_class = item[2]
options_class = item[3]
if category in (const.CATEGORY_BOOK,const.CATEGORY_CODE,
const.CATEGORY_WEB):
if category in (Report.CATEGORY_BOOK,Report.CATEGORY_CODE,
Report.CATEGORY_WEB):
options_class(self.parent.db,name,
category,options_str_dict)
else:

View File

@ -87,6 +87,28 @@ MODE_GUI = 1 # Standalone report using GUI
MODE_BKI = 2 # Book Item interface using GUI
MODE_CLI = 4 # Command line interface (CLI)
# Report categories
CATEGORY_TEXT = 0
CATEGORY_DRAW = 1
CATEGORY_CODE = 2
CATEGORY_WEB = 3
CATEGORY_VIEW = 4
CATEGORY_BOOK = 5
standalone_categories = {
CATEGORY_TEXT : _("Text Reports"),
CATEGORY_DRAW : _("Graphical Reports"),
CATEGORY_CODE : _("Code Generators"),
CATEGORY_WEB : _("Web Page"),
CATEGORY_VIEW : _("View"),
CATEGORY_BOOK : _("Books"),
}
book_categories = {
CATEGORY_TEXT : _("Text"),
CATEGORY_DRAW : _("Graphics"),
}
#-------------------------------------------------------------------------
#
# Support for printing generated files
@ -1465,7 +1487,7 @@ class TextReportDialog(ReportDialog):
"""Initialize a dialog to request that the user select options
for a basic text report. See the ReportDialog class for more
information."""
self.category = const.CATEGORY_TEXT
self.category = CATEGORY_TEXT
ReportDialog.__init__(self,database,person,options,name,translated_name)
#------------------------------------------------------------------------
@ -1503,7 +1525,7 @@ class DrawReportDialog(ReportDialog):
"""Initialize a dialog to request that the user select options
for a basic drawing report. See the ReportDialog class for
more information."""
self.category = const.CATEGORY_DRAW
self.category = CATEGORY_DRAW
ReportDialog.__init__(self,database,person,opt,name,translated_name)
#------------------------------------------------------------------------
@ -1677,7 +1699,7 @@ class CommandLineReport:
self.option_class.handler.output = self.options_dict['of']
self.options_help['of'].append(os.path.expanduser("~/whatever_name"))
if self.category == const.CATEGORY_TEXT:
if self.category == CATEGORY_TEXT:
for item in PluginMgr.textdoc_list:
if item[7] == self.options_dict['off']:
self.format = item[1]
@ -1685,7 +1707,7 @@ class CommandLineReport:
[ item[7] for item in PluginMgr.textdoc_list ]
)
self.options_help['off'].append(False)
elif self.category == const.CATEGORY_DRAW:
elif self.category == CATEGORY_DRAW:
for item in PluginMgr.drawdoc_list:
if item[6] == self.options_dict['off']:
self.format = item[1]
@ -1693,7 +1715,7 @@ class CommandLineReport:
[ item[6] for item in PluginMgr.drawdoc_list ]
)
self.options_help['off'].append(False)
elif self.category == const.CATEGORY_BOOK:
elif self.category == CATEGORY_BOOK:
for item in PluginMgr.bookdoc_list:
if item[6] == self.options_dict['off']:
self.format = item[1]
@ -1722,7 +1744,7 @@ class CommandLineReport:
self.template_name = self.options_dict['template']
self.options_help['template'].append(os.path.expanduser("~/whatever_name"))
if self.category in (const.CATEGORY_TEXT,const.CATEGORY_DRAW):
if self.category in (CATEGORY_TEXT,CATEGORY_DRAW):
default_style = BaseDoc.StyleSheet()
self.option_class.make_default_style(default_style)
@ -1778,12 +1800,12 @@ def report(database,person,report_class,options_class,translated_name,name,categ
its arguments.
"""
if category == const.CATEGORY_TEXT:
if category == CATEGORY_TEXT:
dialog_class = TextReportDialog
elif category == const.CATEGORY_DRAW:
elif category == CATEGORY_DRAW:
dialog_class = DrawReportDialog
elif category in (const.CATEGORY_BOOK,const.CATEGORY_VIEW,
const.CATEGORY_CODE,const.CATEGORY_WEB):
elif category in (CATEGORY_BOOK,CATEGORY_VIEW,
CATEGORY_CODE,CATEGORY_WEB):
report_class(database,person)
return
else:

View File

@ -930,28 +930,6 @@ notes_formats = [
_("Preformatted"),
]
CATEGORY_TEXT = 0
CATEGORY_DRAW = 1
CATEGORY_CODE = 2
CATEGORY_WEB = 3
CATEGORY_VIEW = 4
CATEGORY_BOOK = 5
standalone_categories = {
CATEGORY_TEXT : _("Text Reports"),
CATEGORY_DRAW : _("Graphical Reports"),
CATEGORY_CODE : _("Code Generators"),
CATEGORY_WEB : _("Web Page"),
CATEGORY_VIEW : _("View"),
CATEGORY_BOOK : _("Books"),
}
book_categories = {
CATEGORY_TEXT : _("Text"),
CATEGORY_DRAW : _("Graphics"),
}
TOOL_DEBUG = -1
TOOL_ANAL = 0
TOOL_DBPROC = 1

View File

@ -45,7 +45,6 @@ import BaseDoc
import Report
from SubstKeywords import SubstKeywords
from ReportUtils import pt2cm
import const
import ReportOptions
#------------------------------------------------------------------------
@ -265,7 +264,7 @@ class AncestorChartOptions(ReportOptions.ReportOptions):
from PluginMgr import register_report
register_report(
name = 'ancestor_chart',
category = const.CATEGORY_DRAW,
category = Report.CATEGORY_DRAW,
report_class = AncestorChart,
options_class = AncestorChartOptions,
modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI,

View File

@ -46,7 +46,6 @@ import BaseDoc
import Report
from SubstKeywords import SubstKeywords
from ReportUtils import pt2cm, cm2pt
import const
import ReportOptions
#------------------------------------------------------------------------
@ -516,7 +515,7 @@ class AncestorChartOptions(ReportOptions.ReportOptions):
from PluginMgr import register_report
register_report(
name = 'ancestor_chart2',
category = const.CATEGORY_DRAW,
category = Report.CATEGORY_DRAW,
report_class = AncestorChart,
options_class = AncestorChartOptions,
modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI,

View File

@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2004 Donald N. Allingham
# Copyright (C) 2000-2005 Donald N. Allingham
#
# 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
@ -28,7 +28,6 @@
#
#------------------------------------------------------------------------
import os
import string
from gettext import gettext as _
#------------------------------------------------------------------------
@ -43,7 +42,6 @@ import Errors
from DateHandler import displayer as _dd
from QuestionDialog import ErrorDialog
import ReportOptions
import const
#------------------------------------------------------------------------
#
@ -160,7 +158,7 @@ class AncestorReport(Report.Report):
buried = None
for event_handle in person.get_event_list():
event = self.database.get_event_from_handle(event_handle)
if string.lower(event.get_name()) == "burial":
if event.get_name().lower() == "burial":
buried = event
death_handle = person.get_death_handle()
@ -298,7 +296,7 @@ class AncestorOptions(ReportOptions.ReportOptions):
from PluginMgr import register_report
register_report(
name = 'ancestor_report',
category = const.CATEGORY_TEXT,
category = Report.CATEGORY_TEXT,
report_class = AncestorReport,
options_class = AncestorOptions,
modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI,

View File

@ -961,7 +961,7 @@ class ComprehensiveAncestorsOptions(ReportOptions.ReportOptions):
#------------------------------------------------------------------------
PluginMgr.register_report(
name = 'ancestors_report',
category = const.CATEGORY_TEXT,
category = Report.CATEGORY_TEXT,
report_class = ComprehensiveAncestorsReport,
options_class = ComprehensiveAncestorsOptions,
modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI,

View File

@ -56,7 +56,6 @@ import gtk.glade
#-------------------------------------------------------------------------
from RelLib import Person
import const
import Utils
import ListModel
import PluginMgr
@ -1109,7 +1108,7 @@ def cl_report(database,name,category,options_str_dict):
#------------------------------------------------------------------------
PluginMgr.register_report(
name = 'book',
category = const.CATEGORY_BOOK,
category = Report.CATEGORY_BOOK,
report_class = BookReportSelector,
options_class = cl_report,
modes = Report.MODE_GUI | Report.MODE_CLI,

View File

@ -45,7 +45,6 @@ import gtk.glade
#
#------------------------------------------------------------------------
import Utils
import const
import Report
#------------------------------------------------------------------------
@ -114,7 +113,7 @@ class CountAncestors:
from PluginMgr import register_report
register_report(
name = 'count_ancestors',
category = const.CATEGORY_VIEW,
category = Report.CATEGORY_VIEW,
report_class = CountAncestors,
options_class = None,
modes = Report.MODE_GUI,

View File

@ -43,7 +43,6 @@ import gtk
#------------------------------------------------------------------------
import Report
import BaseDoc
import const
import ReportOptions
#------------------------------------------------------------------------
@ -213,7 +212,7 @@ class CustomTextOptions(ReportOptions.ReportOptions):
from PluginMgr import register_report
register_report(
name = 'custom_text',
category = const.CATEGORY_TEXT,
category = Report.CATEGORY_TEXT,
report_class = CustomText,
options_class = CustomTextOptions,
modes = Report.MODE_BKI,

View File

@ -46,7 +46,6 @@ import BaseDoc
import Report
from SubstKeywords import SubstKeywords
from ReportUtils import pt2cm, cm2pt
import const
import ReportOptions
import NameDisplay
@ -467,7 +466,7 @@ class DescendChartOptions(ReportOptions.ReportOptions):
from PluginMgr import register_report
register_report(
name = 'descend_chart2',
category = const.CATEGORY_DRAW,
category = Report.CATEGORY_DRAW,
report_class = DescendChart,
options_class = DescendChartOptions,
modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI,

View File

@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2004 Donald N. Allingham
# Copyright (C) 2000-2005 Donald N. Allingham
#
# 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
@ -42,7 +42,6 @@ import Sort
from QuestionDialog import ErrorDialog
import ReportOptions
import ReportUtils
import const
import NameDisplay
#------------------------------------------------------------------------
@ -247,7 +246,7 @@ class DescendantOptions(ReportOptions.ReportOptions):
from PluginMgr import register_report
register_report(
name = 'descend_report',
category = const.CATEGORY_TEXT,
category = Report.CATEGORY_TEXT,
report_class = DescendantReport,
options_class = DescendantOptions,
modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI,

View File

@ -816,7 +816,7 @@ class DetAncestorOptions(ReportOptions.ReportOptions):
from PluginMgr import register_report
register_report(
name = 'det_ancestor_report',
category = const.CATEGORY_TEXT,
category = Report.CATEGORY_TEXT,
report_class = DetAncestorReport,
options_class = DetAncestorOptions,
modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI,

View File

@ -842,7 +842,7 @@ class DetDescendantOptions(ReportOptions.ReportOptions):
from PluginMgr import register_report
register_report(
name = 'det_descendant_report',
category = const.CATEGORY_TEXT,
category = Report.CATEGORY_TEXT,
report_class = DetDescendantReport,
options_class = DetDescendantOptions,
modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI,

View File

@ -45,7 +45,6 @@ import RelLib
import Report
import BaseDoc
import ReportOptions
import const
from DateHandler import displayer as _dd
#------------------------------------------------------------------------
@ -541,7 +540,7 @@ class FamilyGroupOptions(ReportOptions.ReportOptions):
from PluginMgr import register_report
register_report(
name = 'family_group',
category = const.CATEGORY_TEXT,
category = Report.CATEGORY_TEXT,
report_class = FamilyGroup,
options_class = FamilyGroupOptions,
modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI,

View File

@ -42,7 +42,6 @@ import gtk
import BaseDoc
import Report
import ReportOptions
import const
from SubstKeywords import SubstKeywords
from ReportUtils import pt2cm
@ -317,7 +316,7 @@ class FanChartOptions(ReportOptions.ReportOptions):
from PluginMgr import register_report
register_report(
name = 'fan_chart',
category = const.CATEGORY_DRAW,
category = Report.CATEGORY_DRAW,
report_class = FanChart,
options_class = FanChartOptions,
modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI,

View File

@ -39,7 +39,6 @@ import BaseDoc
import RelLib
import ReportOptions
from DateHandler import displayer as dd
import const
import ReportUtils
#------------------------------------------------------------------------
@ -416,7 +415,7 @@ from PluginMgr import register_report
register_report(
name = 'ftm_ancestor_report',
category = const.CATEGORY_TEXT,
category = Report.CATEGORY_TEXT,
report_class = FtmAncestorReport,
options_class = FtmAncestorOptions,
modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI,

View File

@ -43,7 +43,6 @@ import RelLib
import ReportUtils
import ReportOptions
from DateHandler import displayer as dd
import const
#------------------------------------------------------------------------
#
@ -564,7 +563,7 @@ class FtmDescendantOptions(ReportOptions.ReportOptions):
from PluginMgr import register_report
register_report(
name = 'ftm_descendant_report',
category = const.CATEGORY_TEXT,
category = Report.CATEGORY_TEXT,
report_class = FtmDescendantReport,
options_class = FtmDescendantOptions,
modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI,

View File

@ -47,7 +47,6 @@ import gtk
import Report
import ReportOptions
import GenericFilter
import const
import RelLib
from BaseDoc import PAPER_LANDSCAPE
from latin_utf8 import utf8_to_latin
@ -754,7 +753,7 @@ class GraphVizDialog(Report.ReportDialog):
name = "rel_graph"
translated_name = _("Relationship Graph")
self.options_class = GraphVizOptions(name)
self.category = const.CATEGORY_CODE
self.category = Report.CATEGORY_CODE
Report.ReportDialog.__init__(self,database,person,self.options_class,
name,translated_name)
@ -960,7 +959,7 @@ def get_description_graphics():
from PluginMgr import register_report
register_report(
name = 'rel_graph',
category = const.CATEGORY_CODE,
category = Report.CATEGORY_CODE,
report_class = GraphVizDialog,
options_class = cl_report,
modes = Report.MODE_GUI | Report.MODE_CLI,
@ -974,7 +973,7 @@ register_report(
if dot_found:
register_report(
name = 'rel_graph2',
category = const.CATEGORY_DRAW,
category = Report.CATEGORY_DRAW,
report_class = GraphVizGraphics,
options_class = GraphVizOptions,
modes = Report.MODE_GUI | Report.MODE_CLI,

View File

@ -587,7 +587,7 @@ from PluginMgr import register_report
register_report(
name = 'indiv_complete',
category = const.CATEGORY_TEXT,
category = Report.CATEGORY_TEXT,
report_class = IndivCompleteReport,
options_class = IndivCompleteOptions,
modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI,

View File

@ -47,7 +47,6 @@ import const
import BaseDoc
import Report
import ReportOptions
import const
#------------------------------------------------------------------------
#
@ -383,7 +382,7 @@ from PluginMgr import register_report
register_report(
name = 'individual_summary',
category = const.CATEGORY_TEXT,
category = Report.CATEGORY_TEXT,
report_class = IndivSummary,
options_class = IndivSummaryOptions,
modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI,

View File

@ -2376,7 +2376,7 @@ class WebReportDialog(Report.ReportDialog):
name = "navwebpage"
translated_name = _("Generate Web Site")
self.options = WebReportOptions(name,database)
self.category = const.CATEGORY_WEB
self.category = Report.CATEGORY_WEB
Report.ReportDialog.__init__(self,database,person,self.options,
name,translated_name)
self.style_name = None
@ -2620,7 +2620,7 @@ def sort_nameof(person, private):
from PluginMgr import register_report
register_report(
name = 'navwebpage',
category = const.CATEGORY_WEB,
category = Report.CATEGORY_WEB,
report_class = WebReportDialog,
options_class = cl_report,
modes = Report.MODE_GUI,

View File

@ -45,7 +45,6 @@ import Report
import BaseDoc
import SelectObject
import AddMedia
import const
import ReportOptions
import ImgManip
@ -295,7 +294,7 @@ class SimpleBookTitleOptions(ReportOptions.ReportOptions):
from PluginMgr import register_report
register_report(
name = 'simple_book_title',
category = const.CATEGORY_TEXT,
category = Report.CATEGORY_TEXT,
report_class = SimpleBookTitle,
options_class = SimpleBookTitleOptions,
modes = Report.MODE_BKI,

View File

@ -52,7 +52,6 @@ import gtk
# Person and relation types
from RelLib import Person, Family
# gender and report type names
import const
import BaseDoc
import Report
import ReportUtils
@ -974,7 +973,7 @@ from PluginMgr import register_report
register_report(
name = 'statistics_chart',
category = const.CATEGORY_DRAW,
category = Report.CATEGORY_DRAW,
report_class = StatisticsChart,
options_class = StatisticsChartOptions,
modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI,

View File

@ -45,7 +45,6 @@ import gtk.glade
#------------------------------------------------------------------------
import Utils
import RelLib
import const
import Report
#------------------------------------------------------------------------
@ -170,7 +169,7 @@ from PluginMgr import register_report
register_report(
name = 'summary',
category = const.CATEGORY_VIEW,
category = Report.CATEGORY_VIEW,
report_class = SummaryReport,
options_class = None,
modes = Report.MODE_GUI,

View File

@ -51,7 +51,6 @@ import GenericFilter
import Sort
import ReportOptions
from QuestionDialog import ErrorDialog
import const
#------------------------------------------------------------------------
#
@ -472,7 +471,7 @@ from PluginMgr import register_report
register_report(
name = 'timeline',
category = const.CATEGORY_DRAW,
category = Report.CATEGORY_DRAW,
report_class = TimeLine,
options_class = TimeLineOptions,
modes = Report.MODE_GUI | Report.MODE_BKI | Report.MODE_CLI,

View File

@ -1770,7 +1770,7 @@ class WebReportDialog(Report.ReportDialog):
name = "webpage"
translated_name = _("Generate Web Site")
self.options_class = WebReportOptions(name)
self.category = const.CATEGORY_WEB
self.category = Report.CATEGORY_WEB
Report.ReportDialog.__init__(self,database,person,self.options_class,
name,translated_name)
@ -1968,7 +1968,7 @@ def cl_report(database,name,category,options_str_dict):
from PluginMgr import register_report
register_report(
name = 'webpage',
category = const.CATEGORY_WEB,
category = Report.CATEGORY_WEB,
report_class = WebReportDialog,
options_class = cl_report,
modes = Report.MODE_GUI | Report.MODE_CLI,