* 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/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>
* src/EditPerson.py: move strip_id from Utils
* 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
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:

View File

@ -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")
)

View File

@ -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"),
)