fixed 4602
fixed 4623 various code clean up svn: r16595
This commit is contained in:
parent
ed15eb3e0d
commit
74c7fbed87
@ -420,10 +420,10 @@ class RecurseDown:
|
|||||||
#calculate the .y_cm for this box.
|
#calculate the .y_cm for this box.
|
||||||
box.y_cm = last_box.y_cm
|
box.y_cm = last_box.y_cm
|
||||||
box.y_cm += last_box.height
|
box.y_cm += last_box.height
|
||||||
if last_box.boxstr == "CG2-box":
|
if last_box.boxstr in ["CG2-box", "CG2b-box"]:
|
||||||
box.y_cm += self.canvas.doc.report_opts.box_shadow
|
box.y_cm += self.canvas.doc.report_opts.box_shadow
|
||||||
|
|
||||||
if box.boxstr == "CG2-box":
|
if box.boxstr in ["CG2-box", "CG2b-box"]:
|
||||||
box.y_cm += self.canvas.doc.report_opts.box_pgap
|
box.y_cm += self.canvas.doc.report_opts.box_pgap
|
||||||
else:
|
else:
|
||||||
box.y_cm += self.canvas.doc.report_opts.box_mgap
|
box.y_cm += self.canvas.doc.report_opts.box_mgap
|
||||||
@ -440,7 +440,6 @@ class RecurseDown:
|
|||||||
|
|
||||||
self.canvas.set_box_height_width(box)
|
self.canvas.set_box_height_width(box)
|
||||||
|
|
||||||
|
|
||||||
def add_person_box(self, level, indi_handle, fams_handle, father):
|
def add_person_box(self, level, indi_handle, fams_handle, father):
|
||||||
""" Makes a person box and add that person into the Canvas. """
|
""" Makes a person box and add that person into the Canvas. """
|
||||||
myself = PersonBox(level)
|
myself = PersonBox(level)
|
||||||
@ -525,7 +524,7 @@ class RecurseDown:
|
|||||||
if self.max_spouses > s_level and \
|
if self.max_spouses > s_level and \
|
||||||
spouse_handle not in self.famalies_seen:
|
spouse_handle not in self.famalies_seen:
|
||||||
def _spouse_box(who):
|
def _spouse_box(who):
|
||||||
self.add_person_box((x_level, s_level+1),
|
return self.add_person_box((x_level, s_level+1),
|
||||||
spouse_handle, family_handle, who)
|
spouse_handle, family_handle, who)
|
||||||
if s_level > 0:
|
if s_level > 0:
|
||||||
spouse = _spouse_box(father)
|
spouse = _spouse_box(father)
|
||||||
@ -565,16 +564,18 @@ class RecurseDown:
|
|||||||
mother_h = family.get_mother_handle()
|
mother_h = family.get_mother_handle()
|
||||||
|
|
||||||
self.bold_now = 2
|
self.bold_now = 2
|
||||||
if father_h == None:
|
if father_h:
|
||||||
father_b = self.add_person_box(
|
|
||||||
(level, 0), None, None, father2)
|
|
||||||
else:
|
|
||||||
father_b = self.add_person_box(
|
father_b = self.add_person_box(
|
||||||
(level, 0), father_h, family_h, father2)
|
(level, 0), father_h, family_h, father2)
|
||||||
|
else:
|
||||||
|
father_b = self.add_person_box(
|
||||||
|
(level, 0), None, None, father2)
|
||||||
|
retrn = [father_b]
|
||||||
|
|
||||||
if self.inlc_marr:
|
if self.inlc_marr:
|
||||||
family_b = self.add_marriage_box(
|
family_b = self.add_marriage_box(
|
||||||
(level, 1), father_h, family_h, father_b)
|
(level, 1), father_h, family_h, father_b)
|
||||||
|
retrn.append(family_b)
|
||||||
self.famalies_seen.add(family_h)
|
self.famalies_seen.add(family_h)
|
||||||
|
|
||||||
if mother_h:
|
if mother_h:
|
||||||
@ -583,24 +584,22 @@ class RecurseDown:
|
|||||||
else:
|
else:
|
||||||
mother_b = self.add_person_box(
|
mother_b = self.add_person_box(
|
||||||
(level, 0), None, None, father_b)
|
(level, 0), None, None, father_b)
|
||||||
|
retrn.append(mother_b)
|
||||||
#child_refs = []
|
|
||||||
#for child_ref in family.get_child_ref_list():
|
|
||||||
# child_refs.append(child_ref)
|
|
||||||
|
|
||||||
for child_ref in family.get_child_ref_list():
|
for child_ref in family.get_child_ref_list():
|
||||||
self.recurse(child_ref.ref, level+1, 0,
|
self.recurse(child_ref.ref, level+1, 0,
|
||||||
family_b if self.inlc_marr else father_b)
|
family_b if self.inlc_marr else father_b)
|
||||||
|
|
||||||
#Future code.
|
|
||||||
#if self.inlc_marr:
|
|
||||||
# family_b.line_to.start.append(father_b)
|
|
||||||
# family_b.line_to.start.append(mother_b)
|
|
||||||
#else:
|
|
||||||
# father_b.line_to.start.append(mother_b)
|
|
||||||
|
|
||||||
self.bold_now = 0
|
self.bold_now = 0
|
||||||
return father_b
|
|
||||||
|
#Future code.
|
||||||
|
family_line = family_b if self.inlc_marr else father_b
|
||||||
|
if family_line.line_to:
|
||||||
|
if self.inlc_marr:
|
||||||
|
family_line.line_to.start.append(father_b)
|
||||||
|
family_line.line_to.start.append(mother_b)
|
||||||
|
|
||||||
|
return retrn
|
||||||
|
|
||||||
def has_children(self, person_handle):
|
def has_children(self, person_handle):
|
||||||
"""
|
"""
|
||||||
@ -667,12 +666,12 @@ class MakePersonTree(RecurseDown):
|
|||||||
"""follow the steps to make a tree off of a person"""
|
"""follow the steps to make a tree off of a person"""
|
||||||
persons = []
|
persons = []
|
||||||
|
|
||||||
father1 = self.database.get_person_from_gramps_id(person_id)
|
center1 = self.database.get_person_from_gramps_id(person_id)
|
||||||
father1_h = father1.get_handle() #could be mom too.
|
center1_h = center1.get_handle() #could be mom too.
|
||||||
|
|
||||||
family2 = family2_h = None
|
family2 = family2_h = None
|
||||||
if self.do_gparents:
|
if self.do_gparents:
|
||||||
family2_h = father1.get_main_parents_family_handle()
|
family2_h = center1.get_main_parents_family_handle()
|
||||||
family2 = self.database.get_family_from_handle(family2_h)
|
family2 = self.database.get_family_from_handle(family2_h)
|
||||||
|
|
||||||
mother2_h = father2_h = None
|
mother2_h = father2_h = None
|
||||||
@ -698,15 +697,10 @@ class MakePersonTree(RecurseDown):
|
|||||||
#######################
|
#######################
|
||||||
#now it will ONLY be my fathers parents
|
#now it will ONLY be my fathers parents
|
||||||
if family2:
|
if family2:
|
||||||
father2_id = self.add_family( 0, family2, None )
|
self.add_family( 0, family2, None )
|
||||||
#if father2_h is not None:
|
|
||||||
# persons.append(self.database.get_person_from_handle(father2_h))
|
|
||||||
#if mother2_h is not None:
|
|
||||||
# persons.append(self.database.get_person_from_handle(mother2_h))
|
|
||||||
else:
|
else:
|
||||||
self.bold_now = 2
|
self.bold_now = 2
|
||||||
self.recurse(father1_h, 0, 0, None)
|
self.recurse(center1_h, 0, 0, None)
|
||||||
#persons.append(self.database.get_person_from_handle(father1_h))
|
|
||||||
self.bold_now = 0
|
self.bold_now = 0
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
@ -810,51 +804,33 @@ class MakeFamilyTree(RecurseDown):
|
|||||||
if not show:
|
if not show:
|
||||||
self.famalies_seen.add(father1_h)
|
self.famalies_seen.add(father1_h)
|
||||||
|
|
||||||
father2_id = self.add_family( 0, family2, None )
|
family2_l = self.add_family( 0, family2, None )
|
||||||
|
|
||||||
if self.inlc_marr:
|
elif father1:
|
||||||
family2_id = father2_id.next
|
#######################
|
||||||
|
#my father other wives (if all of the above does nothing)
|
||||||
|
#if my father does not have parents (he is the highest)
|
||||||
|
#######################
|
||||||
|
#do his OTHER wives first.
|
||||||
|
self.recurse_if(father1_h, 1)
|
||||||
|
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
#my father other wives (if all of the above does nothing)
|
#my father, marriage info, mother, siblings, me
|
||||||
#if my father does not have parents (he is the highest)
|
|
||||||
#######################
|
|
||||||
#do his OTHER wives first.
|
|
||||||
if not family2 and father1:
|
|
||||||
self.recurse_if(father1_h, 1)
|
|
||||||
|
|
||||||
|
|
||||||
#######################
|
|
||||||
#my father
|
|
||||||
#######################
|
#######################
|
||||||
if family2:
|
if family2:
|
||||||
#We need to add dad to the family
|
#We need to add dad to the family
|
||||||
parent = family2_id if self.inlc_marr else father2_id
|
family2_line = family2_l[1] if self.inlc_marr else family2_l[0]
|
||||||
else:
|
else:
|
||||||
parent = None
|
family2_line = None
|
||||||
|
|
||||||
father1_b = self.add_family( 1, family1, parent )
|
family1_l = self.add_family(1, family1, family2_line)
|
||||||
|
mother1_b = family1_l[-1] #Mom's Box
|
||||||
#All of us gets added to the line start
|
|
||||||
#Add the next no matter what it is.
|
|
||||||
if self.inlc_marr:
|
|
||||||
mother1_b = father1_b.next.next #Mom's Box
|
|
||||||
line = father1_b.next.line_to
|
|
||||||
if line is None:
|
|
||||||
line = Line()
|
|
||||||
line.start = [father1_b, father1_b.next, mother1_b]
|
|
||||||
else:
|
|
||||||
mother1_b = father1_b.next #Mom's Box
|
|
||||||
line = father1_b.line_to
|
|
||||||
if line is None:
|
|
||||||
line = Line()
|
|
||||||
line.start = [father1_b, mother1_b]
|
|
||||||
father1_b.line_to = line
|
|
||||||
|
|
||||||
#make sure there is at least one child in this family.
|
#make sure there is at least one child in this family.
|
||||||
#if not put in a placeholder
|
#if not put in a placeholder
|
||||||
if not line.end:
|
family1_line = family1_l[1] if self.inlc_marr else family1_l[0]
|
||||||
|
if family1_line.line_to and not family1_line.line_to.end:
|
||||||
box = PlaceHolderBox((father1_b[0]+1, 0))
|
box = PlaceHolderBox((father1_b[0]+1, 0))
|
||||||
self.add_to_col(box)
|
self.add_to_col(box)
|
||||||
line.end = [box]
|
line.end = [box]
|
||||||
@ -912,20 +888,19 @@ class MakeFamilyTree(RecurseDown):
|
|||||||
#my mothers parents!
|
#my mothers parents!
|
||||||
#######################
|
#######################
|
||||||
if family2:
|
if family2:
|
||||||
father2 = self.add_family( 0, family2, None )
|
family2_l = self.add_family( 0, family2, None )
|
||||||
if self.inlc_marr:
|
family2_line = family2_l[1] if self.inlc_marr else family2_l[0]
|
||||||
family2 = father2.next
|
|
||||||
|
|
||||||
#Add mom (made in dad's section) to the list of children (first)
|
family2_line = family2_line.line_to
|
||||||
tmpfather = father2
|
if family2_line.end:
|
||||||
if self.inlc_marr:
|
family2_line.end.insert(0, mother1_b)
|
||||||
tmpfather = family2
|
else:
|
||||||
tmpfather.line_to.end.insert(0, mother1_b)
|
family2_line.end = [mother1_b]
|
||||||
|
|
||||||
#fix me. Moms other siblings have been given an extra space
|
#fix me. Moms other siblings have been given an extra space
|
||||||
#Because Moms-father is not siblings-father right now.
|
#Because Moms-father is not siblings-father right now.
|
||||||
|
|
||||||
mother1_b.father = tmpfather
|
mother1_b.father = family2_line
|
||||||
|
|
||||||
#######################
|
#######################
|
||||||
#my mother mothers OTHER husbands
|
#my mother mothers OTHER husbands
|
||||||
@ -1105,6 +1080,8 @@ class MakeReport(object):
|
|||||||
We are going to go through everyone from right to left
|
We are going to go through everyone from right to left
|
||||||
top to bottom moving everyone down as needed to make the report.
|
top to bottom moving everyone down as needed to make the report.
|
||||||
"""
|
"""
|
||||||
|
seen_parents = False
|
||||||
|
|
||||||
for left_group, right_group in self.__reverse_family_group():
|
for left_group, right_group in self.__reverse_family_group():
|
||||||
right_y_cm, left_y_cm = self.__calc_movements(left_group,
|
right_y_cm, left_y_cm = self.__calc_movements(left_group,
|
||||||
right_group)
|
right_group)
|
||||||
@ -1117,7 +1094,6 @@ class MakeReport(object):
|
|||||||
amt = (left_y_cm - right_y_cm)
|
amt = (left_y_cm - right_y_cm)
|
||||||
self.__move_next_cols_from_here_down(right_group[0], amt)
|
self.__move_next_cols_from_here_down(right_group[0], amt)
|
||||||
|
|
||||||
|
|
||||||
#2. Am I (and spouses) too high? if so move us down!
|
#2. Am I (and spouses) too high? if so move us down!
|
||||||
elif left_y_cm < right_y_cm:
|
elif left_y_cm < right_y_cm:
|
||||||
#Ok, I am too high. Move me down
|
#Ok, I am too high. Move me down
|
||||||
@ -1132,8 +1108,11 @@ class MakeReport(object):
|
|||||||
left_line = left_group[1].line_to
|
left_line = left_group[1].line_to
|
||||||
left_group = left_line.start
|
left_group = left_line.start
|
||||||
|
|
||||||
if len(left_group) > 1:
|
if len(left_group) > 1 and not seen_parents:
|
||||||
#So far only Dad and Mom have len(left_group) > 1
|
seen_parents = True
|
||||||
|
#only do Dad and Mom. len(left_group) > 1
|
||||||
|
#works great when No marriage info
|
||||||
|
#This code needs work. when there is marriage info.
|
||||||
left_up = left_group[0].y_cm
|
left_up = left_group[0].y_cm
|
||||||
left_down = left_group[-1].y_cm + left_group[-1].height
|
left_down = left_group[-1].y_cm + left_group[-1].height
|
||||||
right_up = right_group[0].y_cm
|
right_up = right_group[0].y_cm
|
||||||
|
Loading…
Reference in New Issue
Block a user