Fixed issue in showing non-birth children relations; adjusted minimum height

svn: r11504
This commit is contained in:
Doug Blank 2008-12-22 13:37:22 +00:00
parent 1f2b8df6a4
commit 75da8808ab

View File

@ -22,6 +22,7 @@ This Gramplet shows textual distributions of age breakdowns of various types.
""" """
from DataViews import register, Gramplet from DataViews import register, Gramplet
import gen.lib
class AgeStatsGramplet(Gramplet): class AgeStatsGramplet(Gramplet):
@ -103,11 +104,21 @@ class AgeStatsGramplet(Gramplet):
# + " " + p.get_primary_name().get_surname()) # + " " + p.get_primary_name().get_surname())
# for each parent m/f: # for each parent m/f:
family_list = p.get_parent_family_handle_list() family_list = p.get_parent_family_handle_list()
if len(family_list) > 0: for family_handle in family_list:
family = self.dbstate.db.get_family_from_handle(family_list[0]) # first is primary, I think family = self.dbstate.db.get_family_from_handle(family_handle)
if family: if family:
f_handle = family.get_father_handle() childrel = [(ref.get_mother_relation(),
ref.get_father_relation()) for ref in
family.get_child_ref_list()
if ref.ref == p.handle] # get first, if more than one
if childrel[0][0] == gen.lib.ChildRefType.BIRTH:
m_handle = family.get_mother_handle() m_handle = family.get_mother_handle()
else:
m_handle = None
if childrel[0][1] == gen.lib.ChildRefType.BIRTH:
f_handle = family.get_father_handle()
else:
f_handle = None
# if they have a birth_date, compute difference each m/f # if they have a birth_date, compute difference each m/f
if f_handle: if f_handle:
f = self.dbstate.db.get_person_from_handle(f_handle) f = self.dbstate.db.get_person_from_handle(f_handle)
@ -251,7 +262,7 @@ class AgeStatsGramplet(Gramplet):
register(type="gramplet", register(type="gramplet",
name = "Age Stats Gramplet", name = "Age Stats Gramplet",
tname = _("Age Stats Gramplet"), tname = _("Age Stats Gramplet"),
height=300, height=100,
expand=True, expand=True,
content = AgeStatsGramplet, content = AgeStatsGramplet,
title=_("Age Stats"), title=_("Age Stats"),