increase pylint score of two more reports, to above 9.00
This commit is contained in:
parent
c52b806702
commit
cf8a6390ca
@ -142,28 +142,28 @@ class CalcItems:
|
||||
and text for each person / marriage
|
||||
"""
|
||||
def __init__(self, dbase):
|
||||
__gui = GUIConnect()
|
||||
_gui = GUIConnect()
|
||||
|
||||
#calculate the printed lines for each box
|
||||
#display_repl = [] #Not used in this report
|
||||
#str = ""
|
||||
#if self.get_val('miss_val'):
|
||||
# str = "_____"
|
||||
self.__calc_l = CalcLines(dbase, [], __gui._locale, __gui._nd)
|
||||
self.__calc_l = CalcLines(dbase, [], _gui.locale, _gui.n_d)
|
||||
|
||||
self.__blank_father = None
|
||||
self.__blank_mother = None
|
||||
|
||||
self.__blank_father = \
|
||||
self.__calc_l.calc_lines( None, None, __gui.get_val("father_disp"))
|
||||
self.__calc_l.calc_lines(None, None, _gui.get_val("father_disp"))
|
||||
self.__blank_mother = \
|
||||
self.__calc_l.calc_lines( None, None, __gui.get_val("mother_disp"))
|
||||
self.__calc_l.calc_lines(None, None, _gui.get_val("mother_disp"))
|
||||
|
||||
self.center_use = __gui.get_val("center_uses")
|
||||
self.disp_father = __gui.get_val("father_disp")
|
||||
self.disp_mother = __gui.get_val("mother_disp")
|
||||
self.center_use = _gui.get_val("center_uses")
|
||||
self.disp_father = _gui.get_val("father_disp")
|
||||
self.disp_mother = _gui.get_val("mother_disp")
|
||||
|
||||
self.disp_marr = [__gui.get_val("marr_disp")]
|
||||
self.disp_marr = [_gui.get_val("marr_disp")]
|
||||
self.__blank_marriage = \
|
||||
self.__calc_l.calc_lines(None, None, self.disp_marr)
|
||||
|
||||
@ -184,14 +184,14 @@ class CalcItems:
|
||||
return working_lines
|
||||
else:
|
||||
return self.__calc_l.calc_lines(indi_handle, fams_handle,
|
||||
working_lines)
|
||||
working_lines)
|
||||
|
||||
def calc_marriage(self, indi_handle, fams_handle):
|
||||
if indi_handle == fams_handle == None:
|
||||
return self.__blank_marriage
|
||||
else:
|
||||
return self.__calc_l.calc_lines(indi_handle, fams_handle,
|
||||
self.disp_marr)
|
||||
self.disp_marr)
|
||||
|
||||
class MakeAncestorTree(AscendPerson):
|
||||
"""
|
||||
@ -227,11 +227,11 @@ class MakeAncestorTree(AscendPerson):
|
||||
if index[LVL_GEN] > self.max_generation:
|
||||
self.max_generation = index[LVL_GEN]
|
||||
|
||||
myself.text = self.calc_items.calc_person(
|
||||
index, indi_handle, fams_handle)
|
||||
myself.text = self.calc_items.calc_person(index,
|
||||
indi_handle, fams_handle)
|
||||
|
||||
myself.add_mark(self.database,
|
||||
self.database.get_person_from_handle(indi_handle))
|
||||
self.database.get_person_from_handle(indi_handle))
|
||||
|
||||
self.canvas.add_box(myself)
|
||||
|
||||
@ -282,11 +282,12 @@ class MakeAncestorTree(AscendPerson):
|
||||
then compress the tree if desired
|
||||
'''
|
||||
min_y = self.y_index(self.canvas.boxes[0].level[LVL_GEN],
|
||||
self.canvas.boxes[0].level[LVL_INDX])
|
||||
self.canvas.boxes[0].level[LVL_INDX])
|
||||
for box in self.canvas.boxes:
|
||||
if "fam" in box.boxstr:
|
||||
box.level = box.level + \
|
||||
(self.y_index(box.level[LVL_GEN]-1, int(box.level[LVL_INDX]/2)),)
|
||||
(self.y_index(box.level[LVL_GEN]-1,
|
||||
int(box.level[LVL_INDX]/2)),)
|
||||
else:
|
||||
box.level = box.level + \
|
||||
(self.y_index(box.level[LVL_GEN], box.level[LVL_INDX]),)
|
||||
@ -331,27 +332,28 @@ class MakeAncestorTree(AscendPerson):
|
||||
|
||||
move = level - (len(mykids)//2) + ((len(mykids)+1)%2)
|
||||
|
||||
if move < 0: # more kids than parents. ran off the page. Move them all down
|
||||
if move < 0:
|
||||
# more kids than parents. ran off the page. Move them all down
|
||||
for box in self.canvas.boxes:
|
||||
box.level = (box.level[0], box.level[1], box.level[2]-move)
|
||||
move = 0
|
||||
|
||||
|
||||
line.start = []
|
||||
r = -1 # if len(mykids)%2 == 1 else 0
|
||||
rrr = -1 # if len(mykids)%2 == 1 else 0
|
||||
for kid in mykids:
|
||||
r += 1
|
||||
me = self.add_person((1, 1, move+r), kid, self.center_family)
|
||||
line.add_from(me)
|
||||
#me.level = (0, 1, level - (len(mykids)//2)+r )
|
||||
rrr += 1
|
||||
mee = self.add_person((1, 1, move+rrr), kid, self.center_family)
|
||||
line.add_from(mee)
|
||||
#mee.level = (0, 1, level - (len(mykids)//2)+rrr)
|
||||
|
||||
|
||||
def start(self, person_id):
|
||||
""" go ahead and make it happen """
|
||||
center = self.database.get_person_from_gramps_id(person_id)
|
||||
if center is None:
|
||||
raise ReportError(_("Person %s is not in the Database")
|
||||
% person_id)
|
||||
raise ReportError(
|
||||
_("Person %s is not in the Database") % person_id)
|
||||
center_h = center.get_handle()
|
||||
|
||||
#Step 1. Get the people
|
||||
@ -386,7 +388,7 @@ class LRTransform:
|
||||
#1. cm_x
|
||||
box.x_cm = self.rept_opts.littleoffset
|
||||
box.x_cm += (box.level[LVL_GEN] *
|
||||
(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
|
||||
box.y_cm = self.rept_opts.max_box_height + self.rept_opts.box_pgap
|
||||
box.y_cm *= box.level[LVL_Y]
|
||||
@ -448,7 +450,7 @@ class MakeReport:
|
||||
return self.max_generations
|
||||
|
||||
def start(self):
|
||||
__gui = GUIConnect()
|
||||
## __gui = GUIConnect()
|
||||
# 1.
|
||||
#set the sizes for each box and get the max_generations.
|
||||
self.father_ht = 0.0
|
||||
@ -490,8 +492,8 @@ class GUIConnect:
|
||||
def set__opts(self, options, locale, name_displayer):
|
||||
""" Set only once as we are BORG. """
|
||||
self.__opts = options
|
||||
self._locale = locale
|
||||
self._nd = name_displayer
|
||||
self.locale = locale
|
||||
self.n_d = name_displayer
|
||||
|
||||
def get_val(self, val):
|
||||
""" Get a GUI value. """
|
||||
@ -506,9 +508,9 @@ class GUIConnect:
|
||||
GUI options """
|
||||
title_type = self.get_val('report_title')
|
||||
if title_type:
|
||||
return TitleA(doc, self._locale, self._nd)
|
||||
return TitleA(doc, self.locale, self.n_d)
|
||||
else:
|
||||
return TitleN(doc, self._locale)
|
||||
return TitleN(doc, self.locale)
|
||||
|
||||
def inc_marr(self):
|
||||
return self.get_val("inc_marr")
|
||||
@ -531,6 +533,7 @@ class GUIConnect:
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class AncestorTree(Report):
|
||||
""" AncestorTree Report """
|
||||
|
||||
def __init__(self, database, options, user):
|
||||
"""
|
||||
@ -588,7 +591,7 @@ class AncestorTree(Report):
|
||||
|
||||
#The canvas that we will put our report on and print off of
|
||||
self.canvas = Canvas(self.doc,
|
||||
ReportOptions(self.doc, font_normal, 'AC2-line'))
|
||||
ReportOptions(self.doc, font_normal, 'AC2-line'))
|
||||
|
||||
self.canvas.report_opts.box_shadow *= \
|
||||
self.connect.get_val('shadowscale')
|
||||
@ -596,10 +599,10 @@ class AncestorTree(Report):
|
||||
self.canvas.report_opts.box_mgap *= self.connect.get_val('box_Yscale')
|
||||
|
||||
with self._user.progress(_('Ancestor Tree'),
|
||||
_('Making the Tree...'), 4) as step:
|
||||
_('Making the Tree...'), 4) as step:
|
||||
|
||||
#make the tree onto the canvas
|
||||
inlc_marr = self.connect.get_val("inc_marr")
|
||||
## inlc_marr = self.connect.get_val("inc_marr")
|
||||
self.max_generations = self.connect.get_val('maxgen')
|
||||
tree = MakeAncestorTree(database, self.canvas)
|
||||
tree.start(self.connect.get_val('pid'))
|
||||
@ -610,8 +613,7 @@ class AncestorTree(Report):
|
||||
#Title
|
||||
title = self.connect.title_class(self.doc)
|
||||
center = self.database.get_person_from_gramps_id(
|
||||
self.connect.get_val('pid')
|
||||
)
|
||||
self.connect.get_val('pid'))
|
||||
title.calc_title(center)
|
||||
self.canvas.add_title(title)
|
||||
|
||||
@ -639,7 +641,8 @@ class AncestorTree(Report):
|
||||
scale_report = self.connect.get_val("scale_tree")
|
||||
|
||||
scale = self.canvas.scale_report(one_page,
|
||||
scale_report != 0, scale_report == 2)
|
||||
scale_report != 0,
|
||||
scale_report == 2)
|
||||
|
||||
step()
|
||||
|
||||
@ -662,7 +665,7 @@ class AncestorTree(Report):
|
||||
colsperpage = self.doc.get_usable_width()
|
||||
colsperpage += self.canvas.report_opts.col_width
|
||||
colsperpage = int(colsperpage / (self.canvas.report_opts.max_box_width +
|
||||
self.canvas.report_opts.col_width))
|
||||
self.canvas.report_opts.col_width))
|
||||
colsperpage = colsperpage or 1
|
||||
|
||||
#####################
|
||||
@ -681,8 +684,8 @@ class AncestorTree(Report):
|
||||
#lets finally make some pages!!!
|
||||
#####################
|
||||
pages = self.canvas.page_count(incblank)
|
||||
with self._user.progress( _('Ancestor Tree'),
|
||||
_('Printing the Tree...'), pages) as step:
|
||||
with self._user.progress(_('Ancestor Tree'),
|
||||
_('Printing the Tree...'), pages) as step:
|
||||
|
||||
for page in self.canvas.page_iter_gen(incblank):
|
||||
|
||||
@ -783,9 +786,11 @@ class AncestorTreeOptions(MenuReportOptions):
|
||||
|
||||
stdoptions.add_private_data_option(menu, category_name)
|
||||
|
||||
siblings = BooleanOption(_('Include siblings of the center person'), False)
|
||||
siblings.set_help(_("Whether to only display the center person or all "
|
||||
"of his/her siblings too"))
|
||||
siblings = BooleanOption(
|
||||
_('Include siblings of the center person'), False)
|
||||
siblings.set_help(
|
||||
_("Whether to only display the center person or all "
|
||||
"of his/her siblings too"))
|
||||
menu.add_option(category_name, "inc_siblings", siblings)
|
||||
|
||||
self.max_gen = NumberOption(_("Generations"), 10, 1, 50)
|
||||
@ -803,16 +808,17 @@ class AncestorTreeOptions(MenuReportOptions):
|
||||
self.__fillout_vals()
|
||||
|
||||
compress = BooleanOption(_('Compress tree'), True)
|
||||
compress.set_help(_("Whether to remove any extra blank spaces set "
|
||||
"aside for people that are unknown"))
|
||||
compress.set_help(
|
||||
_("Whether to remove any extra blank spaces set "
|
||||
"aside for people that are unknown"))
|
||||
menu.add_option(category_name, "compress_tree", compress)
|
||||
|
||||
#better to 'Show siblings of\nthe center person
|
||||
#Spouse_disp = EnumeratedListOption(_("Show spouses of\nthe center "
|
||||
# "person"), 0)
|
||||
#Spouse_disp.add_item( 0, _("No. Do not show Spouses"))
|
||||
#Spouse_disp.add_item( 1, _("Yes, and use the Main Display Format"))
|
||||
#Spouse_disp.add_item( 2, _("Yes, and use the Secondary "
|
||||
#Spouse_disp.add_item(0, _("No. Do not show Spouses"))
|
||||
#Spouse_disp.add_item(1, _("Yes, and use the Main Display Format"))
|
||||
#Spouse_disp.add_item(2, _("Yes, and use the Secondary "
|
||||
# "Display Format"))
|
||||
#Spouse_disp.set_help(_("Show spouses of the center person?"))
|
||||
#menu.add_option(category_name, "Spouse_disp", Spouse_disp)
|
||||
@ -840,37 +846,36 @@ class AncestorTreeOptions(MenuReportOptions):
|
||||
category_name = _("Display")
|
||||
|
||||
disp = TextOption(_("Father\nDisplay Format"),
|
||||
["$n",
|
||||
"%s $b" %_BORN,
|
||||
"-{%s $d}" %_DIED])
|
||||
["$n",
|
||||
"%s $b" %_BORN,
|
||||
"-{%s $d}" %_DIED])
|
||||
disp.set_help(_("Display format for the fathers box."))
|
||||
menu.add_option(category_name, "father_disp", disp)
|
||||
|
||||
#Will add when libsubstkeyword supports it.
|
||||
#missing = EnumeratedListOption(_("Replace missing\nplaces\\dates \
|
||||
# with"), 0)
|
||||
#missing.add_item( 0, _("Does not display anything"))
|
||||
#missing.add_item( 1, _("Displays '_____'"))
|
||||
#missing.add_item(0, _("Does not display anything"))
|
||||
#missing.add_item(1, _("Displays '_____'"))
|
||||
#missing.set_help(_("What will print when information is not known"))
|
||||
#menu.add_option(category_name, "miss_val", missing)
|
||||
|
||||
#category_name = _("Secondary")
|
||||
|
||||
dispMom = TextOption(_("Mother\nDisplay Format"),
|
||||
["$n",
|
||||
"%s $b" %_BORN,
|
||||
"%s $m" %_MARR,
|
||||
"-{%s $d}" %_DIED]
|
||||
)
|
||||
dispMom.set_help(_("Display format for the mothers box."))
|
||||
menu.add_option(category_name, "mother_disp", dispMom)
|
||||
disp_mom = TextOption(_("Mother\nDisplay Format"),
|
||||
["$n",
|
||||
"%s $b" %_BORN,
|
||||
"%s $m" %_MARR,
|
||||
"-{%s $d}" %_DIED])
|
||||
disp_mom.set_help(_("Display format for the mothers box."))
|
||||
menu.add_option(category_name, "mother_disp", disp_mom)
|
||||
|
||||
centerDisp = EnumeratedListOption(_("Center person uses\n"
|
||||
"which format"), 0)
|
||||
centerDisp.add_item(0, _("Use Fathers Display format"))
|
||||
centerDisp.add_item(1, _("Use Mothers display format"))
|
||||
centerDisp.set_help(_("Which Display format to use the center person"))
|
||||
menu.add_option(category_name, "center_uses", centerDisp)
|
||||
center_disp = EnumeratedListOption(_("Center person uses\n"
|
||||
"which format"), 0)
|
||||
center_disp.add_item(0, _("Use Fathers Display format"))
|
||||
center_disp.add_item(1, _("Use Mothers display format"))
|
||||
center_disp.set_help(_("Which Display format to use the center person"))
|
||||
menu.add_option(category_name, "center_uses", center_disp)
|
||||
|
||||
incmarr = BooleanOption(_('Include Marriage box'), False)
|
||||
incmarr.set_help(
|
||||
@ -895,27 +900,28 @@ class AncestorTreeOptions(MenuReportOptions):
|
||||
self.scale.connect('value-changed', self.__check_blank)
|
||||
|
||||
if "BKI" not in self.name.split(","):
|
||||
self.__onepage = BooleanOption(_("Resize Page to Fit Tree size\n"
|
||||
"\n"
|
||||
"Note: Overrides options in the 'Paper Option' tab"
|
||||
),
|
||||
self.__onepage = BooleanOption(
|
||||
_("Resize Page to Fit Tree size\n"
|
||||
"\n"
|
||||
"Note: Overrides options in the 'Paper Option' tab"
|
||||
),
|
||||
False)
|
||||
self.__onepage.set_help(
|
||||
_("Whether to resize the page to fit the size \n"
|
||||
"of the tree. Note: the page will have a \n"
|
||||
"non standard size.\n"
|
||||
"\n"
|
||||
"With this option selected, the following will happen:\n"
|
||||
"\n"
|
||||
"With the 'Do not scale tree' option the page\n"
|
||||
" is resized to the height/width of the tree\n"
|
||||
"\n"
|
||||
"With 'Scale tree to fit page width only' the height of\n"
|
||||
" the page is resized to the height of the tree\n"
|
||||
"\n"
|
||||
"With 'Scale tree to fit the size of the page' the page\n"
|
||||
" is resized to remove any gap in either height or width"
|
||||
))
|
||||
"of the tree. Note: the page will have a \n"
|
||||
"non standard size.\n"
|
||||
"\n"
|
||||
"With this option selected, the following will happen:\n"
|
||||
"\n"
|
||||
"With the 'Do not scale tree' option the page\n"
|
||||
" is resized to the height/width of the tree\n"
|
||||
"\n"
|
||||
"With 'Scale tree to fit page width only' the height of\n"
|
||||
" the page is resized to the height of the tree\n"
|
||||
"\n"
|
||||
"With 'Scale tree to fit the size of the page' the page\n"
|
||||
" is resized to remove any gap in either height or width"
|
||||
))
|
||||
menu.add_option(category_name, "resize_page", self.__onepage)
|
||||
self.__onepage.connect('value-changed', self.__check_blank)
|
||||
else:
|
||||
@ -923,7 +929,8 @@ class AncestorTreeOptions(MenuReportOptions):
|
||||
|
||||
self.box_Y_sf = NumberOption(_("inter-box scale factor"),
|
||||
1.00, 0.10, 2.00, 0.01)
|
||||
self.box_Y_sf.set_help(_("Make the inter-box spacing bigger or smaller"))
|
||||
self.box_Y_sf.set_help(
|
||||
_("Make the inter-box spacing bigger or smaller"))
|
||||
menu.add_option(category_name, "box_Yscale", self.box_Y_sf)
|
||||
|
||||
self.box_shadow_sf = NumberOption(_("box shadow scale factor"),
|
||||
@ -995,10 +1002,10 @@ class AncestorTreeOptions(MenuReportOptions):
|
||||
item_list.append([1, _("One Generation of empty boxes "
|
||||
"for unknown ancestors")])
|
||||
|
||||
item_list.extend([itr, str(itr) +
|
||||
_(" Generations of empty boxes for unknown ancestors")]
|
||||
for itr in range(2, max_gen)
|
||||
)
|
||||
item_list.extend(
|
||||
[itr, str(itr) +
|
||||
_(" Generations of empty boxes for unknown ancestors")]
|
||||
for itr in range(2, max_gen))
|
||||
|
||||
self.fillout.set_items(item_list)
|
||||
if old_val+2 > len(item_list):
|
||||
|
@ -88,7 +88,7 @@ class PersonBox(DescendantBoxBase):
|
||||
Calculates information about the box that will print on a page
|
||||
"""
|
||||
|
||||
def __init__(self, level, boldable = 0):
|
||||
def __init__(self, level, boldable=0):
|
||||
DescendantBoxBase.__init__(self, "CG2-box")
|
||||
self.level = level
|
||||
|
||||
@ -130,13 +130,13 @@ class PlaceHolderBox(BoxBase):
|
||||
#------------------------------------------------------------------------
|
||||
class DescendantTitleBase(TitleBox):
|
||||
def __init__(self, dbase, doc, locale, name_displayer,
|
||||
boxstr = "CG2-Title"):
|
||||
boxstr="CG2-Title"):
|
||||
self._nd = name_displayer
|
||||
TitleBox.__init__(self, doc, boxstr)
|
||||
self.database = dbase
|
||||
self._ = locale.translation.sgettext
|
||||
|
||||
def descendant_print(self, person_list, person_list2 = []):
|
||||
def descendant_print(self, person_list, person_list2=[]):
|
||||
""" calculate the Descendant title
|
||||
Person_list will always be passed
|
||||
If in the Family reports and there are two families, person_list2
|
||||
@ -176,8 +176,8 @@ class DescendantTitleBase(TitleBox):
|
||||
}
|
||||
else: # No person_list2: Just one family
|
||||
if len(names) == 1:
|
||||
title = self._("Descendant Chart for %(person)s") % {
|
||||
'person': names[0]}
|
||||
title = self._(
|
||||
"Descendant Chart for %(person)s") % {'person': names[0]}
|
||||
else: # Should be two items in names list
|
||||
title = self._("Descendant Chart for %(father)s and "
|
||||
"%(mother)s") % {
|
||||
@ -194,7 +194,7 @@ class DescendantTitleBase(TitleBox):
|
||||
mother_h = family1.get_mother_handle()
|
||||
|
||||
parents = [self.database.get_person_from_handle(handle)
|
||||
for handle in [father_h, mother_h] if handle]
|
||||
for handle in [father_h, mother_h] if handle]
|
||||
|
||||
return parents
|
||||
|
||||
@ -230,7 +230,7 @@ class TitleDPY(DescendantTitleBase):
|
||||
father2_h = family2.get_father_handle()
|
||||
mother2_h = family2.get_mother_handle()
|
||||
person_list = [self.database.get_person_from_handle(handle)
|
||||
for handle in [father2_h, mother2_h] if handle]
|
||||
for handle in [father2_h, mother2_h] if handle]
|
||||
|
||||
if not person_list:
|
||||
person_list = [center]
|
||||
@ -273,7 +273,7 @@ class TitleDFY(DescendantTitleBase):
|
||||
father_h = family.get_father_handle()
|
||||
mother_h = family.get_mother_handle()
|
||||
parent_list = [self.database.get_person_from_handle(handle)
|
||||
for handle in [father_h, mother_h] if handle]
|
||||
for handle in [father_h, mother_h] if handle]
|
||||
|
||||
return parent_list or [person]
|
||||
|
||||
@ -304,8 +304,7 @@ class TitleDFN(DescendantTitleBase):
|
||||
def calc_title(self, family_id):
|
||||
"""Calculate the title of the report"""
|
||||
|
||||
self.text = self.descendant_print(
|
||||
self.get_parents(family_id) )
|
||||
self.text = self.descendant_print(self.get_parents(family_id))
|
||||
self.set_box_height_width()
|
||||
|
||||
class TitleF(DescendantTitleBase):
|
||||
@ -321,11 +320,12 @@ class TitleF(DescendantTitleBase):
|
||||
names = self._get_names(parents, self._nd)
|
||||
|
||||
if len(parents) == 1:
|
||||
title = self._("Family Chart for %(person)s") % {
|
||||
'person': names[0] }
|
||||
title = self._(
|
||||
"Family Chart for %(person)s") % {'person': names[0]}
|
||||
elif len(parents) == 2:
|
||||
title = self._("Family Chart for %(father1)s and %(mother1)s") % {
|
||||
'father1': names[0], 'mother1': names[1] }
|
||||
title = self._(
|
||||
"Family Chart for %(father1)s and %(mother1)s") % {
|
||||
'father1': names[0], 'mother1': names[1]}
|
||||
#else:
|
||||
# title = str(tmp) + " " + str(len(tmp))
|
||||
self.text = title
|
||||
@ -349,8 +349,8 @@ class TitleC(DescendantTitleBase):
|
||||
# translators: needed for Arabic, ignore otherwise
|
||||
cousin_names = self._(', ').join(self._get_names(kids, self._nd))
|
||||
|
||||
self.text = self._("Cousin Chart for %(names)s") % {
|
||||
'names' : cousin_names}
|
||||
self.text = self._(
|
||||
"Cousin Chart for %(names)s") % {'names' : cousin_names}
|
||||
|
||||
self.set_box_height_width()
|
||||
|
||||
@ -424,7 +424,8 @@ class RecurseDown:
|
||||
|
||||
if box.level[1] == 0 and self.__last_direct[level]:
|
||||
#ok, a new direct descendant.
|
||||
#print level, box.father is not None, self.__last_direct[level].father is not None, box.text[0], \
|
||||
#print level, box.father is not None, \
|
||||
# self.__last_direct[level].father is not None, box.text[0], \
|
||||
# self.__last_direct[level].text[0]
|
||||
if box.father != self.__last_direct[level].father and \
|
||||
box.father != self.__last_direct[level]:
|
||||
@ -466,7 +467,7 @@ class RecurseDown:
|
||||
myself.calc_text(self.database, indi_handle, fams_handle)
|
||||
|
||||
myself.add_mark(self.database,
|
||||
self.database.get_person_from_handle(indi_handle))
|
||||
self.database.get_person_from_handle(indi_handle))
|
||||
|
||||
self.add_to_col(myself)
|
||||
|
||||
@ -496,18 +497,22 @@ class RecurseDown:
|
||||
or we reach the max number of spouses
|
||||
that we want to deal with"""
|
||||
|
||||
if not person_handle: return
|
||||
if x_level > self.max_generations: return
|
||||
if s_level > 0 and s_level == self.max_spouses: return
|
||||
if person_handle in self.families_seen: return
|
||||
if not person_handle:
|
||||
return
|
||||
if x_level > self.max_generations:
|
||||
return
|
||||
if s_level > 0 and s_level == self.max_spouses:
|
||||
return
|
||||
if person_handle in self.families_seen:
|
||||
return
|
||||
|
||||
myself = None
|
||||
person = self.database.get_person_from_handle(person_handle)
|
||||
family_handles = person.get_family_handle_list()
|
||||
if s_level == 0:
|
||||
val = family_handles[0] if family_handles else None
|
||||
myself = self.add_person_box( (x_level, s_level),
|
||||
person_handle, val, father)
|
||||
myself = self.add_person_box((x_level, s_level),
|
||||
person_handle, val, father)
|
||||
|
||||
marr = None
|
||||
spouse = None
|
||||
@ -525,8 +530,8 @@ class RecurseDown:
|
||||
#Marriage box if the option is there.
|
||||
if self.inlc_marr and self.max_spouses > 0:
|
||||
marr = self.add_marriage_box((x_level, s_level+1),
|
||||
person_handle, family_handle,
|
||||
father if s_level else myself)
|
||||
person_handle, family_handle,
|
||||
father if s_level else myself)
|
||||
|
||||
spouse_handle = ReportUtils.find_spouse(person, family)
|
||||
if (self.max_spouses > s_level and
|
||||
@ -534,7 +539,8 @@ class RecurseDown:
|
||||
spouse_handle not in self.families_seen):
|
||||
def _spouse_box(who):
|
||||
return self.add_person_box((x_level, s_level+1),
|
||||
spouse_handle, family_handle, who)
|
||||
spouse_handle,
|
||||
family_handle, who)
|
||||
if s_level > 0:
|
||||
spouse = _spouse_box(father)
|
||||
elif self.inlc_marr:
|
||||
@ -709,7 +715,7 @@ class MakePersonTree(RecurseDown):
|
||||
#######################
|
||||
#now it will ONLY be my fathers parents
|
||||
if family2:
|
||||
self.add_family( 0, family2, None )
|
||||
self.add_family(0, family2, None)
|
||||
else:
|
||||
self.bold_now = 2
|
||||
self.recurse(center1_h, 0, 0, None)
|
||||
@ -818,7 +824,7 @@ class MakeFamilyTree(RecurseDown):
|
||||
if not show:
|
||||
self.families_seen.add(father1_h)
|
||||
|
||||
family2_l = self.add_family( 0, family2, None )
|
||||
family2_l = self.add_family(0, family2, None)
|
||||
|
||||
elif father1:
|
||||
#######################
|
||||
@ -879,7 +885,7 @@ class MakeFamilyTree(RecurseDown):
|
||||
|
||||
#######################
|
||||
#don't do my parents family.
|
||||
self.families_seen = set([family1_h] )
|
||||
self.families_seen = set([family1_h])
|
||||
##If mom has no other children from other marriages. remove her
|
||||
if self.max_spouses == 0 and not self.has_children(mother1_h):
|
||||
self.families_seen.add(mother1_h)
|
||||
@ -897,13 +903,13 @@ class MakeFamilyTree(RecurseDown):
|
||||
#if my mother does not have parents (she is the highest)
|
||||
#Then do her OTHER spouses.
|
||||
if not family2 and mother1:
|
||||
self.recurse_if(mother1_h, 1)
|
||||
self.recurse_if(mother1_h, 1)
|
||||
|
||||
#######################
|
||||
#my mothers parents!
|
||||
#######################
|
||||
if family2:
|
||||
family2_l = self.add_family( 0, family2, None )
|
||||
family2_l = self.add_family(0, family2, None)
|
||||
family2_line = family2_l[1] if self.inlc_marr else family2_l[0]
|
||||
|
||||
family2_line = family2_line.line_to
|
||||
@ -922,14 +928,14 @@ class MakeFamilyTree(RecurseDown):
|
||||
#######################
|
||||
#update to only run if she HAD other husbands!
|
||||
if mother2_h:
|
||||
self.recurse_if(mother2_h, 0)
|
||||
self.recurse_if(mother2_h, 0)
|
||||
|
||||
#######################
|
||||
#mother Fathers OTHER wives
|
||||
#######################
|
||||
#update to only run if he HAD other wives!
|
||||
if father2_h:
|
||||
self.recurse_if(father2_h, 0)
|
||||
self.recurse_if(father2_h, 0)
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -1102,7 +1108,7 @@ class MakeReport:
|
||||
|
||||
for left_group, right_group in self.__reverse_family_group():
|
||||
right_y_cm, left_y_cm = self.__calc_movements(left_group,
|
||||
right_group)
|
||||
right_group)
|
||||
|
||||
#1. Are my children too high? if so move then down!
|
||||
if right_y_cm < left_y_cm:
|
||||
@ -1116,7 +1122,7 @@ class MakeReport:
|
||||
elif left_y_cm < right_y_cm:
|
||||
#Ok, I am too high. Move me down
|
||||
amt = (right_y_cm - left_y_cm)
|
||||
self.__move_col_from_here_down(left_group[0], amt)
|
||||
self.__move_col_from_here_down(left_group[0], amt)
|
||||
|
||||
#6. now check to see if we are working with dad and mom.
|
||||
#if so we need to move down marriage information
|
||||
@ -1130,7 +1136,7 @@ class MakeReport:
|
||||
#only do Dad and Mom. len(left_line) > 1
|
||||
seen_parents = True
|
||||
|
||||
mom_cm = left_group[-1].y_cm + left_group[-1].height/2
|
||||
mom_cm = left_group[-1].y_cm + left_group[-1].height/2
|
||||
last_child_cm = right_group[-1].y_cm
|
||||
if not self.compress_tree:
|
||||
last_child_cm += right_group[-1].height/2
|
||||
@ -1173,8 +1179,8 @@ class MakeReport:
|
||||
box.width = width - box.x_cm
|
||||
box.x_cm += self.canvas.report_opts.littleoffset
|
||||
box.x_cm += (box.level[0] *
|
||||
(self.canvas.report_opts.col_width +
|
||||
self.canvas.report_opts.max_box_width))
|
||||
(self.canvas.report_opts.col_width +
|
||||
self.canvas.report_opts.max_box_width))
|
||||
|
||||
box.y_cm += self.canvas.report_opts.littleoffset
|
||||
box.y_cm += self.canvas.title.height
|
||||
@ -1307,7 +1313,7 @@ class DescendTree(Report):
|
||||
|
||||
#The canvas that we will put our report on and print off of
|
||||
self.canvas = Canvas(self.doc,
|
||||
ReportOptions(self.doc, font_normal, "CG2-line"))
|
||||
ReportOptions(self.doc, font_normal, "CG2-line"))
|
||||
|
||||
self.canvas.report_opts.box_shadow *= \
|
||||
self.Connect.get_val('shadowscale')
|
||||
@ -1533,7 +1539,7 @@ class DescendTreeOptions(MenuReportOptions):
|
||||
|
||||
compresst = BooleanOption(_('Compress tree'), False)
|
||||
compresst.set_help(_("Whether to move people up, where possible, "
|
||||
"resulting in a smaller tree"))
|
||||
"resulting in a smaller tree"))
|
||||
menu.add_option(category_name, "compress_tree", compresst)
|
||||
|
||||
stdoptions.add_localization_option(menu, category_name)
|
||||
@ -1542,9 +1548,9 @@ class DescendTreeOptions(MenuReportOptions):
|
||||
category_name = _("Display")
|
||||
|
||||
disp = TextOption(_("Descendant\nDisplay Format"),
|
||||
["$n",
|
||||
"%s $b" %_BORN,
|
||||
"-{%s $d}" %_DIED])
|
||||
["$n",
|
||||
"%s $b" %_BORN,
|
||||
"-{%s $d}" %_DIED])
|
||||
disp.set_help(_("Display format for a descendant."))
|
||||
menu.add_option(category_name, "descend_disp", disp)
|
||||
|
||||
@ -1595,9 +1601,9 @@ class DescendTreeOptions(MenuReportOptions):
|
||||
category_name = _("Size")
|
||||
|
||||
self.scale = EnumeratedListOption(_("Scale tree to fit"), 0)
|
||||
self.scale.add_item( 0, _("Do not scale tree"))
|
||||
self.scale.add_item( 1, _("Scale tree to fit page width only"))
|
||||
self.scale.add_item( 2, _("Scale tree to fit the size of the page"))
|
||||
self.scale.add_item(0, _("Do not scale tree"))
|
||||
self.scale.add_item(1, _("Scale tree to fit page width only"))
|
||||
self.scale.add_item(2, _("Scale tree to fit the size of the page"))
|
||||
self.scale.set_help(
|
||||
_("Whether to scale the tree to fit a specific paper size")
|
||||
)
|
||||
@ -1605,27 +1611,28 @@ class DescendTreeOptions(MenuReportOptions):
|
||||
self.scale.connect('value-changed', self.__check_blank)
|
||||
|
||||
if "BKI" not in self.name.split(","):
|
||||
self.__onepage = BooleanOption(_("Resize Page to Fit Tree size\n"
|
||||
"\n"
|
||||
"Note: Overrides options in the 'Paper Option' tab"
|
||||
),
|
||||
self.__onepage = BooleanOption(
|
||||
_("Resize Page to Fit Tree size\n"
|
||||
"\n"
|
||||
"Note: Overrides options in the 'Paper Option' tab"
|
||||
),
|
||||
False)
|
||||
self.__onepage.set_help(
|
||||
_("Whether to resize the page to fit the size \n"
|
||||
"of the tree. Note: the page will have a \n"
|
||||
"non standard size.\n"
|
||||
"\n"
|
||||
"With this option selected, the following will happen:\n"
|
||||
"\n"
|
||||
"With the 'Do not scale tree' option the page\n"
|
||||
" is resized to the height/width of the tree\n"
|
||||
"\n"
|
||||
"With 'Scale tree to fit page width only' the height of\n"
|
||||
" the page is resized to the height of the tree\n"
|
||||
"\n"
|
||||
"With 'Scale tree to fit the size of the page' the page\n"
|
||||
" is resized to remove any gap in either height or width"
|
||||
))
|
||||
"of the tree. Note: the page will have a \n"
|
||||
"non standard size.\n"
|
||||
"\n"
|
||||
"With this option selected, the following will happen:\n"
|
||||
"\n"
|
||||
"With the 'Do not scale tree' option the page\n"
|
||||
" is resized to the height/width of the tree\n"
|
||||
"\n"
|
||||
"With 'Scale tree to fit page width only' the height of\n"
|
||||
" the page is resized to the height of the tree\n"
|
||||
"\n"
|
||||
"With 'Scale tree to fit the size of the page' the page\n"
|
||||
" is resized to remove any gap in either height or width"
|
||||
))
|
||||
menu.add_option(category_name, "resize_page", self.__onepage)
|
||||
self.__onepage.connect('value-changed', self.__check_blank)
|
||||
else:
|
||||
@ -1646,8 +1653,8 @@ class DescendTreeOptions(MenuReportOptions):
|
||||
category_name = _("Include")
|
||||
|
||||
self.title = EnumeratedListOption(_("Report Title"), 0)
|
||||
self.title.add_item( 0, _("Do not include a title"))
|
||||
self.title.add_item( 1, _("Descendant Chart for [selected person(s)]"))
|
||||
self.title.add_item(0, _("Do not include a title"))
|
||||
self.title.add_item(1, _("Descendant Chart for [selected person(s)]"))
|
||||
if self.name.split(",")[0] != _RPT_NAME:
|
||||
self.title.add_item(2,
|
||||
_("Family Chart for [names of chosen family]"))
|
||||
@ -1678,7 +1685,7 @@ class DescendTreeOptions(MenuReportOptions):
|
||||
)
|
||||
menu.add_option(category_name, "inc_note", self.usenote)
|
||||
|
||||
self.notedisp = TextOption(_("Note"),[])
|
||||
self.notedisp = TextOption(_("Note"), [])
|
||||
self.notedisp.set_help(_("Add a note"
|
||||
"\n\n$T inserts today's date"))
|
||||
menu.add_option(category_name, "note_disp", self.notedisp)
|
||||
@ -1686,7 +1693,7 @@ class DescendTreeOptions(MenuReportOptions):
|
||||
locals = NoteType(0)
|
||||
notelocal = EnumeratedListOption(_("Note Location"), 2)
|
||||
for num, text in locals.note_locals():
|
||||
notelocal.add_item( num, text )
|
||||
notelocal.add_item(num, text)
|
||||
notelocal.set_help(_("Where to place the note."))
|
||||
menu.add_option(category_name, "note_place", notelocal)
|
||||
|
||||
@ -1697,20 +1704,20 @@ class DescendTreeOptions(MenuReportOptions):
|
||||
else:
|
||||
value = True
|
||||
off = value and (self.scale.get_value() != 2)
|
||||
self.__blank.set_available( off )
|
||||
self.__blank.set_available(off)
|
||||
|
||||
def __Title_enum(self):
|
||||
item_list = [
|
||||
[0, _("Do not include a title") ],
|
||||
[1, _("Descendant Chart for [selected person(s)]") ],
|
||||
[0, _("Do not include a title")],
|
||||
[1, _("Descendant Chart for [selected person(s)]")],
|
||||
]
|
||||
if self.name.split(",")[0] != _RPT_NAME:
|
||||
item_list.append(
|
||||
[2, _("Family Chart for [names of chosen family]") ]
|
||||
[2, _("Family Chart for [names of chosen family]")]
|
||||
)
|
||||
if self.showparents.get_value():
|
||||
item_list.append(
|
||||
[3, _("Cousin Chart for [names of children]") ]
|
||||
[3, _("Cousin Chart for [names of children]")]
|
||||
)
|
||||
self.title.set_items(item_list)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user