2007-07-27 03:51:54 +00:00
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
|
|
|
# Copyright (C) 2000-2007 Donald N. Allingham
|
2008-05-18 19:24:28 +00:00
|
|
|
# Copyright (C) 2007-2008 Brian G. Matherly
|
2007-07-27 03:51:54 +00:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
#
|
2009-02-16 06:56:49 +00:00
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
#
|
2007-07-27 03:51:54 +00:00
|
|
|
|
2007-07-27 04:07:38 +00:00
|
|
|
"""
|
|
|
|
Display a person's siblings in a report window
|
|
|
|
"""
|
|
|
|
|
2007-12-21 00:18:39 +00:00
|
|
|
from Simple import SimpleAccess, SimpleDoc, SimpleTable
|
2009-10-25 13:52:29 +00:00
|
|
|
import Relationship
|
2009-10-24 13:53:20 +00:00
|
|
|
from gettext import gettext as _
|
2007-07-27 03:51:54 +00:00
|
|
|
|
|
|
|
def run(database, document, person):
|
2007-07-27 04:07:38 +00:00
|
|
|
"""
|
|
|
|
Loops through the families that the person is a child in, and display
|
|
|
|
the information about the other children.
|
|
|
|
"""
|
|
|
|
# setup the simple access functions
|
|
|
|
sdb = SimpleAccess(database)
|
|
|
|
sdoc = SimpleDoc(document)
|
2008-04-18 01:09:32 +00:00
|
|
|
stab = SimpleTable(sdb)
|
2009-10-25 13:52:29 +00:00
|
|
|
rel_class = Relationship.get_relationship_calculator()
|
2008-05-18 19:24:28 +00:00
|
|
|
|
2007-07-27 04:07:38 +00:00
|
|
|
# display the title
|
|
|
|
sdoc.title(_("Siblings of %s") % sdb.name(person))
|
|
|
|
sdoc.paragraph("")
|
2007-12-21 06:22:46 +00:00
|
|
|
stab.columns(_("Sibling"), _("Gender"), _("Birth Date"), _("Type"))
|
2007-12-21 13:35:24 +00:00
|
|
|
# grab our current id (self):
|
2007-07-27 04:07:38 +00:00
|
|
|
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:
|
2007-11-23 08:27:11 +00:00
|
|
|
rel_str = rel_class.get_sibling_relationship_string(
|
2007-12-21 13:35:24 +00:00
|
|
|
rel_class.get_sibling_type(database, person, child),
|
|
|
|
person.get_gender(), child.get_gender())
|
|
|
|
else:
|
2007-12-29 16:06:08 +00:00
|
|
|
rel_str = _('self')
|
2007-12-21 13:35:24 +00:00
|
|
|
# pass row the child object to make link:
|
|
|
|
stab.row(child,
|
|
|
|
sdb.gender(child),
|
2008-01-16 02:25:40 +00:00
|
|
|
sdb.birth_date_obj(child),
|
2007-12-21 13:35:24 +00:00
|
|
|
rel_str)
|
2008-04-18 01:09:32 +00:00
|
|
|
stab.write(sdoc)
|