Calculate row heights and column widths; position cells accordingly.
(self)
| 464 | return Bbox.union(boxes) |
| 465 | |
| 466 | def _do_cell_alignment(self): |
| 467 | """ |
| 468 | Calculate row heights and column widths; position cells accordingly. |
| 469 | """ |
| 470 | # Calculate row/column widths |
| 471 | widths = {} |
| 472 | heights = {} |
| 473 | for (row, col), cell in self._cells.items(): |
| 474 | height = heights.setdefault(row, 0.0) |
| 475 | heights[row] = max(height, cell.get_height()) |
| 476 | width = widths.setdefault(col, 0.0) |
| 477 | widths[col] = max(width, cell.get_width()) |
| 478 | |
| 479 | # work out left position for each column |
| 480 | xpos = 0 |
| 481 | lefts = {} |
| 482 | for col in sorted(widths): |
| 483 | lefts[col] = xpos |
| 484 | xpos += widths[col] |
| 485 | |
| 486 | ypos = 0 |
| 487 | bottoms = {} |
| 488 | for row in sorted(heights, reverse=True): |
| 489 | bottoms[row] = ypos |
| 490 | ypos += heights[row] |
| 491 | |
| 492 | # set cell positions |
| 493 | for (row, col), cell in self._cells.items(): |
| 494 | cell.set_x(lefts[col]) |
| 495 | cell.set_y(bottoms[row]) |
| 496 | |
| 497 | def auto_set_column_width(self, col): |
| 498 | """ |
no test coverage detected