Tweaks to graphical tree reports
svn: r16422
This commit is contained in:
		| @@ -35,11 +35,9 @@ def log2(val): | |||||||
|     """ |     """ | ||||||
|     Calculate the log base 2 of a value. |     Calculate the log base 2 of a value. | ||||||
|     """ |     """ | ||||||
|     return int(math.log10(val)/math.log10(2)) |     return int(math.log(val, 2)) | ||||||
|  |  | ||||||
| def X_INDEX(level): | X_INDEX = log2 | ||||||
|     """ calculate the row that this person is in """ |  | ||||||
|     return log2(level) |  | ||||||
|      |      | ||||||
| from gen.ggettext import sgettext as _ | from gen.ggettext import sgettext as _ | ||||||
|  |  | ||||||
| @@ -96,7 +94,7 @@ class AncestorBoxBase(BoxBase): | |||||||
|         #Calculate which row in the column of people. |         #Calculate which row in the column of people. | ||||||
|         tmp_y = self.level[1] - (2**x_level) |         tmp_y = self.level[1] - (2**x_level) | ||||||
|         #Calculate which row in the table (yes table) of people. |         #Calculate which row in the table (yes table) of people. | ||||||
|         delta = int((2**max_gen)/(2**(x_level))) |         delta = (2**max_gen) // (2**(x_level)) | ||||||
|         return int((delta/2) + (tmp_y*delta)) |         return int((delta/2) + (tmp_y*delta)) | ||||||
|  |  | ||||||
| class PersonBox(AncestorBoxBase): | class PersonBox(AncestorBoxBase): | ||||||
| @@ -117,11 +115,11 @@ class FamilyBox(AncestorBoxBase): | |||||||
|      |      | ||||||
|     def y_index(self, max_gen): |     def y_index(self, max_gen): | ||||||
|         """ Calculate the column or generation that this person is in. """ |         """ Calculate the column or generation that this person is in. """ | ||||||
|         x_level = self.level[0] -1 |         x_level = self.level[0] - 1 | ||||||
|         #Calculate which row in the column of people. |         #Calculate which row in the column of people. | ||||||
|         tmp_y = self.level[1] - (2**x_level) |         tmp_y = self.level[1] - (2**x_level) | ||||||
|         #Calculate which row in the table (yes table) of people. |         #Calculate which row in the table (yes table) of people. | ||||||
|         delta = int((2**max_gen)/(2**(x_level))) |         delta = (2**max_gen) // (2**(x_level)) | ||||||
|         return int((delta/2) + (tmp_y*delta)) |         return int((delta/2) + (tmp_y*delta)) | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -252,8 +250,8 @@ class MakeAncestorTree(object): | |||||||
|          |          | ||||||
|         myself = PersonBox(index) |         myself = PersonBox(index) | ||||||
|          |          | ||||||
|         myself.text = \ |         myself.text = self.calc_items.calc_person( | ||||||
|             self.calc_items.calc_person(index, indi_handle, fams_handle) |                             index, indi_handle, fams_handle) | ||||||
|  |  | ||||||
|         self.canvas.add_box(myself) |         self.canvas.add_box(myself) | ||||||
|  |  | ||||||
| @@ -266,8 +264,8 @@ class MakeAncestorTree(object): | |||||||
|         myself = FamilyBox(index) |         myself = FamilyBox(index) | ||||||
|  |  | ||||||
|         #calculate the text. |         #calculate the text. | ||||||
|         myself.text = \ |         myself.text = self.calc_items.calc_marrage(indi_handle, fams_handle) | ||||||
|                       self.calc_items.calc_marrage(indi_handle, fams_handle) |                        | ||||||
|  |  | ||||||
|         self.canvas.add_box(myself) |         self.canvas.add_box(myself) | ||||||
|      |      | ||||||
| @@ -277,9 +275,9 @@ class MakeAncestorTree(object): | |||||||
|             return |             return | ||||||
|          |          | ||||||
|         line = Line(person) |         line = Line(person) | ||||||
|         if father is not None: |         if father: | ||||||
|             line.add_to(father) |             line.add_to(father) | ||||||
|         if mother is not None: |         if mother: | ||||||
|             line.add_to(mother) |             line.add_to(mother) | ||||||
|          |          | ||||||
|         self.canvas.add_line(line) |         self.canvas.add_line(line) | ||||||
| @@ -295,13 +293,14 @@ class MakeAncestorTree(object): | |||||||
|             return None |             return None | ||||||
|          |          | ||||||
|         person = self.database.get_person_from_handle(person_handle) |         person = self.database.get_person_from_handle(person_handle) | ||||||
|         if person is None: |         if not person: | ||||||
|             return self.__fill(index, None, |             return self.__fill(index, None, | ||||||
|                                min(self.fill_out, self.max_generations-X_INDEX(index)-1)) |                       min(self.fill_out, self.max_generations-X_INDEX(index)-1) | ||||||
|  |                       ) | ||||||
|          |          | ||||||
|         parents_handle = person.get_main_parents_family_handle() |         parents_handle = person.get_main_parents_family_handle() | ||||||
|         father = marrbox = mother = None |         father = marrbox = mother = None | ||||||
|         if parents_handle is not None: |         if parents_handle: | ||||||
|             #note depth first |             #note depth first | ||||||
|             family = self.database.get_family_from_handle(parents_handle) |             family = self.database.get_family_from_handle(parents_handle) | ||||||
|             father = self.recurse(family.get_father_handle(), parents_handle, |             father = self.recurse(family.get_father_handle(), parents_handle, | ||||||
| @@ -318,7 +317,8 @@ class MakeAncestorTree(object): | |||||||
|             self.add_line(mybox, father, mother) |             self.add_line(mybox, father, mother) | ||||||
|         else: |         else: | ||||||
|             mybox = self.__fill(index, person_handle, |             mybox = self.__fill(index, person_handle, | ||||||
|                                 min(self.fill_out, self.max_generations-X_INDEX(index)-1)) |                       min(self.fill_out, self.max_generations-X_INDEX(index)-1) | ||||||
|  |                       ) | ||||||
|             #father = self.__fill(index *2, self.fill_out) |             #father = self.__fill(index *2, self.fill_out) | ||||||
|             #mybox = self.add_person_box(index, person_handle, family_handle) |             #mybox = self.add_person_box(index, person_handle, family_handle) | ||||||
|             #if self.fill_out and self.inlc_marr and (log2(index) + 2) < |             #if self.fill_out and self.inlc_marr and (log2(index) + 2) < | ||||||
| @@ -368,7 +368,8 @@ class MakeAncestorTree(object): | |||||||
|                     cur_gen += 1 |                     cur_gen += 1 | ||||||
|                 else: |                 else: | ||||||
|                     #found our father. add him |                     #found our father. add him | ||||||
|                     __BOXES[cur_gen] = self.add_person_box(__INDEX[cur_gen], None, None) |                     __BOXES[cur_gen] = self.add_person_box( | ||||||
|  |                                             __INDEX[cur_gen], None, None) | ||||||
|                      |                      | ||||||
|             ########################### |             ########################### | ||||||
|             #Step 1.5.  Dad has already been made. |             #Step 1.5.  Dad has already been made. | ||||||
| @@ -376,8 +377,8 @@ class MakeAncestorTree(object): | |||||||
|                  |                  | ||||||
|                 ########################### |                 ########################### | ||||||
|                 #Step 2.  add our kid |                 #Step 2.  add our kid | ||||||
|                 __BOXES[cur_gen-1] = \ |                 __BOXES[cur_gen-1] = self.add_person_box( | ||||||
|                     self.add_person_box(__INDEX[cur_gen-1], |                                         __INDEX[cur_gen-1], | ||||||
|                                         person_handle if cur_gen == 1 else None, |                                         person_handle if cur_gen == 1 else None, | ||||||
|                                         None) |                                         None) | ||||||
|                  |                  | ||||||
| @@ -402,7 +403,8 @@ class MakeAncestorTree(object): | |||||||
|                 else: |                 else: | ||||||
|                     ########################### |                     ########################### | ||||||
|                     #Step 3.  Now we can make Mom |                     #Step 3.  Now we can make Mom | ||||||
|                     __BOXES[cur_gen] = self.add_person_box(__INDEX[cur_gen], None, None) |                     __BOXES[cur_gen] = self.add_person_box( | ||||||
|  |                                             __INDEX[cur_gen], None, None) | ||||||
|              |              | ||||||
|             ########################### |             ########################### | ||||||
|             #Step 4.  Father and Mother are done but only 1/2 line |             #Step 4.  Father and Mother are done but only 1/2 line | ||||||
| @@ -465,7 +467,7 @@ class RLTransform(): | |||||||
|         """ put the box in it's correct spot """ |         """ put the box in it's correct spot """ | ||||||
|         #1. cm_x |         #1. cm_x | ||||||
|         box.x_cm = self.rept_opts.littleoffset |         box.x_cm = self.rept_opts.littleoffset | ||||||
|         box.x_cm += (box.level[0] * \ |         box.x_cm += (box.level[0] * | ||||||
|                 (self.rept_opts.col_width + self.rept_opts.max_box_width)) |                 (self.rept_opts.col_width + self.rept_opts.max_box_width)) | ||||||
|         #2. cm_y |         #2. cm_y | ||||||
|         box.y_cm = self.__next_y(box) * self.rept_opts.max_box_height |         box.y_cm = self.__next_y(box) * self.rept_opts.max_box_height | ||||||
| @@ -490,7 +492,7 @@ class RLTransform(): | |||||||
| #------------------------------------------------------------------------ | #------------------------------------------------------------------------ | ||||||
| class MakeReport(): | class MakeReport(): | ||||||
|  |  | ||||||
|     def __init__(self, dbase, doc, canvas, \ |     def __init__(self, dbase, doc, canvas, | ||||||
|                  font_normal, inlc_marr, compress_tree): |                  font_normal, inlc_marr, compress_tree): | ||||||
|  |  | ||||||
|         self.database = dbase |         self.database = dbase | ||||||
| @@ -579,10 +581,7 @@ class GUIConnect(): | |||||||
|         """  Return a class that holds the proper title based off of the |         """  Return a class that holds the proper title based off of the | ||||||
|         GUI options """ |         GUI options """ | ||||||
|         title_type = self.get_val('report_title') |         title_type = self.get_val('report_title') | ||||||
|         if title_type == 0: |         return TitleA(doc) if title_type else TitleN(doc) | ||||||
|             return TitleN(doc) |  | ||||||
|         else: |  | ||||||
|             return TitleA(doc) |  | ||||||
|  |  | ||||||
| #------------------------------------------------------------------------ | #------------------------------------------------------------------------ | ||||||
| # | # | ||||||
| @@ -634,8 +633,8 @@ class AncestorTree2(Report): | |||||||
|         #Title |         #Title | ||||||
|         title = self.connect.title_class(self.doc) |         title = self.connect.title_class(self.doc) | ||||||
|         center = self.database.get_person_from_gramps_id( |         center = self.database.get_person_from_gramps_id( | ||||||
|             self.connect.get_val('pid') |                     self.connect.get_val('pid') | ||||||
|         ) |                     ) | ||||||
|         title.calc_title(center) |         title.calc_title(center) | ||||||
|         self.canvas.add_title(title) |         self.canvas.add_title(title) | ||||||
|  |  | ||||||
| @@ -687,11 +686,9 @@ class AncestorTree2(Report): | |||||||
|  |  | ||||||
|         colsperpage = self.doc.get_usable_width()  |         colsperpage = self.doc.get_usable_width()  | ||||||
|         colsperpage += self.doc.report_opts.col_width |         colsperpage += self.doc.report_opts.col_width | ||||||
|         colsperpage = int(colsperpage  / (self.doc.report_opts.max_box_width + |         colsperpage = int(colsperpage / (self.doc.report_opts.max_box_width + | ||||||
|                                           self.doc.report_opts.col_width)) |                                        self.doc.report_opts.col_width)) | ||||||
|         if colsperpage == 0:  #Is the page really that small? |         colsperpage = colsperpage or 1 | ||||||
|             colsperpage = 1 |  | ||||||
|  |  | ||||||
|  |  | ||||||
|         ##################### |         ##################### | ||||||
|         #Vars |         #Vars | ||||||
| @@ -841,8 +838,10 @@ class AncestorTree2Options(MenuReportOptions): | |||||||
|         category_name = _("Secondary") |         category_name = _("Secondary") | ||||||
|  |  | ||||||
|         dispMom = TextOption(_("Secondary\nDisplay Format"),  |         dispMom = TextOption(_("Secondary\nDisplay Format"),  | ||||||
|                            ["$n","%s $b" % _BORN,"%s $m" %_MARR,"%s $d" \ |                                ["$n","%s $b" % _BORN, | ||||||
|                             %_DIED] ) |                                 "%s $m" %_MARR, | ||||||
|  |                                 "%s $d" %_DIED] | ||||||
|  |                             ) | ||||||
|         dispMom.set_help(_("Display format for the output box.")) |         dispMom.set_help(_("Display format for the output box.")) | ||||||
|         menu.add_option(category_name, "disp_sec", dispMom) |         menu.add_option(category_name, "disp_sec", dispMom) | ||||||
|  |  | ||||||
| @@ -923,9 +922,11 @@ class AncestorTree2Options(MenuReportOptions): | |||||||
|         if max_gen > 1: |         if max_gen > 1: | ||||||
|             item_list.append([1, _("One Generation of empty boxes " |             item_list.append([1, _("One Generation of empty boxes " | ||||||
|                                    "for unknown ancestors") ]) |                                    "for unknown ancestors") ]) | ||||||
|         for itr in range(2, max_gen): |  | ||||||
|             item_list.append([itr, str(itr) + _(" Generations of empty boxes " |         item_list.extend([itr, str(itr) + | ||||||
|                                                 "for unknown ancestors") ]) |                 _(" Generations of empty boxes for unknown ancestors")] | ||||||
|  |                     for itr in range(2, max_gen) | ||||||
|  |                 ) | ||||||
|              |              | ||||||
|         self.fillout.set_items(item_list) |         self.fillout.set_items(item_list) | ||||||
|         if old_val+2 > len(item_list): |         if old_val+2 > len(item_list): | ||||||
|   | |||||||
| @@ -159,43 +159,46 @@ class DescendantTitleBase(TitleBox): | |||||||
|     def descendant_print(self, person_list, person_list2 = []): |     def descendant_print(self, person_list, person_list2 = []): | ||||||
|         """ calculate the Descendant title |         """ calculate the Descendant title | ||||||
|         Person_list will always be passed |         Person_list will always be passed | ||||||
|         If in the Family reports and there are two familys, person_list2 |         If in the Family reports and there are two families, person_list2 | ||||||
|         will be used. |         will be used. | ||||||
|         """ |         """ | ||||||
|          |          | ||||||
|         names = self._get_names(person_list) |         names = self._get_names(person_list) | ||||||
|         if person_list2 != []: |  | ||||||
|             names2 = self._get_names(person_list2) |  | ||||||
|          |          | ||||||
|         if person_list2: |         if person_list2: | ||||||
|             if len(person_list) + len(person_list2) == 3: |             names2 = self._get_names(person_list2) | ||||||
|                 if len(person_list) == 1: |             if len(names) + len(names2) == 3: | ||||||
|  |                 if len(names) == 1: | ||||||
|                     title = _("Descendant Chart for %(person)s and " |                     title = _("Descendant Chart for %(person)s and " | ||||||
|                               "%(father1)s, %(mother1)s") % \ |                               "%(father1)s, %(mother1)s") % \ | ||||||
|                               {'person':  names[0], \ |                               {'person':  names[0], | ||||||
|                                'father1': names2[0], \ |                                'father1': names2[0], | ||||||
|                                'mother1': names2[1], |                                'mother1': names2[1], | ||||||
|                                 } |                               } | ||||||
|                 else: |                 else: # Should be 2 items in names list | ||||||
|                     title = _("Descendant Chart for %(person)s, %(father1)s " |                     title = _("Descendant Chart for %(person)s, %(father1)s " | ||||||
|                               "and %(mother1)s") % \ |                               "and %(mother1)s") % \ | ||||||
|                               {'father1': names[0], \ |                               {'father1': names[0], | ||||||
|                                'mother1': names[1], \ |                                'mother1': names[1], | ||||||
|                                'person':  names2[0] } |                                'person':  names2[0], | ||||||
|             else:   #if not person_list2: |                               } | ||||||
|  |             else: # Should be 2 items in both names and names2 lists | ||||||
|                 title = _("Descendant Chart for %(father1)s, %(father2)s " |                 title = _("Descendant Chart for %(father1)s, %(father2)s " | ||||||
|                           "and %(mother1)s, %(mother2)s") % \ |                           "and %(mother1)s, %(mother2)s") % \ | ||||||
|                           {'father1':  names[0], \ |                           {'father1': names[0], | ||||||
|                            'mother1':  names[1], \ |                            'mother1': names[1], | ||||||
|                            'father2':  names2[0], \ |                            'father2': names2[0], | ||||||
|                            'mother2':  names2[1] } |                            'mother2': names2[1], | ||||||
|         else: |                           } | ||||||
|  |         else: # No person_list2: Just one family | ||||||
|             if len(names) == 1: |             if len(names) == 1: | ||||||
|                 title = _("Descendant Chart for %(person)s") % \ |                 title = _("Descendant Chart for %(person)s") % \ | ||||||
|                     {'person':  names[0] } |                           {'person': names[0]} | ||||||
|             elif len(names) == 2: |             else: # Should be two items in names list | ||||||
|                 title = _("Descendant Chart for %(father)s and %(mother)s") % \ |                 title = _("Descendant Chart for %(father)s and %(mother)s") % \ | ||||||
|                    {'father':  names[0],  'mother': names[1] } |                           {'father': names[0], | ||||||
|  |                            'mother': names[1], | ||||||
|  |                           } | ||||||
|         return title |         return title | ||||||
|      |      | ||||||
|     def get_parents(self, family_id): |     def get_parents(self, family_id): | ||||||
| @@ -373,7 +376,7 @@ class RecurseDown: | |||||||
|         self.database = dbase |         self.database = dbase | ||||||
|         self.canvas = canvas |         self.canvas = canvas | ||||||
|  |  | ||||||
|         self.famalies_seen = [] |         self.famalies_seen = set() | ||||||
|         self.cols = [] |         self.cols = [] | ||||||
|         self.__last_direct = [] |         self.__last_direct = [] | ||||||
|          |          | ||||||
| @@ -509,7 +512,7 @@ class RecurseDown: | |||||||
|  |  | ||||||
|         for family_handle in family_handles: |         for family_handle in family_handles: | ||||||
|             if family_handle not in self.famalies_seen: |             if family_handle not in self.famalies_seen: | ||||||
|                 self.famalies_seen.append(family_handle) |                 self.famalies_seen.add(family_handle) | ||||||
|  |  | ||||||
|                 family = self.database.get_family_from_handle(family_handle) |                 family = self.database.get_family_from_handle(family_handle) | ||||||
|                  |                  | ||||||
| @@ -535,17 +538,19 @@ class RecurseDown: | |||||||
|  |  | ||||||
|                 mykids = [kid.ref for kid in family.get_child_ref_list()] |                 mykids = [kid.ref for kid in family.get_child_ref_list()] | ||||||
|  |  | ||||||
|  |                 def _child_recurse(who): | ||||||
|  |                     self.recurse(child_ref, x_level+1, 0, who) | ||||||
|                 for child_ref in mykids: |                 for child_ref in mykids: | ||||||
|                     if self.inlc_marr and self.max_spouses > 0: |                     if self.inlc_marr and self.max_spouses > 0: | ||||||
|                         self.recurse(child_ref, x_level+1, 0, marr) |                         _child_recurse(marr) | ||||||
|                     elif spouse: |                     elif spouse: | ||||||
|                         self.recurse(child_ref, x_level+1, 0, spouse) |                         _child_recurse(spouse) | ||||||
|                     else: |                     else: | ||||||
|                         self.recurse(child_ref, x_level+1, 0, myself) |                         _child_recurse(myself) | ||||||
|                 first = 0 |                 first = 0 | ||||||
|  |  | ||||||
|                 if self.max_spouses > s_level and spouse_handle and \ |                 if self.max_spouses > s_level and \ | ||||||
|                    self.famalies_seen.count(spouse_handle): |                    spouse_handle in self.famalies_seen: | ||||||
|                     #spouse_handle = ReportUtils.find_spouse(person,family) |                     #spouse_handle = ReportUtils.find_spouse(person,family) | ||||||
|                     self.recurse(spouse_handle, x_level, s_level+1, spouse) |                     self.recurse(spouse_handle, x_level, s_level+1, spouse) | ||||||
|  |  | ||||||
| @@ -561,21 +566,23 @@ class RecurseDown: | |||||||
|          |          | ||||||
|         self.bold_now = 2 |         self.bold_now = 2 | ||||||
|         if father_h == None: |         if father_h == None: | ||||||
|             father_b = self.add_person_box( (level, 0), None, None, father2) |             father_b = self.add_person_box( | ||||||
|  |                 (level, 0), None, None, father2) | ||||||
|         else: |         else: | ||||||
|             father_b = self.add_person_box( (level, 0), father_h, |             father_b = self.add_person_box( | ||||||
|                                             family_h, father2) |                 (level, 0), father_h, family_h, father2) | ||||||
|          |          | ||||||
|         if self.inlc_marr: |         if self.inlc_marr: | ||||||
|             family_b = self.add_marriage_box( (level, 1), father_h, |             family_b = self.add_marriage_box( | ||||||
|                                               family_h, father_b) |                 (level, 1), father_h, family_h, father_b) | ||||||
|         self.famalies_seen.append(family_h) |         self.famalies_seen.add(family_h) | ||||||
|          |          | ||||||
|         if mother_h: |         if mother_h: | ||||||
|             mother_b = self.add_person_box( (level, 0), mother_h, |             mother_b = self.add_person_box( | ||||||
|                                             family_h, father_b) |                 (level, 0), mother_h, family_h, father_b) | ||||||
|         else: |         else: | ||||||
|             mother_b = self.add_person_box( (level, 0), None, None, father_b) |             mother_b = self.add_person_box( | ||||||
|  |                 (level, 0), None, None, father_b) | ||||||
|          |          | ||||||
|         #child_refs = [] |         #child_refs = [] | ||||||
|         #for child_ref in family.get_child_ref_list(): |         #for child_ref in family.get_child_ref_list(): | ||||||
| @@ -633,7 +640,7 @@ class RecurseDown: | |||||||
|                 show = self.has_children(person_handle) |                 show = self.has_children(person_handle) | ||||||
|          |          | ||||||
|         #if self.max_spouses == 0 and not self.has_children(person_handle): |         #if self.max_spouses == 0 and not self.has_children(person_handle): | ||||||
|         #    self.famalies_seen.append(person_handle) |         #    self.famalies_seen.add(person_handle) | ||||||
|         #    show = False |         #    show = False | ||||||
|  |  | ||||||
|         if show: |         if show: | ||||||
| @@ -677,7 +684,7 @@ class MakePersonTree(RecurseDown): | |||||||
|         ####################### |         ####################### | ||||||
|         #don't do center person's parents family. |         #don't do center person's parents family. | ||||||
|         if family2_h: |         if family2_h: | ||||||
|             self.famalies_seen.append(family2_h) |             self.famalies_seen.add(family2_h) | ||||||
|  |  | ||||||
|         ####################### |         ####################### | ||||||
|         #Center person's Fathers OTHER wives |         #Center person's Fathers OTHER wives | ||||||
| @@ -763,7 +770,7 @@ class MakeFamilyTree(RecurseDown): | |||||||
|         ####################### |         ####################### | ||||||
|         #don't do my fathers parents family.  will be done later |         #don't do my fathers parents family.  will be done later | ||||||
|         if family2_h: |         if family2_h: | ||||||
|             self.famalies_seen.append(family2_h) |             self.famalies_seen.add(family2_h) | ||||||
|          |          | ||||||
|         ####################### |         ####################### | ||||||
|         #my father mothers OTHER husbands |         #my father mothers OTHER husbands | ||||||
| @@ -781,10 +788,10 @@ class MakeFamilyTree(RecurseDown): | |||||||
|          |          | ||||||
|         ####################### |         ####################### | ||||||
|         #don't do my parents family in recurse.  will be done later |         #don't do my parents family in recurse.  will be done later | ||||||
|         self.famalies_seen.append(family1_h) |         self.famalies_seen.add(family1_h) | ||||||
|         ##If dad has no other children from other marriages.  remove him |         ##If dad has no other children from other marriages.  remove him | ||||||
|         if self.max_spouses == 0 and not self.has_children(father1_h): |         if self.max_spouses == 0 and not self.has_children(father1_h): | ||||||
|             self.famalies_seen.append(father1_h) |             self.famalies_seen.add(father1_h) | ||||||
|          |          | ||||||
|         ####################### |         ####################### | ||||||
|         #my fathers parents! |         #my fathers parents! | ||||||
| @@ -801,7 +808,7 @@ class MakeFamilyTree(RecurseDown): | |||||||
|                     #this parent again IF s/he has children |                     #this parent again IF s/he has children | ||||||
|                     show = self.has_children(father1_h) |                     show = self.has_children(father1_h) | ||||||
|             if not show: |             if not show: | ||||||
|                 self.famalies_seen.append(father1_h) |                 self.famalies_seen.add(father1_h) | ||||||
|  |  | ||||||
|             father2_id = self.add_family( 0, family2, None ) |             father2_id = self.add_family( 0, family2, None ) | ||||||
|  |  | ||||||
| @@ -881,17 +888,17 @@ class MakeFamilyTree(RecurseDown): | |||||||
|  |  | ||||||
|         ####################### |         ####################### | ||||||
|         #don't do my parents family. |         #don't do my parents family. | ||||||
|         self.famalies_seen = [family1_h]   |         self.famalies_seen = set([family1_h]  ) | ||||||
|         ##If mom has no other children from other marriages.  remove her |         ##If mom has no other children from other marriages.  remove her | ||||||
|         if self.max_spouses == 0 and not self.has_children(mother1_h): |         if self.max_spouses == 0 and not self.has_children(mother1_h): | ||||||
|             self.famalies_seen.append(mother1_h) |             self.famalies_seen.add(mother1_h) | ||||||
|  |  | ||||||
|         if mother1_h: |         if mother1_h: | ||||||
|             myfams = mother1.get_family_handle_list() |             myfams = mother1.get_family_handle_list() | ||||||
|             if len(myfams) < 2: |             if len(myfams) < 2: | ||||||
|                 #If mom didn't have any other families, don't even do her |                 #If mom didn't have any other families, don't even do her | ||||||
|                 #she is already here with dad and will be added later |                 #she is already here with dad and will be added later | ||||||
|                 self.famalies_seen.append(mother1_h) |                 self.famalies_seen.add(mother1_h) | ||||||
|  |  | ||||||
|         ####################### |         ####################### | ||||||
|         #my mother other spouses (if no parents) |         #my mother other spouses (if no parents) | ||||||
| @@ -1166,14 +1173,14 @@ class MakeReport(object): | |||||||
|             #remove column 0 and move everyone back one level |             #remove column 0 and move everyone back one level | ||||||
|             self.cols.pop(0) |             self.cols.pop(0) | ||||||
|             for box in self.canvas.boxes: |             for box in self.canvas.boxes: | ||||||
|                 box.level = (box.level[0]-1, box.level[1]) |                 box.level = (box.level[0] - 1, box.level[1]) | ||||||
|          |          | ||||||
|         #go ahead and set it now. |         #go ahead and set it now. | ||||||
|         width = self.canvas.doc.report_opts.max_box_width |         width = self.canvas.doc.report_opts.max_box_width | ||||||
|         for box in self.canvas.boxes: |         for box in self.canvas.boxes: | ||||||
|             box.width = width - box.x_cm |             box.width = width - box.x_cm | ||||||
|             box.x_cm += self.canvas.doc.report_opts.littleoffset |             box.x_cm += self.canvas.doc.report_opts.littleoffset | ||||||
|             box.x_cm += (box.level[0] * \ |             box.x_cm += (box.level[0] * | ||||||
|                     (self.canvas.doc.report_opts.col_width + |                     (self.canvas.doc.report_opts.col_width + | ||||||
|                      self.canvas.doc.report_opts.max_box_width)) |                      self.canvas.doc.report_opts.max_box_width)) | ||||||
|              |              | ||||||
| @@ -1246,8 +1253,7 @@ class GuiConnect(): | |||||||
|          |          | ||||||
|         if box.boxstr == "CG2-fam-box":  #((((( |         if box.boxstr == "CG2-fam-box":  #((((( | ||||||
|             workinglines = display_marr |             workinglines = display_marr | ||||||
|         elif box.level[1] > 0 or (box.level[0] == 0 and |         elif box.level[1] > 0 or (box.level[0] == 0 and box.father): | ||||||
|                                    box.father is not None): |  | ||||||
|             workinglines = display_spou |             workinglines = display_spou | ||||||
|         else: |         else: | ||||||
|             workinglines = display |             workinglines = display | ||||||
| @@ -1345,9 +1351,8 @@ class Descend2Tree(Report): | |||||||
|         colsperpage += self.doc.report_opts.col_width |         colsperpage += self.doc.report_opts.col_width | ||||||
|         tmp = self.doc.report_opts.max_box_width |         tmp = self.doc.report_opts.max_box_width | ||||||
|         tmp += self.doc.report_opts.col_width |         tmp += self.doc.report_opts.col_width | ||||||
|         colsperpage = int( colsperpage / tmp ) |         colsperpage = int(colsperpage / tmp) | ||||||
|         if colsperpage == 0:  #Is the page really that small? |         colsperpage = colsperpage or 1 | ||||||
|             colsperpage = 1 |  | ||||||
|          |          | ||||||
|         ##################### |         ##################### | ||||||
|         #Vars |         #Vars | ||||||
| @@ -1465,10 +1470,12 @@ class Descend2TreeOptions(MenuReportOptions): | |||||||
|             menu.add_option(category_name, "pid", self.__pid) |             menu.add_option(category_name, "pid", self.__pid) | ||||||
|  |  | ||||||
|         self.showparents = BooleanOption( |         self.showparents = BooleanOption( | ||||||
|             _('Start with the parent(s) of the selected first'), True) |             _('Start with the parent(s) of the selected first'), | ||||||
|  |             True) | ||||||
|         self.showparents.set_help( |         self.showparents.set_help( | ||||||
|             _("Will show the parents, brother and sisters of the " |             _("Will show the parents, brother and sisters of the " | ||||||
|               "selected person.")) |               "selected person.") | ||||||
|  |             ) | ||||||
|         menu.add_option(category_name, "show_gparents", self.showparents) |         menu.add_option(category_name, "show_gparents", self.showparents) | ||||||
|  |  | ||||||
|         max_gen = NumberOption(_("Generations"), 2, 1, 50) |         max_gen = NumberOption(_("Generations"), 2, 1, 50) | ||||||
| @@ -1492,8 +1499,10 @@ class Descend2TreeOptions(MenuReportOptions): | |||||||
|         menu.add_option(category_name, "dispf", disp) |         menu.add_option(category_name, "dispf", disp) | ||||||
|  |  | ||||||
|         bold = BooleanOption(_('Bold direct descendants'), True) |         bold = BooleanOption(_('Bold direct descendants'), True) | ||||||
|         bold.set_help(_("Whether to bold those people that are direct " |         bold.set_help( | ||||||
|                         "(not step or half) descendants.")) |             _("Whether to bold those people that are direct " | ||||||
|  |               "(not step or half) descendants.") | ||||||
|  |             ) | ||||||
|         menu.add_option(category_name, "bolddirect", bold) |         menu.add_option(category_name, "bolddirect", bold) | ||||||
|  |  | ||||||
|         #Will add when libsubstkeyword supports it. |         #Will add when libsubstkeyword supports it. | ||||||
| @@ -1506,8 +1515,9 @@ class Descend2TreeOptions(MenuReportOptions): | |||||||
|  |  | ||||||
|         category_name = _("Secondary") |         category_name = _("Secondary") | ||||||
|  |  | ||||||
|         diffspouse = BooleanOption(_('Use seperate display format for ' |         diffspouse = BooleanOption( | ||||||
|                                      'spouses'), True) |             _("Use seperate display format for spouses"), | ||||||
|  |             True) | ||||||
|         diffspouse.set_help(_("Whether spouses can have a different format.")) |         diffspouse.set_help(_("Whether spouses can have a different format.")) | ||||||
|         menu.add_option(category_name, "diffspouse", diffspouse) |         menu.add_option(category_name, "diffspouse", diffspouse) | ||||||
|  |  | ||||||
| @@ -1521,8 +1531,9 @@ class Descend2TreeOptions(MenuReportOptions): | |||||||
|         menu.add_option(category_name, "sdispf", sdisp) |         menu.add_option(category_name, "sdispf", sdisp) | ||||||
|  |  | ||||||
|         incmarr = BooleanOption(_('Include Marriage information'), True) |         incmarr = BooleanOption(_('Include Marriage information'), True) | ||||||
|         incmarr.set_help(_("Whether to include marriage information in the " |         incmarr.set_help( | ||||||
|                            "report.")) |             _("Whether to include marriage information in the report.") | ||||||
|  |             ) | ||||||
|         menu.add_option(category_name, "incmarr", incmarr) |         menu.add_option(category_name, "incmarr", incmarr) | ||||||
|  |  | ||||||
|         marrdisp = StringOption(_("Marriage\nDisplay Format"), "%s $m" % _MARR)  |         marrdisp = StringOption(_("Marriage\nDisplay Format"), "%s $m" % _MARR)  | ||||||
| @@ -1531,8 +1542,9 @@ class Descend2TreeOptions(MenuReportOptions): | |||||||
|  |  | ||||||
|         category_name = _("Replace") |         category_name = _("Replace") | ||||||
|  |  | ||||||
|         repldisp = TextOption(_("Replace Display Format:\n'Replace this'/'" |         repldisp = TextOption( | ||||||
|                                 "with this'"), []) |             _("Replace Display Format:\n'Replace this'/' with this'"), | ||||||
|  |             []) | ||||||
|         repldisp.set_help(_("i.e.\nUnited States of America/U.S.A")) |         repldisp.set_help(_("i.e.\nUnited States of America/U.S.A")) | ||||||
|         menu.add_option(category_name, "replacelist", repldisp) |         menu.add_option(category_name, "replacelist", repldisp) | ||||||
|  |  | ||||||
| @@ -1542,14 +1554,17 @@ class Descend2TreeOptions(MenuReportOptions): | |||||||
|         self.scale.add_item( 0, "Do not scale report") |         self.scale.add_item( 0, "Do not scale report") | ||||||
|         self.scale.add_item( 1, "Scale report to fit page width only") |         self.scale.add_item( 1, "Scale report to fit page width only") | ||||||
|         self.scale.add_item( 2, "Scale report to fit the size of the page") |         self.scale.add_item( 2, "Scale report to fit the size of the page") | ||||||
|         self.scale.set_help(_("Whether to scale the report to fit a " |         self.scale.set_help( | ||||||
|                               "specific size")) |             _("Whether to scale the report to fit a specific size") | ||||||
|  |             ) | ||||||
|         menu.add_option(category_name, "scale_report", self.scale) |         menu.add_option(category_name, "scale_report", self.scale) | ||||||
|         self.scale.connect('value-changed', self.__check_blank) |         self.scale.connect('value-changed', self.__check_blank) | ||||||
|  |  | ||||||
|         self.__onepage = BooleanOption(_('One page report'), True) |         self.__onepage = BooleanOption(_('One page report'), True) | ||||||
|         self.__onepage.set_help(_("Whether to scale the size of the page to " |         self.__onepage.set_help( | ||||||
|                                   "the size of the report.")) |             _("Whether to scale the size of the page to " | ||||||
|  |               "the size of the report.") | ||||||
|  |             ) | ||||||
|         menu.add_option(category_name, "onepage", self.__onepage) |         menu.add_option(category_name, "onepage", self.__onepage) | ||||||
|         self.__onepage.connect('value-changed', self.__check_blank) |         self.__onepage.connect('value-changed', self.__check_blank) | ||||||
|  |  | ||||||
| @@ -1574,12 +1589,14 @@ class Descend2TreeOptions(MenuReportOptions): | |||||||
|         category_name = _("Notes") |         category_name = _("Notes") | ||||||
|  |  | ||||||
|         self.usenote = BooleanOption(_('Include a personal note'), False) |         self.usenote = BooleanOption(_('Include a personal note'), False) | ||||||
|         self.usenote.set_help(_("Whether to include a personalized note on " |         self.usenote.set_help( | ||||||
|                                 "the report.")) |             _("Whether to include a personalized note on the report.") | ||||||
|  |             ) | ||||||
|         menu.add_option(category_name, "use_note", self.usenote) |         menu.add_option(category_name, "use_note", self.usenote) | ||||||
|  |  | ||||||
|         self.notedisp = TextOption(_("Note to add\nto the graph\n\n$T " |         self.notedisp = TextOption( | ||||||
|                                      "inserts today's date"), []) |             _("Note to add\nto the graph\n\n$T inserts today's date"), | ||||||
|  |             []) | ||||||
|         self.notedisp.set_help(_("Add a personal note")) |         self.notedisp.set_help(_("Add a personal note")) | ||||||
|         menu.add_option(category_name, "note_disp", self.notedisp) |         menu.add_option(category_name, "note_disp", self.notedisp) | ||||||
|  |  | ||||||
| @@ -1596,13 +1613,18 @@ class Descend2TreeOptions(MenuReportOptions): | |||||||
|         self.__blank.set_available( off ) |         self.__blank.set_available( off ) | ||||||
|          |          | ||||||
|     def __Title_enum(self): |     def __Title_enum(self): | ||||||
|         item_list = [] |         item_list = [ | ||||||
|         item_list.append([0, "Do not print a title" ]) |             [0, "Do not print a title" ], | ||||||
|         item_list.append([1, "Descendant Chart for [selected person(s)]" ]) |             [1, "Descendant Chart for [selected person(s)]" ], | ||||||
|  |             ] | ||||||
|         if self.name != _RPT_NAME: |         if self.name != _RPT_NAME: | ||||||
|             item_list.append([2, "Family Chart for [names of chosen family]" ]) |             item_list.append( | ||||||
|  |                 [2, "Family Chart for [names of chosen family]" ] | ||||||
|  |                 ) | ||||||
|             if self.showparents.get_value(): |             if self.showparents.get_value(): | ||||||
|                 item_list.append([3, "Cousin Chart for [names of children]" ]) |                 item_list.append( | ||||||
|  |                     [3, "Cousin Chart for [names of children]" ] | ||||||
|  |                     ) | ||||||
|         self.title.set_items(item_list) |         self.title.set_items(item_list) | ||||||
|  |  | ||||||
|     def make_default_style(self, default_style): |     def make_default_style(self, default_style): | ||||||
| @@ -1618,8 +1640,9 @@ class Descend2TreeOptions(MenuReportOptions): | |||||||
|         para_style = ParagraphStyle() |         para_style = ParagraphStyle() | ||||||
|         para_style.set_font(font) |         para_style.set_font(font) | ||||||
|         para_style.set_alignment(PARA_ALIGN_CENTER) |         para_style.set_alignment(PARA_ALIGN_CENTER) | ||||||
|         para_style.set_description(_('The basic style used for the ' |         para_style.set_description( | ||||||
|                                      'title display.')) |             _("The basic style used for the title display.") | ||||||
|  |             ) | ||||||
|         default_style.add_paragraph_style("CG2-Title", para_style) |         default_style.add_paragraph_style("CG2-Title", para_style) | ||||||
|  |  | ||||||
|         font = FontStyle() |         font = FontStyle() | ||||||
| @@ -1627,8 +1650,9 @@ class Descend2TreeOptions(MenuReportOptions): | |||||||
|         font.set_type_face(FONT_SANS_SERIF) |         font.set_type_face(FONT_SANS_SERIF) | ||||||
|         para_style = ParagraphStyle() |         para_style = ParagraphStyle() | ||||||
|         para_style.set_font(font) |         para_style.set_font(font) | ||||||
|         para_style.set_description(_('The basic style used for the ' |         para_style.set_description( | ||||||
|                                      'text display.')) |             _('The basic style used for the text display.') | ||||||
|  |             ) | ||||||
|         default_style.add_paragraph_style("CG2-Normal", para_style) |         default_style.add_paragraph_style("CG2-Normal", para_style) | ||||||
|  |  | ||||||
|         #Set the size of the shadow based on the font size!  Much better |         #Set the size of the shadow based on the font size!  Much better | ||||||
| @@ -1638,8 +1662,9 @@ class Descend2TreeOptions(MenuReportOptions): | |||||||
|         font.set_bold(True) |         font.set_bold(True) | ||||||
|         para_style = ParagraphStyle() |         para_style = ParagraphStyle() | ||||||
|         para_style.set_font(font) |         para_style.set_font(font) | ||||||
|         para_style.set_description(_('The bold style used for the ' |         para_style.set_description( | ||||||
|                                      'text display.')) |             _('The bold style used for the text display.') | ||||||
|  |             ) | ||||||
|         default_style.add_paragraph_style("CG2-Bold", para_style) |         default_style.add_paragraph_style("CG2-Bold", para_style) | ||||||
|  |  | ||||||
|         graph_style = GraphicsStyle() |         graph_style = GraphicsStyle() | ||||||
|   | |||||||
| @@ -609,16 +609,13 @@ class TitleBox(BoxBase): | |||||||
|     def _get_names(self, persons): |     def _get_names(self, persons): | ||||||
|         """  A helper function that receives a list of persons and |         """  A helper function that receives a list of persons and | ||||||
|         returns their names in a list """ |         returns their names in a list """ | ||||||
|         tmp = [] |         return [name_displayer.display(person) for person in persons] | ||||||
|         for person in persons: |  | ||||||
|             tmp.append(name_displayer.display(person)) |  | ||||||
|         return tmp |  | ||||||
|  |  | ||||||
|     def display(self): |     def display(self): | ||||||
|         """ display the title box.  """ |         """ display the title box.  """ | ||||||
|         if self.page.y_page_num != 0 or self.boxstr == "None": |         if self.page.y_page_num or self.boxstr == "None": | ||||||
|             return |             return | ||||||
|         if self.text != "": |         if self.text: | ||||||
|             self.doc.center_text(self.boxstr, self.text, |             self.doc.center_text(self.boxstr, self.text, | ||||||
|                              self.width/2, self.y_cm) |                              self.width/2, self.y_cm) | ||||||
|      |      | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user