svn: r8775

This commit is contained in:
Don Allingham 2007-07-27 04:07:38 +00:00
parent 255a59679d
commit eb08f9f440
2 changed files with 62 additions and 25 deletions

View File

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

View File

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