3292: register plugins, load on need, not on start of GRAMPS - GEPS 014

svn: r13400
This commit is contained in:
Benny Malengier
2009-10-24 13:53:20 +00:00
parent d1fbb2bff9
commit ed619cfdd6
195 changed files with 4123 additions and 3371 deletions

View File

@@ -29,8 +29,6 @@ Display references for any object
from Simple import SimpleAccess, SimpleDoc, SimpleTable
from gettext import gettext as _
from gen.plug import PluginManager
from ReportBase import CATEGORY_QR_DATE
import DateHandler
import gen.lib
import config
@@ -91,22 +89,3 @@ def get_event_date_from_ref(database, ref):
if event:
date = event.get_date_object()
return date
#------------------------------------------------------------------------
#
# Register the report
#
#------------------------------------------------------------------------
pmgr = PluginManager.get_instance()
pmgr.register_quick_report(
name = 'ageondate',
category = CATEGORY_QR_DATE,
run_func = run,
translated_name = _("Age on Date"),
status = _("Stable"),
description= _("Display people and ages on a particular date"),
author_name="Douglas Blank",
author_email="dblank@cs.brynmawr.edu"
)

View File

@@ -27,15 +27,9 @@ Display all names of all people
"""
from Simple import SimpleAccess, SimpleDoc, SimpleTable
from gen.plug import PluginManager
from Utils import media_path_full
from QuickReports import run_quick_report_by_name_direct
from ReportBase import CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY
from BasicUtils import name_displayer as nd
from gen.lib import Person
import DateHandler
import posixpath
from gettext import gettext as _
from gettext import ngettext
@@ -62,7 +56,7 @@ def run(database, document, *args, **kwargs):
str(primary_name.get_type()))]
names += [(nd.display_name(name),
person,
str(name.get_type())) for name in
str(name.get_type())) for name in
person.get_alternate_names()]
names.sort()
matches = 0
@@ -72,20 +66,3 @@ def run(database, document, *args, **kwargs):
sdoc.paragraph(_("Total names %d") % matches)
sdoc.paragraph("")
stab.write(sdoc)
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
pmgr = PluginManager.get_instance()
pmgr.register_quick_report(
name = 'allnames',
category = CATEGORY_QR_PERSON,
run_func = run,
translated_name = _("All Names of All People"),
status = _("Stable"),
description= _("All names of All people"),
author_name="Douglas S. Blank",
author_email="doug.blank@gmail.com"
)

View File

@@ -22,9 +22,7 @@
#
#
from ReportBase import CATEGORY_QR_MISC
from Simple import SimpleAccess, SimpleDoc, SimpleTable
from gen.plug import PluginManager
from gettext import gettext as _
def run(database, document, attribute, value=None):
@@ -46,15 +44,3 @@ def run(database, document, attribute, value=None):
matches += 1
sdoc.paragraph(_("There are %d people with a matching attribute name.\n") % matches)
stab.write(sdoc)
pmgr = PluginManager.get_instance()
pmgr.register_quick_report(
name = 'attribute_match',
category = CATEGORY_QR_MISC, # to run with attribute/value
run_func = run,
translated_name = _("Attribute Match"),
status = _("Stable"),
description= _("Display people with same attribute."),
author_name="Douglas S. Blank",
author_email="dblank@cs.brynmawr.edu"
)

View File

@@ -28,7 +28,6 @@ Display filtered data
"""
from Simple import SimpleAccess, SimpleDoc, SimpleTable
from gen.plug import PluginManager
from Utils import media_path_full
from QuickReports import run_quick_report_by_name_direct
from gen.lib import Person
@@ -189,20 +188,3 @@ def run(database, document, filter_name, *args, **kwargs):
sdoc.paragraph("")
if matches > 0:
stab.write(sdoc)
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
pmgr = PluginManager.get_instance()
pmgr.register_quick_report(
name = 'filterbyname',
category = -1, # stand-alone
run_func = run,
translated_name = _("Filter"),
status = _("Stable"),
description= _("Display filtered data"),
author_name="Douglas S. Blank",
author_email="dblank@cs.brynmawr.edu"
)

View File

@@ -13,6 +13,7 @@ pkgdata_PYTHON = \
FilterByName.py \
lineage.py \
OnThisDay.py \
quickview.gpr.py \
References.py \
Reporef.py \
SameSurnames.py\

View File

@@ -28,8 +28,6 @@ Display all events on a particular day.
from Simple import SimpleAccess, SimpleDoc, SimpleTable
from gettext import gettext as _
from gen.plug import PluginManager
from ReportBase import CATEGORY_QR_EVENT
import gen.lib
def get_ref(db, objclass, handle):
@@ -133,20 +131,3 @@ def run(database, document, main_event):
{"year":main_date.get_year()})
sdoc.paragraph("")
sdoc.paragraph("")
#------------------------------------------------------------------------
#
# Register the report
#
#------------------------------------------------------------------------
pmgr = PluginManager.get_instance()
pmgr.register_quick_report(
name = 'onthisday',
category = CATEGORY_QR_EVENT,
run_func = run,
translated_name = _("On This Day"),
status = _("Stable"),
description= _("Display events on a particular day"),
author_name="Douglas Blank",
author_email="dblank@cs.brynmawr.edu"
)

View File

@@ -25,17 +25,9 @@
"""
Display references for any object
"""
from ReportBase import (CATEGORY_QR_SOURCE, CATEGORY_QR_PERSON,
CATEGORY_QR_FAMILY, CATEGORY_QR_EVENT,
CATEGORY_QR_PLACE)
from Simple import SimpleAccess, SimpleDoc, SimpleTable
from gettext import gettext as _
from gen.plug import PluginManager
# mention so that will be translated for below
[_('Person'), _('Family'), _('Event'), _('Source'),
_('Place')]
def get_ref(db, objclass, handle):
"""
@@ -81,29 +73,9 @@ def run(database, document, object, item, trans):
sdoc.paragraph("")
sdoc.paragraph("")
#------------------------------------------------------------------------
#
# Register the report
#
#------------------------------------------------------------------------
refitems = [(CATEGORY_QR_PERSON, 'person', _("Person")),
(CATEGORY_QR_FAMILY,'family', _("Family")),
(CATEGORY_QR_EVENT, 'event', _("Event")),
(CATEGORY_QR_SOURCE, 'source', _("Source")),
(CATEGORY_QR_PLACE, 'place', _("Place")),
]
pmgr = PluginManager.get_instance()
for (category,item,trans) in refitems:
pmgr.register_quick_report(
name = item + 'refereneces',
category = category,
run_func = lambda db, doc, obj, item=item, trans=trans: \
run(db, doc, obj, item, trans),
translated_name = _("%s References") % trans,
status = _("Stable"),
description= _("Display references for a %s") % trans,
author_name="Douglas Blank",
author_email="dblank@cs.brynmawr.edu"
)
#functions for the actual quickreports
run_person = lambda db, doc, obj: run(db, doc, obj, 'person', _("Person"))
run_family = lambda db, doc, obj: run(db, doc, obj, 'family', _("Family"))
run_event = lambda db, doc, obj: run(db, doc, obj, 'event', _("Event"))
run_source = lambda db, doc, obj: run(db, doc, obj, 'source', _("Source"))
run_place = lambda db, doc, obj: run(db, doc, obj, 'place', _("Place"))

View File

@@ -33,8 +33,6 @@ Display RepoRef for sources related to active repository
from Simple import SimpleAccess, SimpleDoc, SimpleTable
from gettext import gettext as _
from gen.plug import PluginManager
from ReportBase import CATEGORY_QR_REPOSITORY
def run(database, document, repo):
"""
@@ -75,24 +73,3 @@ def run(database, document, repo):
stab.columns(_("Source"), _("Type of media"), _("Call number"))
stab.row(src.get_title(), media, call)
stab.write(sdoc)
# ------------------------------------------------------------------------
#
#
#
# ------------------------------------------------------------------------
PMGR = PluginManager.get_instance()
PMGR.register_quick_report(
name='RepoRef',
category=CATEGORY_QR_REPOSITORY,
run_func=run,
translated_name=_('RepoRef'),
status=_('Stable'),
description=_('Display RepoRef for sources related to active repository'
),
author_name="Jerome Rapinat",
author_email="romjerome@yahoo.fr"
)

View File

@@ -30,9 +30,7 @@ Display a people who have a person's same surname or given name.
from Simple import SimpleAccess, SimpleDoc, SimpleTable
from gettext import gettext as _
from gettext import ngettext
from gen.plug import PluginManager
import gen.lib
from ReportBase import CATEGORY_QR_PERSON, CATEGORY_QR_MISC
from Filters.Rules import Rule
from Filters import GenericFilterFactory
@@ -170,42 +168,3 @@ def run_given(database, document, person):
"There are %d people with a matching name, or alternate name.\n"
, matches) % matches)
stab.write(sdoc)
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
pmgr = PluginManager.get_instance()
pmgr.register_quick_report(
name = 'samesurnames',
category = CATEGORY_QR_PERSON,
run_func = run,
translated_name = _("Same Surnames"),
status = _("Stable"),
description= _("Display people with the same surname as a person."),
author_name="Douglas S. Blank",
author_email="dblank@cs.brynmawr.edu"
)
pmgr.register_quick_report(
name = 'samegivens',
category = CATEGORY_QR_PERSON, # to run with a person object
run_func = run_given,
translated_name = _("Same Given Names"),
status = _("Stable"),
description= _("Display people with the same given name as a person."),
author_name="Douglas S. Blank",
author_email="dblank@cs.brynmawr.edu"
)
pmgr.register_quick_report(
name = 'samegivens_misc',
category = CATEGORY_QR_MISC, # to run with a given name string
run_func = run_given,
translated_name = _("Same Given Names"),
status = _("Stable"),
description= _("Display people with the same given name as a person."),
author_name="Douglas S. Blank",
author_email="dblank@cs.brynmawr.edu"
)

View File

@@ -28,8 +28,6 @@ Display a person's events, both personal and family
from Simple import SimpleAccess, by_date, SimpleDoc, SimpleTable
from gettext import gettext as _
from gen.plug import PluginManager
from ReportBase import CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY
def run(database, document, person):
"""
@@ -120,7 +118,7 @@ def run_fam(database, document, family):
sdb.event_date_obj(event),
sdb.event_place(event))
stab.write(sdoc)
def fam_sort(event1, event2):
"""
Sort function that will compare two events by their dates.
@@ -134,32 +132,3 @@ def fam_sort(event1, event2):
@rtype: int
"""
return by_date(event1[1],event2[1])
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
pmgr = PluginManager.get_instance()
pmgr.register_quick_report(
name = 'all_events',
category = CATEGORY_QR_PERSON,
run_func = run,
translated_name = _("All Events"),
status = _("Stable"),
description= _("Display a person's events, both personal and family."),
author_name="Donald N. Allingham",
author_email="don@gramps-project.org"
)
pmgr.register_quick_report(
name = 'all_events_fam',
category = CATEGORY_QR_FAMILY,
run_func = run_fam,
translated_name = _("All Events"),
status = _("Stable"),
description= _("Display the family and family members events."),
author_name="B. Malengier",
author_email="benny.malengier@gramps-project.org"
)

View File

@@ -34,7 +34,6 @@ Display a person's relations to the home person
from Simple import SimpleAccess, SimpleDoc
from gettext import gettext as _
from gen.plug import PluginManager
from ReportBase import CATEGORY_QR_PERSON
# define the formatting string once as a constant. Since this is reused
@@ -342,21 +341,3 @@ class AllRelReport():
sdoc.paragraph(msg)
sdoc.paragraph("")
sdoc.paragraph("")
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
pmgr = PluginManager.get_instance()
pmgr.register_quick_report(
name = 'all_relations',
category = CATEGORY_QR_PERSON,
run_func = run,
translated_name = _("Relation to Home Person"),
status = _("Stable"),
description= _("Display all relationships between person and home person."),
author_name="B. Malengier",
author_email="benny.malengier@gramps-project.org"
)

View File

@@ -35,8 +35,6 @@ Display a person's father or mother lineage
import gen.lib
from Simple import SimpleAccess, SimpleDoc, SimpleTable
from gettext import gettext as _
from gen.plug import PluginManager
from ReportBase import CATEGORY_QR_PERSON
__FMT = "%-30s\t%-12s\t%-12s"
__FMT_REM = " %s: %s"
@@ -226,33 +224,3 @@ def add_rem(remark, text):
return remark + ', ' + text
else:
return text
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
pmgr = PluginManager.get_instance()
pmgr.register_quick_report(
name = 'father_lineage',
category = CATEGORY_QR_PERSON,
run_func = run_father,
translated_name = _("Father lineage"),
status = _("Stable"),
description= _("Display father lineage"),
author_name="B. Malengier",
author_email="benny.malengier@gramps-project.org"
)
pmgr.register_quick_report(
name = 'mother_lineage',
category = CATEGORY_QR_PERSON,
run_func = run_mother,
translated_name = _("Mother lineage"),
status = _("Stable"),
description= _("Display mother lineage"),
author_name="B. Malengier",
author_email="benny.malengier@gramps-project.org"
)

View File

@@ -0,0 +1,289 @@
#------------------------------------------------------------------------
#
# Age on Date
#
#------------------------------------------------------------------------
register(QUICKREPORT,
id = 'ageondate',
name = _("Age on Date"),
description = _("Display people and ages on a particular date"),
version = '1.0',
status = STABLE,
fname = 'AgeOnDate.py',
authors = ["Douglas Blank"],
authors_email = ["dblank@cs.brynmawr.edu"],
category = CATEGORY_QR_DATE,
runfunc = 'run'
)
#------------------------------------------------------------------------
#
# Attribute Match
#
#------------------------------------------------------------------------
register(QUICKREPORT,
id = 'attribute_match',
name = _("Attribute Match"),
description = _("Display people with same attribute."),
version = '1.0',
status = STABLE,
fname = 'AttributeMatch.py',
authors = ["Douglas Blank"],
authors_email = ["dblank@cs.brynmawr.edu"],
category = CATEGORY_QR_MISC,
runfunc = 'run'
)
#------------------------------------------------------------------------
#
# All Events
#
#------------------------------------------------------------------------
register(QUICKREPORT,
id = 'all_events',
name = _("All Events"),
description = _("Display a person's events, both personal and family."),
version = '1.0',
status = STABLE,
fname = 'all_events.py',
authors = ["Donald N. Allingham"],
authors_email = ["don@gramps-project.org"],
category = CATEGORY_QR_PERSON,
runfunc = 'run'
)
register(QUICKREPORT,
id = 'all_events_fam',
name = _("All Events"),
description = _("Display the family and family members events."),
version = '1.0',
status = STABLE,
fname = 'all_events.py',
authors = ["B. Malengier"],
authors_email = ["benny.malengier@gramps-project.org"],
category = CATEGORY_QR_FAMILY,
runfunc = 'run_fam'
)
#------------------------------------------------------------------------
#
# All Names of All People
#
#------------------------------------------------------------------------
register(QUICKREPORT,
id = 'allnames',
name = _("All Names of All People"),
description = _("All names of all people"),
version = '1.0',
status = STABLE,
fname = 'AllNames.py',
authors = ["Douglas Blank"],
authors_email = ["dblank@cs.brynmawr.edu"],
category = CATEGORY_QR_PERSON,
runfunc = 'run'
)
#------------------------------------------------------------------------
#
# Relation to Home Person
#
#------------------------------------------------------------------------
register(QUICKREPORT,
id = 'all_relations',
name = _("Relation to Home Person"),
description = _("Display all relationships between person and home person."),
version = '1.0',
status = STABLE,
fname = 'all_relations.py',
authors = ["B. Malengier"],
authors_email = ["benny.malengier@gramps-project.org"],
category = CATEGORY_QR_PERSON,
runfunc = 'run'
)
#------------------------------------------------------------------------
#
# Filter
#
#------------------------------------------------------------------------
register(QUICKREPORT,
id = 'filterbyname',
name = _("Filter"),
description = _("Display filtered data"),
version = '1.0',
status = STABLE,
fname = 'FilterByName.py',
authors = ["Douglas Blank"],
authors_email = ["dblank@cs.brynmawr.edu"],
category = CATEGORY_QR_MISC,
runfunc = 'run'
)
#------------------------------------------------------------------------
#
# Father/mother lineage
#
#------------------------------------------------------------------------
register(QUICKREPORT,
id = 'father_lineage',
name = _("Father lineage"),
description = _("Display father lineage"),
version = '1.0',
status = STABLE,
fname = 'lineage.py',
authors = ["B. Malengier"],
authors_email = ["benny.malengier@gramps-project.org"],
category = CATEGORY_QR_PERSON,
runfunc = 'run_father'
)
register(QUICKREPORT,
id = 'mother_lineage',
name = _("Mother lineage"),
description = _("Display mother lineage"),
version = '1.0',
status = STABLE,
fname = 'lineage.py',
authors = ["B. Malengier"],
authors_email = ["benny.malengier@gramps-project.org"],
category = CATEGORY_QR_PERSON,
runfunc = 'run_mother'
)
#------------------------------------------------------------------------
#
# On This Day
#
#------------------------------------------------------------------------
register(QUICKREPORT,
id = 'onthisday',
name = _("On This Day"),
description = _("Display events on a particular day"),
version = '1.0',
status = STABLE,
fname = 'OnThisDay.py',
authors = ["Douglas Blank"],
authors_email = ["dblank@cs.brynmawr.edu"],
category = CATEGORY_QR_EVENT,
runfunc = 'run'
)
#------------------------------------------------------------------------
#
# References
#
#------------------------------------------------------------------------
refitems = [(CATEGORY_QR_PERSON, 'person', _("Person")),
(CATEGORY_QR_FAMILY,'family', _("Family")),
(CATEGORY_QR_EVENT, 'event', _("Event")),
(CATEGORY_QR_SOURCE, 'source', _("Source")),
(CATEGORY_QR_PLACE, 'place', _("Place")),
]
for (category, item, trans) in refitems:
register(QUICKREPORT,
id = item + 'references',
name = _("%s References") % trans,
description = _("Display references for a %s") % trans,
version = '1.0',
status = STABLE,
fname = 'References.py',
authors = ["Douglas Blank"],
authors_email = ["dblank@cs.brynmawr.edu"],
category = category,
runfunc = 'run_%s' % item
)
#------------------------------------------------------------------------
#
# Show Repository Reference
#
#------------------------------------------------------------------------
register(QUICKREPORT,
id = 'RepoRef',
name = _("Show Repository Reference"),
description = _("Display the repository reference for sources related to"
" the active repository"),
version = '1.0',
status = STABLE,
fname = 'Reporef.py',
authors = ["Jerome Rapinat"],
authors_email = ["romjerome@yahoo.fr"],
category = CATEGORY_QR_REPOSITORY,
runfunc = 'run'
)
#------------------------------------------------------------------------
#
# Same Surnames/Given names
#
#------------------------------------------------------------------------
register(QUICKREPORT,
id = 'samesurnames',
name = _("Same Surnames"),
description = _("Display people with the same surname as a person."),
version = '1.0',
status = STABLE,
fname = 'SameSurnames.py',
authors = ["Douglas Blank"],
authors_email = ["dblank@cs.brynmawr.edu"],
category = CATEGORY_QR_PERSON,
runfunc = 'run'
)
register(QUICKREPORT,
id = 'samegivens',
name = _("Same Given Names"),
description = _("Display people with the same given name as a person."),
version = '1.0',
status = STABLE,
fname = 'SameSurnames.py',
authors = ["Douglas Blank"],
authors_email = ["dblank@cs.brynmawr.edu"],
category = CATEGORY_QR_PERSON,
runfunc = 'run_given'
)
register(QUICKREPORT,
id = 'samegivens_misc',
name = _("Same Given Names"),
description = _("Display people with the same given name as a person."),
version = '1.0',
status = STABLE,
fname = 'SameSurnames.py',
authors = ["Douglas Blank"],
authors_email = ["dblank@cs.brynmawr.edu"],
category = CATEGORY_QR_MISC,
runfunc = 'run_given'
)
#------------------------------------------------------------------------
#
# siblings
#
#------------------------------------------------------------------------
register(QUICKREPORT,
id = 'siblings',
name = _("Siblings"),
description = _("Display a person's siblings."),
version = '1.0',
status = STABLE,
fname = 'siblings.py',
authors = ["Donald N. Allingham"],
authors_email = ["don@gramps-project.org"],
category = CATEGORY_QR_PERSON,
runfunc = 'run'
)

View File

@@ -27,9 +27,8 @@ Display a person's siblings in a report window
"""
from Simple import SimpleAccess, SimpleDoc, SimpleTable
from gettext import gettext as _
from gen.plug import PluginManager
from ReportBase import CATEGORY_QR_PERSON
from gettext import gettext as _
def run(database, document, person):
"""
@@ -66,20 +65,3 @@ def run(database, document, person):
sdb.birth_date_obj(child),
rel_str)
stab.write(sdoc)
#------------------------------------------------------------------------
#
#
#
#------------------------------------------------------------------------
pmgr = PluginManager.get_instance()
pmgr.register_quick_report(
name = 'siblings',
category = CATEGORY_QR_PERSON,
run_func = run,
translated_name = _("Siblings"),
status = _("Stable"),
description= _("Display a person's siblings."),
author_name="Donald N. Allingham",
author_email="don@gramps-project.org"
)