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 # 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 Simple import SimpleAccess, by_date, SimpleDoc
from gettext import gettext as _ from gettext import gettext as _
def run(database, document, person): # define the formatting string once as a constant. Since this is reused
sa = SimpleAccess(database) __FMT = "%-15s\t%-15s\t%s"
sd = SimpleDoc(document)
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
"""
sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
# get the personal events # 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 # get the events of each family in which the person is
# a parent # a parent
for family in sa.parent_in(person): for family in sdb.parent_in(person):
event_list += sa.events(family) event_list += sdb.events(family)
# Sort the events by their date # Sort the events by their date
event_list.sort(by_date) event_list.sort(by_date)
# display the results # display the results
sd.title(_("Sorted events of %s") % sa.name(person)) sdoc.title(_("Sorted events of %s") % sdb.name(person))
sd.paragraph("") 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: for event in event_list:
sd.paragraph("%-12s\t%-12s\t%s" % (sa.event_type(event), sdoc.paragraph(__FMT % (sdb.event_type(event),
sa.event_date(event), sdb.event_date(event),
sa.event_place(event))) sdb.event_place(event)))

View File

@ -19,25 +19,49 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # 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 _ 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): 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) # setup the simple access functions
sd = SimpleDoc(document) sdb = SimpleAccess(database)
sdoc = SimpleDoc(document)
sd.title(_("Siblings of %s") % sa.name(person)) # display the title
sd.paragraph("") sdoc.title(_("Siblings of %s") % sdb.name(person))
sd.header1("%-30s\t%-10s\t%s" % (_("Sibling"),_("Gender"),_("Birth Date"))) 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): # grab our current id, so we can filter the active person out
for child in sa.children(family): # of the data
if sa.gid(child) != gid:
sd.paragraph("%-30s\t%-10s\t%s" % ( gid = sdb.gid(person)
sa.name(child),
sa.gender(child), # loop through each family in which the person is a child
sa.birth_date(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)))