From f7da6581048aa13483f6cff48b9e1ab40e78f88d Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sat, 29 Dec 2007 21:06:15 +0000 Subject: [PATCH] Added click/double click for QR that reference people svn: r9631 --- src/plugins/OnThisDay.py | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/src/plugins/OnThisDay.py b/src/plugins/OnThisDay.py index bb0c93010..894d50a64 100644 --- a/src/plugins/OnThisDay.py +++ b/src/plugins/OnThisDay.py @@ -28,6 +28,13 @@ from gettext import gettext as _ from PluginUtils import register_quick_report from ReportBase import CATEGORY_QR_EVENT +def backlink(database, objclass, handle): + if objclass == 'Person': + ref = database.get_person_from_handle(handle) + else: + ref = objclass + return ref + def run(database, document, main_event): """ Loops through the families that the person is a child in, and display @@ -45,9 +52,9 @@ def run(database, document, main_event): # display the title sdoc.title(_("Events of %s") % sdb.event_date(main_event)) sdoc.paragraph("") - stab.columns(_("Date"), _("Type"), _("Place")) - yeartab.columns(_("Date"), _("Type"), _("Place")) - histab.columns(_("Date"), _("Type"), _("Place")) + stab.columns(_("Date"), _("Type"), _("Place"), _("Reference")) + yeartab.columns(_("Date"), _("Type"), _("Place"), _("Reference")) + histab.columns(_("Date"), _("Type"), _("Place"), _("Reference")) for event_handle in database.get_event_handles(): event = database.get_event_from_handle(event_handle) @@ -57,18 +64,25 @@ def run(database, document, main_event): if (date.get_year() == main_date.get_year() and date.get_month() == main_date.get_month() and date.get_day() == main_date.get_day()): - stab.row(date, - sdb.event_type(event), - sdb.event_place(event)) + for (objclass, handle) in database.find_backlink_handles(event_handle): + ref = backlink(database, objclass, handle) + stab.row(date, + sdb.event_type(event), + sdb.event_place(event), ref) elif (date.get_month() == main_date.get_month() and - date.get_day() == main_date.get_day()): - histab.row(date, - sdb.event_type(event), - sdb.event_place(event)) + date.get_day() == main_date.get_day() and + date.get_month() != 0): + for (objclass, handle) in database.find_backlink_handles(event_handle): + ref = backlink(database, objclass, handle) + histab.row(date, + sdb.event_type(event), + sdb.event_place(event), ref) elif (date.get_year() == main_date.get_year()): - yeartab.row(date, - sdb.event_type(event), - sdb.event_place(event)) + for (objclass, handle) in database.find_backlink_handles(event_handle): + ref = backlink(database, objclass, handle) + yeartab.row(date, + sdb.event_type(event), + sdb.event_place(event), ref) stab.write()