57 |
else: |
else: |
58 |
Y = self.height |
Y = self.height |
59 |
a = [' '*X for j in xrange(Y)] |
a = [' '*X for j in xrange(Y)] |
60 |
|
deferred = {} |
61 |
for x in xrange(X+1): |
for x in xrange(X+1): |
62 |
curr = [] |
curr = [] |
63 |
for y in xrange(len(a)): |
for y in xrange(len(a)): |
64 |
if self.has_key((x, y)): |
if self.has_key((x, y)): |
65 |
curr = self[x,y].render(len(a)) |
if self[x,y].vfill: |
66 |
a[y] = a[y][:x] + ' '*(x-len(a[y][:x])) + curr.pop(0) |
deferred[x,y] = self[(x,y)] |
67 |
|
else: |
68 |
|
curr = self[x,y].render(len(a)) |
69 |
|
a[y] = a[y][:x] + ' '*(x-len(a[y][:x])) + curr.pop(0) |
70 |
elif curr: |
elif curr: |
71 |
a[y] += ' '*(x-len(a[y])) |
a[y] += ' '*(x-len(a[y])) |
72 |
a[y] = a[y][:x] + curr.pop(0) |
a[y] = a[y][:x] + curr.pop(0) |
73 |
if curr and not self.height: |
if curr and not self.height: |
74 |
a.extend([' '*x + i for i in curr]) |
a.extend([' '*x + i for i in curr]) |
75 |
|
for (x, y), v in deferred.items(): |
76 |
|
r = v.render(len(a)) |
77 |
|
for i in xrange(len(r)): |
78 |
|
a[y+i] = a[y+i][:x] + ' '*(x-len(a[y+i][:x])) + r[i] + a[y+i][x+len(r[i]):] |
79 |
|
|
80 |
w = max([len(i) for i in a]) |
w = max([len(i) for i in a]) |
81 |
return [i.ljust(w) for i in a] |
return [i.ljust(w) for i in a] |