From ad6261ae4793373bf06af76c41f50964de17800e Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Sun, 2 Jan 2005 23:48:39 +0000 Subject: [PATCH] * 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 --- gramps2/ChangeLog | 4 ++ gramps2/src/Report.py | 2 +- gramps2/src/plugins/CountAncestors.py | 50 +++++++++++++-------- gramps2/src/plugins/Summary.py | 63 ++++++++++++++------------- 4 files changed, 70 insertions(+), 49 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 8cf3080c7..f7d6e07f1 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -6,6 +6,10 @@ * src/plugins/AncestorChart2.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 * src/EditPerson.py: move strip_id from Utils * src/GrampsCfg.py: use ComboBox for toolbar selection diff --git a/gramps2/src/Report.py b/gramps2/src/Report.py index b376b5524..06ea25f72 100644 --- a/gramps2/src/Report.py +++ b/gramps2/src/Report.py @@ -1726,7 +1726,7 @@ def report(database,person,report_class,options_class,translated_name,name,categ dialog_class = TextReportDialog elif category == const.CATEGORY_DRAW: dialog_class = DrawReportDialog - elif category == const.CATEGORY_BOOK: + elif category in (const.CATEGORY_BOOK,const.CATEGORY_VIEW): report_class(database,person) return else: diff --git a/gramps2/src/plugins/CountAncestors.py b/gramps2/src/plugins/CountAncestors.py index 2ec1f6778..579102967 100644 --- a/gramps2/src/plugins/CountAncestors.py +++ b/gramps2/src/plugins/CountAncestors.py @@ -23,22 +23,36 @@ "View/Number of ancestors" +#------------------------------------------------------------------------ +# +# standard python modules +# +#------------------------------------------------------------------------ import os -import Utils from gettext import gettext as _ - -from gnome.ui import * -import gtk -import gtk.glade from sets import Set -def report(database,person): - try: - CountAncestors(database,person) - except: - import DisplayTrace - DisplayTrace.DisplayTrace() +#------------------------------------------------------------------------ +# +# GNOME/GTK modules +# +#------------------------------------------------------------------------ +import gtk.glade +#------------------------------------------------------------------------ +# +# GRAMPS modules +# +#------------------------------------------------------------------------ +import Utils +import const +import Report + +#------------------------------------------------------------------------ +# +# +# +#------------------------------------------------------------------------ class CountAncestors: def __init__(self,database,person): @@ -98,11 +112,13 @@ class CountAncestors: # #------------------------------------------------------------------------- from Plugins import register_report - register_report( - report, - _("Number of ancestors"), - category=_("View"), - description=_("Counts number of ancestors of selected person") + name = 'count_ancestors', + category = const.CATEGORY_VIEW, + report_class = CountAncestors, + options_class = None, + modes = Report.MODE_GUI, + translated_name = _("Number of ancestors"), + status = _("Beta"), + description= _("Counts number of ancestors of selected person") ) - diff --git a/gramps2/src/plugins/Summary.py b/gramps2/src/plugins/Summary.py index 2cda5f732..0f9b0b87e 100644 --- a/gramps2/src/plugins/Summary.py +++ b/gramps2/src/plugins/Summary.py @@ -29,6 +29,14 @@ #------------------------------------------------------------------------ import os import posixpath +from gettext import gettext as _ + +#------------------------------------------------------------------------ +# +# GNOME/GTK modules +# +#------------------------------------------------------------------------ +import gtk.glade #------------------------------------------------------------------------ # @@ -37,16 +45,8 @@ import posixpath #------------------------------------------------------------------------ import Utils import RelLib -from gettext import gettext as _ - -#------------------------------------------------------------------------ -# -# GNOME/GTK modules -# -#------------------------------------------------------------------------ -import gtk -import gtk.glade -from gnome.ui import * +import const +import Report #------------------------------------------------------------------------ # @@ -139,27 +139,27 @@ def build_report(database,person): # 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.signal_autoconnect({ - "destroy_passed_object" : Utils.destroy_passed_object, - }) + topDialog = gtk.glade.XML(glade_file,"summary","gramps") + topDialog.signal_autoconnect({ + "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'), _('Database summary')) - top = topDialog.get_widget("summary") - textwindow = topDialog.get_widget("textwindow") - textwindow.get_buffer().set_text(text) - top.show() + top = topDialog.get_widget("summary") + textwindow = topDialog.get_widget("textwindow") + textwindow.get_buffer().set_text(text) + top.show() #------------------------------------------------------------------------- # @@ -167,12 +167,13 @@ def report(database,person): # #------------------------------------------------------------------------- from Plugins import register_report - register_report( - report, - _("Summary of the database"), - status=(_("Beta")), - category=_("View"), - description=_("Provides a summary of the current database") + name = 'summary', + category = const.CATEGORY_VIEW, + report_class = SummaryReport, + options_class = None, + modes = Report.MODE_GUI, + translated_name = _("Summary of the database"), + status = _("Beta"), + description= _("Provides a summary of the current database"), ) -