As there is no time left for code changes, I have reverted changes for bio, half, step- siblings.
svn: r18866
This commit is contained in:
parent
1ca4c044db
commit
04c3cc065e
@ -5362,7 +5362,7 @@ class IndividualPage(BasePage):
|
|||||||
individualdetail += sect2
|
individualdetail += sect2
|
||||||
|
|
||||||
# display parents
|
# display parents
|
||||||
sect3 = self.display_ind_parents()
|
sect3 = self.display_ind_parents(self.ind_list)
|
||||||
if sect3 is not None:
|
if sect3 is not None:
|
||||||
individualdetail += sect3
|
individualdetail += sect3
|
||||||
|
|
||||||
@ -6183,14 +6183,17 @@ class IndividualPage(BasePage):
|
|||||||
# return table columns to its caller
|
# return table columns to its caller
|
||||||
return tcell1, tcell2
|
return tcell1, tcell2
|
||||||
|
|
||||||
def display_ind_parents(self):
|
def display_ind_parents(self, ppl_handle_list):
|
||||||
"""
|
"""
|
||||||
Display a person's parents
|
Display a person's parents
|
||||||
"""
|
"""
|
||||||
|
|
||||||
parent_list = self.person.get_parent_family_handle_list()
|
parent_list = self.person.get_parent_family_handle_list()
|
||||||
if not parent_list:
|
if not parent_list:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
birthorder = self.report.options['birthorder']
|
||||||
|
|
||||||
# begin parents division
|
# begin parents division
|
||||||
with Html("div", class_ = "subsection", id = "parents") as section:
|
with Html("div", class_ = "subsection", id = "parents") as section:
|
||||||
section += Html("h4", _("Parents"), inline = True)
|
section += Html("h4", _("Parents"), inline = True)
|
||||||
@ -6207,7 +6210,7 @@ class IndividualPage(BasePage):
|
|||||||
# Get the mother and father relationships
|
# Get the mother and father relationships
|
||||||
frel = None
|
frel = None
|
||||||
mrel = None
|
mrel = None
|
||||||
all_children = []
|
sibling = []
|
||||||
|
|
||||||
child_handle = self.person.get_handle()
|
child_handle = self.person.get_handle()
|
||||||
child_ref_list = family.get_child_ref_list()
|
child_ref_list = family.get_child_ref_list()
|
||||||
@ -6246,156 +6249,189 @@ class IndividualPage(BasePage):
|
|||||||
table += trow
|
table += trow
|
||||||
|
|
||||||
first = False
|
first = False
|
||||||
|
if len(child_ref_list) > 1:
|
||||||
|
|
||||||
showallsiblings = self.report.options['showhalfsiblings']
|
# remove sibling if it is yourself?
|
||||||
# if we have a known father...
|
childlist = [child_ref.ref for child_ref in child_ref_list
|
||||||
if showallsiblings:
|
if child_ref.ref != self.person.handle]
|
||||||
|
sibling.extend(childlist)
|
||||||
|
|
||||||
if father_handle:
|
# now that we have all siblings in families of the person,
|
||||||
father = self.dbase_.get_person_from_handle(father_handle)
|
# display them...
|
||||||
for family_handle in father.get_family_handle_list():
|
if sibling:
|
||||||
family = self.dbase_.get_family_from_handle(family_handle)
|
trow = Html("tr") + (
|
||||||
if family:
|
Html("td", _("Siblings"), class_ = "ColumnAttribute", inline = True)
|
||||||
for child_ref in family.get_child_ref_list():
|
)
|
||||||
child_handle = child_ref.ref
|
table += trow
|
||||||
|
|
||||||
# if sibling is not already in this list and it is not yourself?
|
tcell = Html("td", class_ = "ColumnValue")
|
||||||
if (child_handle not in all_children and
|
trow += tcell
|
||||||
child_handle != self.person.get_handle()):
|
|
||||||
all_children.append(child_handle)
|
|
||||||
|
|
||||||
spouse_handle = ReportUtils.find_spouse(father, family)
|
ordered = Html("ol")
|
||||||
if spouse_handle != mother_handle:
|
tcell += ordered
|
||||||
spouse = self.dbase_.get_person_from_handle(spouse_handle)
|
|
||||||
if spouse:
|
sibling = add_birthdate(self.dbase_, sibling)
|
||||||
for family_handle in spouse.get_family_handle_list():
|
if birthorder:
|
||||||
family = self.dbase_.get_family_from_handle(family_handle)
|
sibling = sorted(sibling)
|
||||||
if family:
|
|
||||||
for child_ref in family.get_child_ref_list():
|
|
||||||
child_handle = child_ref.ref
|
|
||||||
|
|
||||||
# if sibling is not already in this list and it is not yourself?
|
ordered.extend(
|
||||||
if (child_handle not in all_children and
|
self.display_child_link(chandle, ppl_handle_list)
|
||||||
child_handle != self.person.get_handle()):
|
for birth_date, chandle in sibling
|
||||||
all_children.append(child_handle)
|
)
|
||||||
|
|
||||||
# do the same thing with the mother (see "father" just above):
|
# Also try to identify half-siblings
|
||||||
if mother_handle:
|
half_siblings = []
|
||||||
mother = self.dbase_.get_person_from_handle(mother_handle)
|
|
||||||
for family_handle in mother.get_family_handle_list():
|
|
||||||
family = self.dbase_.get_family_from_handle(family_handle)
|
|
||||||
if family:
|
|
||||||
for child_ref in family.get_child_ref_list():
|
|
||||||
child_handle = child_ref.ref
|
|
||||||
|
|
||||||
# if sibling is not already in this list and it is not yourself?
|
## FOLLOWING CODE IS WRONG, AS showallsiblings = False
|
||||||
if (child_handle not in all_children and
|
## THIS CODE WILL NOT RUN
|
||||||
child_handle != self.person.get_handle()):
|
## TO FIX: the code only works if the user has his
|
||||||
all_children.append(child_handle)
|
## half/step siblings in a specific way in the database,
|
||||||
|
## however this way is not the official way
|
||||||
spouse_handle = ReportUtils.find_spouse(mother, family)
|
## The official way is:
|
||||||
if spouse_handle != father_handle:
|
## 1. step or half siblings _must_ be present
|
||||||
spouse = self.dbase_.get_person_from_handle(spouse_handle)
|
## somewhere in the same family. So the search
|
||||||
if spouse:
|
## here over other families is wrong
|
||||||
for family_handle in spouse.get_family_handle_list():
|
## 2. to determine the relationship, only the child
|
||||||
family = self.dbase_.get_family_from_handle(family_handle)
|
## relationship must be looked at, nothing else!
|
||||||
for child_ref in family.get_child_ref_list():
|
showallsiblings = False #self.report.options['showhalfsiblings']
|
||||||
child_handle = child_ref.ref
|
## # if we have a known father...
|
||||||
|
## if father_handle and showallsiblings:
|
||||||
# if sibling is not already in this list and it is not yourself?
|
## # 1) get all of the families in which this father is involved
|
||||||
if (child_handle not in all_children and
|
## # 2) get all of the children from those families
|
||||||
child_handle != self.person.get_handle()):
|
## # 3) if the children are not already listed as siblings...
|
||||||
all_children.append(child_handle)
|
## # 4) then remember those children since we're going to list them
|
||||||
|
## father = self.dbase_.get_person_from_handle(father_handle)
|
||||||
child_list = [child_handle for child_handle in all_children]
|
## for family_handle in father.get_family_handle_list():
|
||||||
|
## family = self.dbase_.get_family_from_handle(family_handle)
|
||||||
# separate all children into biological, half, and step- siblings...
|
## for half_child_ref in family.get_child_ref_list():
|
||||||
siblings, half_siblings, step_siblings = [], [], []
|
## half_child_handle = half_child_ref.ref
|
||||||
|
## if half_child_handle not in sibling:
|
||||||
if len(child_list):
|
## if half_child_handle != self.person.handle:
|
||||||
for sibling_handle in child_list:
|
## # we have a new step/half sibling
|
||||||
sibling = self.dbase_.get_person_from_handle(sibling_handle)
|
## half_siblings.append(half_child_handle)
|
||||||
if sibling:
|
##
|
||||||
sibling_type = self.rel_class.get_sibling_type(
|
## # do the same thing with the mother (see "father" just above):
|
||||||
self.dbase_, self.person, sibling)
|
## if mother_handle and showallsiblings:
|
||||||
|
## mother = self.dbase_.get_person_from_handle(mother_handle)
|
||||||
# biological/ natural sibling
|
## for family_handle in mother.get_family_handle_list():
|
||||||
if sibling_type == 0:
|
## family = self.dbase_.get_family_from_handle(family_handle)
|
||||||
siblings.append(sibling_handle)
|
## for half_child_ref in family.get_child_ref_list():
|
||||||
|
## half_child_handle = half_child_ref.ref
|
||||||
# half siblings
|
## if half_child_handle not in sibling:
|
||||||
elif (sibling_type == 1 or sibling_type == 2):
|
## if half_child_handle != self.person.handle:
|
||||||
half_siblings.append(sibling_handle)
|
## # we have a new half sibling
|
||||||
|
## half_siblings.append(half_child_handle)
|
||||||
# step siblings
|
##
|
||||||
elif (sibling_type == 3 or sibling_type == 4):
|
## # now that we have all half- siblings, display them...
|
||||||
step_siblings.append(sibling_handle)
|
## if half_siblings:
|
||||||
|
## trow = Html("tr") + (
|
||||||
# now that we have all siblings, display them...
|
## Html("td", _("Half Siblings"), class_ = "ColumnAttribute", inline = True)
|
||||||
if len(siblings):
|
## )
|
||||||
trow = Html("tr") + (
|
## table += trow
|
||||||
Html("td", _("Siblings"), class_ = "ColumnAttribute", inline = True)
|
##
|
||||||
)
|
## tcell = Html("td", class_ = "ColumnValue")
|
||||||
table += trow
|
## trow += tcell
|
||||||
|
##
|
||||||
tcell = Html("td", class_ = "ColumnValue")
|
## ordered = Html("ol")
|
||||||
trow += tcell
|
## tcell += ordered
|
||||||
|
##
|
||||||
ordered = Html("ol")
|
## half_siblings = add_birthdate(self.dbase_, half_siblings)
|
||||||
tcell += ordered
|
## if birthorder:
|
||||||
|
## half_siblings = sorted(half_siblings)
|
||||||
siblings = add_birthdate(self.dbase_, siblings)
|
##
|
||||||
if self.birthorder:
|
## ordered.extend(
|
||||||
siblings = sorted(siblings)
|
## self.display_child_link(chandle, ind_list)
|
||||||
|
## for birth_date, chandle in half_siblings
|
||||||
ordered.extend(
|
## )
|
||||||
self.display_child_link(child_handle, self.ind_list)
|
##
|
||||||
for birth_date, child_handle in siblings
|
## # get step-siblings
|
||||||
)
|
## if showallsiblings:
|
||||||
|
## step_siblings = []
|
||||||
# now that we have all half- siblings, display them...
|
##
|
||||||
if len(half_siblings):
|
## # to find the step-siblings, we need to identify
|
||||||
trow = Html("tr") + (
|
## # all of the families that can be linked back to
|
||||||
Html("td", _("Half Siblings"), class_ = "ColumnAttribute", inline = True)
|
## # the current person, and then extract the children
|
||||||
)
|
## # from those families
|
||||||
table += trow
|
## all_family_handles = set()
|
||||||
|
## all_parent_handles = set()
|
||||||
tcell = Html("td", class_ = "ColumnValue")
|
## tmp_parent_handles = set()
|
||||||
trow += tcell
|
##
|
||||||
|
## # first we queue up the parents we know about
|
||||||
ordered = Html("ol")
|
## if mother_handle:
|
||||||
tcell += ordered
|
## tmp_parent_handles.add(mother_handle)
|
||||||
|
## if father_handle:
|
||||||
half_siblings = add_birthdate(self.dbase_, half_siblings)
|
## tmp_parent_handles.add(father_handle)
|
||||||
if self.birthorder:
|
##
|
||||||
half_siblings = sorted(half_siblings)
|
## while len(tmp_parent_handles):
|
||||||
|
## # pop the next parent from the set
|
||||||
ordered.extend(
|
## parent_handle = tmp_parent_handles.pop()
|
||||||
self.display_child_link(child_handle, self.ind_list)
|
##
|
||||||
for birth_date, child_handle in half_siblings
|
## # add this parent to our official list
|
||||||
)
|
## all_parent_handles.add(parent_handle)
|
||||||
|
##
|
||||||
# now that we have all step- siblings, display them...
|
## # get all families with this parent
|
||||||
if len(step_siblings):
|
## parent = self.dbase_.get_person_from_handle(parent_handle)
|
||||||
trow = Html("tr") + (
|
## for family_handle in parent.get_family_handle_list():
|
||||||
Html("td", _("Step Siblings"), class_ = "ColumnAttribute", inline = True)
|
##
|
||||||
)
|
## all_family_handles.add(family_handle)
|
||||||
table += trow
|
##
|
||||||
|
## # we already have 1 parent from this family
|
||||||
tcell = Html("td", class_ = "ColumnValue")
|
## # (see "parent" above) so now see if we need
|
||||||
trow += tcell
|
## # to queue up the other parent
|
||||||
|
## family = self.dbase_.get_family_from_handle(family_handle)
|
||||||
ordered = Html("ol")
|
## tmp_mother_handle = family.get_mother_handle()
|
||||||
tcell += ordered
|
## if tmp_mother_handle and \
|
||||||
|
## tmp_mother_handle != parent and \
|
||||||
step_siblings = add_birthdate(self.dbase_, step_siblings)
|
## tmp_mother_handle not in tmp_parent_handles and \
|
||||||
if self.birthorder:
|
## tmp_mother_handle not in all_parent_handles:
|
||||||
step_siblings = sorted(step_siblings)
|
## tmp_parent_handles.add(tmp_mother_handle)
|
||||||
|
## tmp_father_handle = family.get_father_handle()
|
||||||
ordered.extend(
|
## if tmp_father_handle and \
|
||||||
self.display_child_link(child_handle, self.ind_list)
|
## tmp_father_handle != parent and \
|
||||||
for birth_date, child_handle in step_siblings
|
## tmp_father_handle not in tmp_parent_handles and \
|
||||||
)
|
## tmp_father_handle not in all_parent_handles:
|
||||||
|
## tmp_parent_handles.add(tmp_father_handle)
|
||||||
|
##
|
||||||
|
## # once we get here, we have all of the families
|
||||||
|
## # that could result in step-siblings; note that
|
||||||
|
## # we can only have step-siblings if the number
|
||||||
|
## # of families involved is > 1
|
||||||
|
##
|
||||||
|
## if len(all_family_handles) > 1:
|
||||||
|
## while len(all_family_handles):
|
||||||
|
## # pop the next family from the set
|
||||||
|
## family_handle = all_family_handles.pop()
|
||||||
|
## # look in this family for children we haven't yet seen
|
||||||
|
## family = self.dbase_.get_family_from_handle(family_handle)
|
||||||
|
## for step_child_ref in family.get_child_ref_list():
|
||||||
|
## step_child_handle = step_child_ref.ref
|
||||||
|
## if step_child_handle not in sibling and \
|
||||||
|
## step_child_handle not in half_siblings and \
|
||||||
|
## step_child_handle != self.person.handle:
|
||||||
|
## # we have a new step sibling
|
||||||
|
## step_siblings.append(step_child_handle)
|
||||||
|
##
|
||||||
|
## # now that we have all step- siblings, display them...
|
||||||
|
## if len(step_siblings):
|
||||||
|
## trow = Html("tr") + (
|
||||||
|
## Html("td", _("Step Siblings"), class_ = "ColumnAttribute", inline = True)
|
||||||
|
## )
|
||||||
|
## table += trow
|
||||||
|
##
|
||||||
|
## tcell = Html("td", class_ = "ColumnValue")
|
||||||
|
## trow += tcell
|
||||||
|
##
|
||||||
|
## ordered = Html("ol")
|
||||||
|
## tcell += ordered
|
||||||
|
##
|
||||||
|
## step_siblings = add_birthdate(self.dbase_, step_siblings)
|
||||||
|
## if birthorder:
|
||||||
|
## step_siblings = sorted(step_siblings)
|
||||||
|
##
|
||||||
|
## ordered.extend(
|
||||||
|
## self.display_child_link(chandle, ind_list)
|
||||||
|
## for birth_date, chandle in step_siblings
|
||||||
|
## )
|
||||||
|
|
||||||
# return parents division to its caller
|
# return parents division to its caller
|
||||||
return section
|
return section
|
||||||
@ -7926,11 +7962,11 @@ class NavWebOptions(MenuReportOptions):
|
|||||||
showparents.set_help(_('Whether to include a parents column'))
|
showparents.set_help(_('Whether to include a parents column'))
|
||||||
addopt( "showparents", showparents )
|
addopt( "showparents", showparents )
|
||||||
|
|
||||||
showallsiblings = BooleanOption(_("Include half and/ or "
|
## showallsiblings = BooleanOption(_("Include half and/ or "
|
||||||
"step-siblings on the individual pages"), False)
|
## "step-siblings on the individual pages"), False)
|
||||||
showallsiblings.set_help(_( "Whether to include half and/ or "
|
## showallsiblings.set_help(_( "Whether to include half and/ or "
|
||||||
"step-siblings with the parents and siblings"))
|
## "step-siblings with the parents and siblings"))
|
||||||
addopt('showhalfsiblings', showallsiblings)
|
## addopt('showhalfsiblings', showallsiblings)
|
||||||
|
|
||||||
birthorder = BooleanOption(_('Sort all children in birth order'), False)
|
birthorder = BooleanOption(_('Sort all children in birth order'), False)
|
||||||
birthorder.set_help(_('Whether to display children in birth order or in entry order?'))
|
birthorder.set_help(_('Whether to display children in birth order or in entry order?'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user