* src/Report.py (report): Support for VIEW reports.

* src/plugins/Summary.py: Convert to new scheme.
* src/plugins/CountAncestors.py: Convert to new scheme.


svn: r3859
This commit is contained in:
Alex Roitman 2005-01-02 23:48:39 +00:00
parent b6098a2251
commit 9e394c9205
4 changed files with 70 additions and 49 deletions

View File

@ -6,6 +6,10 @@
* src/plugins/AncestorChart2.py: Convert to new scheme. * src/plugins/AncestorChart2.py: Convert to new scheme.
* src/plugins/DesGraph.py: Convert to new scheme. * src/plugins/DesGraph.py: Convert to new scheme.
* src/Report.py (report): Support for VIEW reports.
* src/plugins/Summary.py: Convert to new scheme.
* src/plugins/CountAncestors.py: Convert to new scheme.
2005-01-01 Don Allingham <dallingham@users.sourceforge.net> 2005-01-01 Don Allingham <dallingham@users.sourceforge.net>
* src/EditPerson.py: move strip_id from Utils * src/EditPerson.py: move strip_id from Utils
* src/GrampsCfg.py: use ComboBox for toolbar selection * src/GrampsCfg.py: use ComboBox for toolbar selection

View File

@ -1726,7 +1726,7 @@ def report(database,person,report_class,options_class,translated_name,name,categ
dialog_class = TextReportDialog dialog_class = TextReportDialog
elif category == const.CATEGORY_DRAW: elif category == const.CATEGORY_DRAW:
dialog_class = DrawReportDialog dialog_class = DrawReportDialog
elif category == const.CATEGORY_BOOK: elif category in (const.CATEGORY_BOOK,const.CATEGORY_VIEW):
report_class(database,person) report_class(database,person)
return return
else: else:

View File

@ -23,22 +23,36 @@
"View/Number of ancestors" "View/Number of ancestors"
#------------------------------------------------------------------------
#
# standard python modules
#
#------------------------------------------------------------------------
import os import os
import Utils
from gettext import gettext as _ from gettext import gettext as _
from gnome.ui import *
import gtk
import gtk.glade
from sets import Set from sets import Set
def report(database,person): #------------------------------------------------------------------------
try: #
CountAncestors(database,person) # GNOME/GTK modules
except: #
import DisplayTrace #------------------------------------------------------------------------
DisplayTrace.DisplayTrace() import gtk.glade
#------------------------------------------------------------------------
#
# GRAMPS modules
#
#------------------------------------------------------------------------
import Utils
import const
import Report
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
class CountAncestors: class CountAncestors:
def __init__(self,database,person): def __init__(self,database,person):
@ -98,11 +112,13 @@ class CountAncestors:
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from Plugins import register_report from Plugins import register_report
register_report( register_report(
report, name = 'count_ancestors',
_("Number of ancestors"), category = const.CATEGORY_VIEW,
category=_("View"), report_class = CountAncestors,
description=_("Counts number of ancestors of selected person") options_class = None,
modes = Report.MODE_GUI,
translated_name = _("Number of ancestors"),
status = _("Beta"),
description= _("Counts number of ancestors of selected person")
) )

View File

@ -29,6 +29,14 @@
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import os import os
import posixpath import posixpath
from gettext import gettext as _
#------------------------------------------------------------------------
#
# GNOME/GTK modules
#
#------------------------------------------------------------------------
import gtk.glade
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -37,16 +45,8 @@ import posixpath
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import Utils import Utils
import RelLib import RelLib
from gettext import gettext as _ import const
import Report
#------------------------------------------------------------------------
#
# GNOME/GTK modules
#
#------------------------------------------------------------------------
import gtk
import gtk.glade
from gnome.ui import *
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -139,27 +139,27 @@ def build_report(database,person):
# Output report in a window # Output report in a window
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
def report(database,person): class SummaryReport:
def __init__(self,database,person):
text = build_report(database,person)
text = build_report(database,person) base = os.path.dirname(__file__)
glade_file = "%s/summary.glade" % base
base = os.path.dirname(__file__)
glade_file = "%s/summary.glade" % base
topDialog = gtk.glade.XML(glade_file,"summary","gramps") topDialog = gtk.glade.XML(glade_file,"summary","gramps")
topDialog.signal_autoconnect({ topDialog.signal_autoconnect({
"destroy_passed_object" : Utils.destroy_passed_object, "destroy_passed_object" : Utils.destroy_passed_object,
}) })
Utils.set_titles(topDialog.get_widget('summary'), Utils.set_titles(topDialog.get_widget('summary'),
topDialog.get_widget('title'), topDialog.get_widget('title'),
_('Database summary')) _('Database summary'))
top = topDialog.get_widget("summary") top = topDialog.get_widget("summary")
textwindow = topDialog.get_widget("textwindow") textwindow = topDialog.get_widget("textwindow")
textwindow.get_buffer().set_text(text) textwindow.get_buffer().set_text(text)
top.show() top.show()
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -167,12 +167,13 @@ def report(database,person):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from Plugins import register_report from Plugins import register_report
register_report( register_report(
report, name = 'summary',
_("Summary of the database"), category = const.CATEGORY_VIEW,
status=(_("Beta")), report_class = SummaryReport,
category=_("View"), options_class = None,
description=_("Provides a summary of the current database") modes = Report.MODE_GUI,
translated_name = _("Summary of the database"),
status = _("Beta"),
description= _("Provides a summary of the current database"),
) )