From eb08f9f440338d87de4834f07348b0938d7056b7 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 27 Jul 2007 04:07:38 +0000 Subject: [PATCH] svn: r8775 --- src/plugins/all_events.py | 35 +++++++++++++++++--------- src/plugins/siblings.py | 52 ++++++++++++++++++++++++++++----------- 2 files changed, 62 insertions(+), 25 deletions(-) diff --git a/src/plugins/all_events.py b/src/plugins/all_events.py index 0702d3ecb..d68e8e210 100644 --- a/src/plugins/all_events.py +++ b/src/plugins/all_events.py @@ -19,33 +19,46 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +""" +Display a person's events, both personal and family +""" + from Simple import SimpleAccess, by_date, SimpleDoc from gettext import gettext as _ +# define the formatting string once as a constant. Since this is reused + +__FMT = "%-15s\t%-15s\t%s" + def run(database, document, person): + """ + Loops through the person events and the family events of any family + in which the person is a parent (to catch Marriage events), displaying + the basic details of the event + """ - sa = SimpleAccess(database) - sd = SimpleDoc(document) + sdb = SimpleAccess(database) + sdoc = SimpleDoc(document) # get the personal events - event_list = sa.events(person) + event_list = sdb.events(person) # get the events of each family in which the person is # a parent - for family in sa.parent_in(person): - event_list += sa.events(family) + for family in sdb.parent_in(person): + event_list += sdb.events(family) # Sort the events by their date event_list.sort(by_date) # display the results - sd.title(_("Sorted events of %s") % sa.name(person)) - sd.paragraph("") + sdoc.title(_("Sorted events of %s") % sdb.name(person)) + sdoc.paragraph("") - sd.header1("\t".join(_("Event Type"),_("Event Date"),_("tEvent Place"))) + sdoc.header1(__FMT % (_("Event Type"), _("Event Date"), _("Event Place"))) for event in event_list: - sd.paragraph("%-12s\t%-12s\t%s" % (sa.event_type(event), - sa.event_date(event), - sa.event_place(event))) + sdoc.paragraph(__FMT % (sdb.event_type(event), + sdb.event_date(event), + sdb.event_place(event))) diff --git a/src/plugins/siblings.py b/src/plugins/siblings.py index ba73590f6..88359ccc9 100644 --- a/src/plugins/siblings.py +++ b/src/plugins/siblings.py @@ -19,25 +19,49 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -from Simple import SimpleAccess, by_date, SimpleDoc +""" +Display a person's siblings in a report window +""" + +from Simple import SimpleAccess, SimpleDoc from gettext import gettext as _ +# define the formatting string once as a constant. Since this is reused + +__FMT = "%-30s\t%-10s\t%s" + def run(database, document, person): + """ + Loops through the families that the person is a child in, and display + the information about the other children. + """ - sa = SimpleAccess(database) - sd = SimpleDoc(document) + # setup the simple access functions + sdb = SimpleAccess(database) + sdoc = SimpleDoc(document) - sd.title(_("Siblings of %s") % sa.name(person)) - sd.paragraph("") - sd.header1("%-30s\t%-10s\t%s" % (_("Sibling"),_("Gender"),_("Birth Date"))) + # display the title + sdoc.title(_("Siblings of %s") % sdb.name(person)) + sdoc.paragraph("") - gid = sa.gid(person) + # display the header of a table + sdoc.header1(__FMT % (_("Sibling"), _("Gender"), _("Birth Date"))) - for family in sa.child_in(person): - for child in sa.children(family): - if sa.gid(child) != gid: - sd.paragraph("%-30s\t%-10s\t%s" % ( - sa.name(child), - sa.gender(child), - sa.birth_date(child))) + # grab our current id, so we can filter the active person out + # of the data + + gid = sdb.gid(person) + + # loop through each family in which the person is a child + for family in sdb.child_in(person): + + # loop through each child in the family + for child in sdb.children(family): + + # only display if this child is not the active person + if sdb.gid(child) != gid: + sdoc.paragraph(__FMT % ( + sdb.name(child), + sdb.gender(child), + sdb.birth_date(child)))