From 6bc2303307a24ac1ad53eedde461dedb25ec157c Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 6 Jul 2018 14:20:49 +0200 Subject: Allowing for custom positioning of match boxes --- jfr_playoff/generator.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'jfr_playoff') diff --git a/jfr_playoff/generator.py b/jfr_playoff/generator.py index ef83a73..12a4365 100644 --- a/jfr_playoff/generator.py +++ b/jfr_playoff/generator.py @@ -200,8 +200,17 @@ class PlayoffGenerator(object): int(row_no * match_height + 0.5 * (match_height - self.page['height'])) PlayoffLogger.get('generator').info( - 'grid box (%d, %d) position: (%d, %d)', + 'calculated grid box (%d, %d) position: (%d, %d)', col_no, row_no, grid_x, grid_y) + if 'box_positioning' in self.canvas \ + and str(match) in self.canvas['box_positioning']: + if isinstance(self.canvas['box_positioning'][str(match)], list): + grid_x, grid_y = self.canvas['box_positioning'][str(match)][0:2] + else: + grid_y = float(self.canvas['box_positioning'][str(match)]) + PlayoffLogger.get('generator').info( + 'overridden box #%d position: (%d, %d)', + match, grid_x, grid_y) grid_boxes += self.get_match_box( matches[match] if match is not None else None, (grid_x, grid_y)) @@ -227,7 +236,7 @@ class PlayoffGenerator(object): canvas_size[0], canvas_size[1], ' '.join(['data-%s="%s"' % ( setting.replace('_', '-'), str(value) - ) for setting, value in self.canvas.iteritems()]), + ) for setting, value in self.canvas.iteritems() if not isinstance(value, dict)]), self.get_starting_position_box(starting_positions, canvas_size), grid_boxes, self.get_finishing_position_box( -- cgit v1.2.3