2007-11-23 Benny Malengier <benny.malengier@gramps-project.org>
* src/plugins/all_relations.py: remove unnecessary import * src/plugins/siblings.py: add sibling relation if not normal * src/Relationship.py: improve sibling type calculation Issue #1323 svn: r9388
This commit is contained in:
@@ -29,11 +29,9 @@ Display a person's relations to the home person
|
||||
|
||||
from Simple import SimpleAccess, SimpleDoc
|
||||
from gettext import gettext as _
|
||||
from PluginUtils import register_quick_report
|
||||
from PluginUtils import register_quick_report, relationship_class
|
||||
from ReportBase import CATEGORY_QR_PERSON
|
||||
|
||||
from PluginUtils import Tool, relationship_class, register_tool
|
||||
|
||||
# define the formatting string once as a constant. Since this is reused
|
||||
|
||||
_FMT = "%-3d %s"
|
||||
|
||||
@@ -24,13 +24,14 @@ Display a person's siblings in a report window
|
||||
"""
|
||||
|
||||
from Simple import SimpleAccess, SimpleDoc
|
||||
from gen.lib import Person
|
||||
from gettext import gettext as _
|
||||
from PluginUtils import register_quick_report
|
||||
from PluginUtils import register_quick_report, relationship_class
|
||||
from ReportBase import CATEGORY_QR_PERSON
|
||||
|
||||
# define the formatting string once as a constant. Since this is reused
|
||||
|
||||
__FMT = "%-30s\t%-10s\t%s"
|
||||
__FMT = "%-30s\t%-10s\t%-18s\t%s"
|
||||
|
||||
def run(database, document, person):
|
||||
"""
|
||||
@@ -41,13 +42,24 @@ def run(database, document, person):
|
||||
# setup the simple access functions
|
||||
sdb = SimpleAccess(database)
|
||||
sdoc = SimpleDoc(document)
|
||||
rel_class = relationship_class()
|
||||
rel_str_m = rel_class.get_sibling_relationship_string(
|
||||
rel_class.NORM_SIB, person.get_gender(),
|
||||
Person.MALE)
|
||||
rel_str_f = rel_class.get_sibling_relationship_string(
|
||||
rel_class.NORM_SIB, person.get_gender(),
|
||||
Person.FEMALE)
|
||||
rel_str_u = rel_class.get_sibling_relationship_string(
|
||||
rel_class.NORM_SIB, person.get_gender(),
|
||||
Person.UNKNOWN)
|
||||
|
||||
# display the title
|
||||
sdoc.title(_("Siblings of %s") % sdb.name(person))
|
||||
sdoc.paragraph("")
|
||||
|
||||
# display the header of a table
|
||||
sdoc.header1(__FMT % (_("Sibling"), _("Gender"), _("Birth Date")))
|
||||
sdoc.header1(__FMT % (_("Sibling"), _("Gender"), _("Birth Date"),
|
||||
_("Type")))
|
||||
|
||||
# grab our current id, so we can filter the active person out
|
||||
# of the data
|
||||
@@ -62,10 +74,17 @@ def run(database, document, person):
|
||||
|
||||
# only display if this child is not the active person
|
||||
if sdb.gid(child) != gid:
|
||||
rel_str = rel_class.get_sibling_relationship_string(
|
||||
rel_class.get_sibling_type(database, person, child),
|
||||
person.get_gender(), child.get_gender())
|
||||
if rel_str == rel_str_m or rel_str == rel_str_f or \
|
||||
rel_str == rel_str_u :
|
||||
rel_str = ''
|
||||
sdoc.paragraph(__FMT % (
|
||||
sdb.name(child),
|
||||
sdb.gender(child),
|
||||
sdb.birth_date(child)))
|
||||
sdb.birth_date(child),
|
||||
rel_str))
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user