From b8ff1b8cf6b5a9829c4b3ae4739e754e710d20ea Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Mon, 27 Aug 2018 16:55:00 +0200 Subject: [PATCH] TrayLayout: Make parsing a bit more robust Ignore white space at the end of lines with horizontal walls --- boxes/generators/traylayout.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/boxes/generators/traylayout.py b/boxes/generators/traylayout.py index 49113a7..7f31def 100644 --- a/boxes/generators/traylayout.py +++ b/boxes/generators/traylayout.py @@ -344,7 +344,7 @@ class TrayLayout2(TrayLayout): continue if line[0] == '+': w = [] - for n, c in enumerate(line): + for n, c in enumerate(line[:len(x)*2 + 1]): if n % 2: if c == ' ': w.append(False) @@ -389,6 +389,7 @@ class TrayLayout2(TrayLayout): # check sizes lx = len(x) ly = len(y) + if len(hwalls) != ly + 1: raise ValueError("Wrong number of horizontal wall lines: %i (%i expected)" % (len(hwalls), ly + 1)) for nr, walls in enumerate(hwalls):