summaryrefslogtreecommitdiff
path: root/jfr_playoff/generator.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-07-06 01:12:50 +0200
committeremkael <emkael@tlen.pl>2018-07-06 01:23:19 +0200
commit5dc528cbd21dbc6a372dbc021e3466e802148827 (patch)
tree743b72e987b8485058914bc0647648976156b032 /jfr_playoff/generator.py
parente1f1f59ecbdf749a215e631438efaf7ddc20c247 (diff)
Expanding canvas if starting positions are to be displayed
Diffstat (limited to 'jfr_playoff/generator.py')
-rw-r--r--jfr_playoff/generator.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/jfr_playoff/generator.py b/jfr_playoff/generator.py
index 22bdc82..2c68d68 100644
--- a/jfr_playoff/generator.py
+++ b/jfr_playoff/generator.py
@@ -120,19 +120,24 @@ class PlayoffGenerator(object):
return ''
def get_match_grid(self, dimensions, grid, matches):
- canvas_size = (
+ canvas_size = [
dimensions[0] * (
self.page['width'] + self.page['margin']
- ) - self.page['margin'],
+ ),
dimensions[1] * (
self.page['height'] + self.page['margin']
- ) - self.page['margin'])
+ ) - self.page['margin']]
+ if 'starting_position_indicators' not in self.page \
+ or not self.page['starting_position_indicators']:
+ canvas_size[0] -= self.page['margin']
PlayoffLogger.get('generator').info(
'canvas size: %s', canvas_size)
grid_boxes = ''
col_no = 0
for phase in grid:
- grid_x = col_no * (self.page['width'] + self.page['margin'])
+ grid_x = col_no * self.page['width'] + (col_no + 1) * self.page['margin'] \
+ if self.page['starting_position_indicators'] \
+ else col_no * (self.page['width'] + self.page['margin'])
grid_boxes += self.get_phase_header(phase, grid_x)
match_height = canvas_size[1] / len(phase.matches)
row_no = 0