summaryrefslogtreecommitdiff
path: root/jfr_playoff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-07-06 14:20:49 +0200
committeremkael <emkael@tlen.pl>2018-07-06 14:20:49 +0200
commit6bc2303307a24ac1ad53eedde461dedb25ec157c (patch)
treeb00c3d0aa601595e6e953c166fc27022771fb6f2 /jfr_playoff
parent216d9673887196a0b8c2475081b115944bbff233 (diff)
Allowing for custom positioning of match boxes
Diffstat (limited to 'jfr_playoff')
-rw-r--r--jfr_playoff/generator.py13
1 files changed, 11 insertions, 2 deletions
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(