Clean up AncestorTree report.

svn: r11796
This commit is contained in:
Brian Matherly
2009-02-02 12:50:24 +00:00
parent 9bc8d68251
commit efd64ad139

View File

@@ -41,8 +41,8 @@ from gen.plug import PluginManager
from gen.plug.menu import BooleanOption, NumberOption, TextOption, PersonOption from gen.plug.menu import BooleanOption, NumberOption, TextOption, PersonOption
from ReportBase import Report, ReportUtils, CATEGORY_DRAW, MenuReportOptions from ReportBase import Report, ReportUtils, CATEGORY_DRAW, MenuReportOptions
from BasicUtils import name_displayer from BasicUtils import name_displayer
pt2cm = ReportUtils.pt2cm pt2cm = ReportUtils.pt2cm
cm2pt = ReportUtils.cm2pt
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@@ -58,6 +58,9 @@ _DIED = _('short for died|d.')
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
def log2(val): def log2(val):
"""
Calculate the log base 2 of a value.
"""
return int(math.log10(val)/math.log10(2)) return int(math.log10(val)/math.log10(2))
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@@ -137,7 +140,7 @@ class GenChart:
x = 0 x = 0
for entry in i: for entry in i:
new_map[entry] = (new_y, x) new_map[entry] = (new_y, x)
x =+ 1 x += 1
new_y += 1 new_y += 1
self.array = new_array self.array = new_array
self.map = new_map self.map = new_map
@@ -332,7 +335,8 @@ class AncestorTree(Report):
self.delta = pt2cm(self.box_pad_pts) + self.box_width + 0.2 self.delta = pt2cm(self.box_pad_pts) + self.box_width + 0.2
if not self.force_fit: if not self.force_fit:
calc_width = self.box_width + 0.2 + pt2cm(self.box_pad_pts) calc_width = self.box_width + 0.2 + pt2cm(self.box_pad_pts)
remain = self.doc.get_usable_width() - ((self.generations_per_page)*calc_width) remain = self.doc.get_usable_width() - \
((self.generations_per_page)*calc_width)
self.delta += remain / (self.generations_per_page) self.delta += remain / (self.generations_per_page)
def scale_styles(self): def scale_styles(self):
@@ -363,12 +367,15 @@ class AncestorTree(Report):
if self.genchart.get_xy(x, y) != 0: if self.genchart.get_xy(x, y) != 0:
blank = False blank = False
break break
if not blank: break if not blank:
if blank: return break
if blank:
return
self.doc.start_page() self.doc.start_page()
if self.title and self.force_fit: if self.title and self.force_fit:
self.doc.center_text('AC2-title',self.title,self.doc.get_usable_width()/2,0) self.doc.center_text('AC2-title', self.title,
self.doc.get_usable_width() / 2, 0)
phys_y = 0 phys_y = 0
for y in range(starty, stopy): for y in range(starty, stopy):
phys_x = 0 phys_x = 0