parogers / pgu

Automatically exported from code.google.com/p/pgu
GNU Lesser General Public License v2.1
89 stars 37 forks source link

Table rowsize calculation is wrong #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It looks like it doesn't spread out extra vertical space correctly if the 
height has not been reached. The simplest fix is to remove the "/ 
len(rowsizes)" on table.py:248, but here's a few lines which also clarify 
variables and use floats for better accuracy (I think).

        w, h = sum(columnsizes), sum(rowsizes)
        if w > 0 and w < self.style.width and len(columnsizes):
            extra = self.style.width - w 
            for n in xrange(0, len(columnsizes)):
                percent_width = float(columnsizes[n]) / w
                columnsizes[n] += int(percent_width * extra)
        if h > 0 and h < self.style.height and len(rowsizes):
            extra = self.style.height - h
            for n in xrange(0, len(rowsizes)):
                percent_height = float(rowsizes[n]) / h
                rowsizes[n] += int(percent_height * extra)

Original issue reported on code.google.com by dbenamy on 6 Dec 2010 at 8:37

GoogleCodeExporter commented 9 years ago
Thanks for finding this. I've made the changes to the repository version (new 
release forthcoming).

Original comment by peter.ro...@gmail.com on 2 Jan 2011 at 10:53