Calculate row heights and column widths. Position cells accordingly.
(self)
| 388 | return Bbox.union(boxes) |
| 389 | |
| 390 | def _do_cell_alignment(self): |
| 391 | """ Calculate row heights and column widths. |
| 392 | |
| 393 | Position cells accordingly. |
| 394 | """ |
| 395 | # Calculate row/column widths |
| 396 | widths = {} |
| 397 | heights = {} |
| 398 | for (row, col), cell in self._cells.items(): |
| 399 | height = heights.setdefault(row, 0.0) |
| 400 | heights[row] = max(height, cell.get_height()) |
| 401 | width = widths.setdefault(col, 0.0) |
| 402 | widths[col] = max(width, cell.get_width()) |
| 403 | |
| 404 | # work out left position for each column |
| 405 | xpos = 0 |
| 406 | lefts = {} |
| 407 | for col in sorted(widths): |
| 408 | lefts[col] = xpos |
| 409 | xpos += widths[col] |
| 410 | |
| 411 | ypos = 0 |
| 412 | bottoms = {} |
| 413 | for row in sorted(heights, reverse=True): |
| 414 | bottoms[row] = ypos |
| 415 | ypos += heights[row] |
| 416 | |
| 417 | # set cell positions |
| 418 | for (row, col), cell in self._cells.items(): |
| 419 | cell.set_x(lefts[col]) |
| 420 | cell.set_y(bottoms[row]) |
| 421 | |
| 422 | def auto_set_column_width(self, col): |
| 423 | """ Given column indexs in either List, Tuple or int. Will be able to |
no test coverage detected