TrayLayout: Make parsing a bit more robust
Ignore white space at the end of lines with horizontal walls
This commit is contained in:
parent
b4a95aca15
commit
b8ff1b8cf6
|
@ -344,7 +344,7 @@ class TrayLayout2(TrayLayout):
|
||||||
continue
|
continue
|
||||||
if line[0] == '+':
|
if line[0] == '+':
|
||||||
w = []
|
w = []
|
||||||
for n, c in enumerate(line):
|
for n, c in enumerate(line[:len(x)*2 + 1]):
|
||||||
if n % 2:
|
if n % 2:
|
||||||
if c == ' ':
|
if c == ' ':
|
||||||
w.append(False)
|
w.append(False)
|
||||||
|
@ -389,6 +389,7 @@ class TrayLayout2(TrayLayout):
|
||||||
# check sizes
|
# check sizes
|
||||||
lx = len(x)
|
lx = len(x)
|
||||||
ly = len(y)
|
ly = len(y)
|
||||||
|
|
||||||
if len(hwalls) != ly + 1:
|
if len(hwalls) != ly + 1:
|
||||||
raise ValueError("Wrong number of horizontal wall lines: %i (%i expected)" % (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):
|
for nr, walls in enumerate(hwalls):
|
||||||
|
|
Loading…
Reference in New Issue