Some pylint cleanups
This commit is contained in:
@@ -42,7 +42,6 @@ from gramps.gen.plug.menu import (TextOption, NumberOption, BooleanOption,
|
||||
EnumeratedListOption, StringOption,
|
||||
PersonOption)
|
||||
from gramps.gen.plug.report import Report, MenuReportOptions, stdoptions
|
||||
from gramps.gen.plug.report import utils
|
||||
from gramps.gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
|
||||
FONT_SANS_SERIF, PARA_ALIGN_CENTER)
|
||||
from gramps.plugins.lib.libtreebase import *
|
||||
@@ -64,6 +63,7 @@ _MARR = _("marriage abbreviation|m."),
|
||||
|
||||
LVL_GEN, LVL_INDX, LVL_Y = range(3)
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Box classes
|
||||
@@ -82,6 +82,7 @@ class PersonBox(BoxBase):
|
||||
def __lt__(self, other):
|
||||
return self.level[LVL_Y] < other.level[LVL_Y]
|
||||
|
||||
|
||||
class FamilyBox(BoxBase):
|
||||
"""
|
||||
Calculates information about the box that will print on a page
|
||||
@@ -114,6 +115,7 @@ class TitleN(TitleNoDisplay):
|
||||
self.mark_text = self._("Ancestor Graph")
|
||||
self.text = ''
|
||||
|
||||
|
||||
class TitleA(TitleBox):
|
||||
"""Title class for the report """
|
||||
def __init__(self, doc, locale, name_displayer):
|
||||
@@ -172,31 +174,32 @@ class CalcItems:
|
||||
def calc_person(self, index, indi_handle, fams_handle):
|
||||
working_lines = ""
|
||||
if index[1] % 2 == 0 or (index[1] == 1 and self.center_use == 0):
|
||||
if indi_handle == fams_handle == None:
|
||||
if indi_handle == fams_handle is None:
|
||||
working_lines = self.__calc_l.calc_lines(
|
||||
None, None, self._gui.get_val("father_disp"))
|
||||
else:
|
||||
working_lines = self.disp_father
|
||||
else:
|
||||
if indi_handle == fams_handle == None:
|
||||
if indi_handle == fams_handle is None:
|
||||
working_lines = self.__calc_l.calc_lines(
|
||||
None, None, self._gui.get_val("mother_disp"))
|
||||
else:
|
||||
working_lines = self.disp_mother
|
||||
|
||||
if indi_handle == fams_handle == None:
|
||||
if indi_handle == fams_handle is None:
|
||||
return working_lines
|
||||
else:
|
||||
return self.__calc_l.calc_lines(indi_handle, fams_handle,
|
||||
working_lines)
|
||||
|
||||
def calc_marriage(self, indi_handle, fams_handle):
|
||||
if indi_handle == fams_handle == None:
|
||||
if indi_handle == fams_handle is None:
|
||||
return self.__blank_marriage
|
||||
else:
|
||||
return self.__calc_l.calc_lines(indi_handle, fams_handle,
|
||||
self.disp_marr)
|
||||
|
||||
|
||||
class MakeAncestorTree(AscendPerson):
|
||||
"""
|
||||
The main procedure to use recursion to make the tree based off of a person.
|
||||
@@ -344,7 +347,6 @@ class MakeAncestorTree(AscendPerson):
|
||||
box.level = (box.level[0], box.level[1], box.level[2] - move)
|
||||
move = 0
|
||||
|
||||
|
||||
line.start = []
|
||||
rrr = -1 # if len(mykids)%2 == 1 else 0
|
||||
for kid in mykids:
|
||||
@@ -387,7 +389,8 @@ class LRTransform:
|
||||
def __init__(self, canvas, max_generations):
|
||||
self.canvas = canvas
|
||||
self.rept_opts = canvas.report_opts
|
||||
self.y_offset = self.rept_opts.littleoffset*2 + self.canvas.title.height
|
||||
self.y_offset = (self.rept_opts.littleoffset * 2 +
|
||||
self.canvas.title.height)
|
||||
|
||||
def _place(self, box):
|
||||
""" put the box in it's correct spot """
|
||||
@@ -410,6 +413,7 @@ class LRTransform:
|
||||
for box in self.canvas.boxes:
|
||||
self._place(box)
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# class make_report
|
||||
@@ -456,7 +460,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
|
||||
@@ -492,6 +496,7 @@ class GUIConnect:
|
||||
"""
|
||||
|
||||
__shared_state = {}
|
||||
|
||||
def __init__(self): # We are BORG!
|
||||
self.__dict__ = self.__shared_state
|
||||
|
||||
@@ -533,6 +538,7 @@ class GUIConnect:
|
||||
def compress_tree(self):
|
||||
return self.get_val("compress_tree")
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# AncestorTree
|
||||
@@ -608,7 +614,7 @@ class AncestorTree(Report):
|
||||
_('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'))
|
||||
@@ -670,7 +676,8 @@ 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 +
|
||||
colsperpage = int(
|
||||
colsperpage / (self.canvas.report_opts.max_box_width +
|
||||
self.canvas.report_opts.col_width))
|
||||
colsperpage = colsperpage or 1
|
||||
|
||||
@@ -761,6 +768,7 @@ class AncestorTree(Report):
|
||||
|
||||
self.doc.set_style_sheet(style_sheet)
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# AncestorTreeOptions
|
||||
@@ -853,8 +861,7 @@ class AncestorTreeOptions(MenuReportOptions):
|
||||
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")
|
||||
)
|
||||
_("Whether to scale the tree to fit a specific paper size"))
|
||||
menu.add_option(category_name, "scale_tree", self.scale)
|
||||
self.scale.connect('value-changed', self.__check_blank)
|
||||
|
||||
@@ -964,7 +971,8 @@ class AncestorTreeOptions(MenuReportOptions):
|
||||
# _('Include thumbnail images of people'), False)
|
||||
# self.__include_images.set_help(
|
||||
# _("Whether to include thumbnails of people."))
|
||||
# menu.add_option(category_name, "includeImages", self.__include_images)
|
||||
# menu.add_option(category_name, "includeImages",
|
||||
# self.__include_images)
|
||||
|
||||
self.usenote = BooleanOption(_('Include a note'), False)
|
||||
self.usenote.set_help(_("Whether to include a note on the report."))
|
||||
@@ -1039,7 +1047,7 @@ class AncestorTreeOptions(MenuReportOptions):
|
||||
def make_default_style(self, default_style):
|
||||
"""Make the default output style for the Ancestor Tree."""
|
||||
|
||||
## Paragraph Styles:
|
||||
# Paragraph Styles:
|
||||
font = FontStyle()
|
||||
font.set_size(9)
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
@@ -1068,7 +1076,7 @@ class AncestorTreeOptions(MenuReportOptions):
|
||||
para_style.set_description(_('The style used for the title.'))
|
||||
default_style.add_paragraph_style("AC2-Title", para_style)
|
||||
|
||||
## Draw styles
|
||||
# Draw styles
|
||||
graph_style = GraphicsStyle()
|
||||
graph_style.set_paragraph_style("AC2-Normal")
|
||||
graph_style.set_shadow(1, box_shadow) # shadow set by text size
|
||||
|
@@ -22,7 +22,6 @@
|
||||
"""
|
||||
|
||||
from gramps.gen.plug.report import utils
|
||||
from gramps.gen.lib import ChildRefType
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@@ -56,6 +55,7 @@ class _PersonSeen:
|
||||
if person_handle is not None:
|
||||
self.people_seen.add(person_handle)
|
||||
|
||||
|
||||
class _FamilySeen:
|
||||
""" librecurse base boject only
|
||||
Keep track of the famalies that have been seen so we can call the correct
|
||||
@@ -80,6 +80,7 @@ class _FamilySeen:
|
||||
self.add_marriage(level, person_handle, family_handle)
|
||||
self.families_seen.add(family_handle)
|
||||
|
||||
|
||||
class _StopRecurse:
|
||||
""" A simple class to break out the
|
||||
. stop_recursion
|
||||
@@ -101,7 +102,7 @@ class _StopRecurse:
|
||||
|
||||
def can_recurse(self):
|
||||
""" Has the upper class told up to stop or can we continue? """
|
||||
return self.__stop_recursion == False
|
||||
return not self.__stop_recursion
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@@ -478,14 +479,14 @@ class AscendPerson(_StopRecurse, _PersonSeen):
|
||||
person = self.database.get_person_from_handle(person_handle)
|
||||
|
||||
# we have a valid person, add him/her
|
||||
self._add_person((generation, index), person_handle, full_family_handle)
|
||||
self._add_person((generation, index), person_handle,
|
||||
full_family_handle)
|
||||
|
||||
# has the user canceled recursion?
|
||||
if not self.can_recurse():
|
||||
self.continue_recursion()
|
||||
return
|
||||
|
||||
|
||||
# Now recurse on the parents
|
||||
family_handle = person.get_main_parents_family_handle()
|
||||
|
||||
@@ -498,21 +499,26 @@ class AscendPerson(_StopRecurse, _PersonSeen):
|
||||
mother_handle = None
|
||||
|
||||
# Recursively call the function. It is okay if the handle is None,
|
||||
self.__iterate(generation+1, index*2, father_handle, family_handle) #recurse on dad
|
||||
self.__iterate(generation + 1, index * 2, father_handle,
|
||||
family_handle) # recurse on dad
|
||||
if generation < self.max_generations:
|
||||
if father_handle is not None: # Stil winin max_generations
|
||||
self.add_marriage((generation+1, index*2), father_handle, family_handle)
|
||||
self.add_marriage((generation + 1, index * 2), father_handle,
|
||||
family_handle)
|
||||
elif mother_handle is not None:
|
||||
self.add_marriage((generation+1, index*2), mother_handle, family_handle)
|
||||
self.add_marriage((generation + 1, index * 2), mother_handle,
|
||||
family_handle)
|
||||
elif family_handle is not None:
|
||||
self.add_marriage((generation+1, index*2), None, family_handle)
|
||||
self.add_marriage((generation + 1, index * 2), None,
|
||||
family_handle)
|
||||
elif self.fill_out > 0:
|
||||
self.add_marriage((generation + 1, index * 2), None, None)
|
||||
|
||||
if not self.can_recurse():
|
||||
self.continue_recursion()
|
||||
return
|
||||
self.__iterate(generation+1, (index*2)+1, mother_handle, family_handle) #recurse mom
|
||||
self.__iterate(generation + 1, (index * 2) + 1, mother_handle,
|
||||
family_handle) # recurse mom
|
||||
|
||||
def recurse(self, person_handle):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user