19 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 |
|
|
21 |
from UserList import UserList |
from UserList import UserList |
|
|
|
22 |
from errors import * |
from errors import * |
23 |
|
|
24 |
__all__ = ("Box",) |
__all__ = ("Box",) |
29 |
|
|
30 |
class Box(UserList): |
class Box(UserList): |
31 |
def __init__(self, *args, **kw): |
def __init__(self, *args, **kw): |
32 |
for i in ('parent', 'line', 'column', 'width', 'height', 'align', 'vfill', 'raw', 'wrap'): |
for i in ('parent', 'line', 'column', 'width', 'height', 'align', 'vfill', 'raw', 'wrap', 'style'): |
|
#print "%s: %s" % (i, kw[i]) |
|
33 |
setattr(self, i, kw[i]) |
setattr(self, i, kw[i]) |
34 |
self.encoder = self.parent.encoder |
self.encoder = self.parent.encoder |
35 |
|
self.caps = self.parent.root.caps |
36 |
self(*args) |
self(*args) |
37 |
|
|
38 |
def reset(self): |
def reset(self): |
84 |
s=[s] |
s=[s] |
85 |
if container_height and self.vfill: |
if container_height and self.vfill: |
86 |
s = (s*container_height)[:container_height] |
s = (s*container_height)[:container_height] |
87 |
return s |
i=self.caps.start(self.style) |
88 |
|
o=self.caps.end(self.style) |
89 |
|
return [i+j+o for j in s] |
90 |
|
|
91 |
if __name__ == '__main__': |
if __name__ == '__main__': |
92 |
d=Box('hola', 'que', 'tal', 'los chicos bien la familia bien', |
d=Box('hola', 'que', 'tal', 'los chicos bien la familia bien', |