PageRenderTime 47ms CodeModel.GetById 39ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/pyjs/tests/test007.py

http://pyjamas.googlecode.com/
Python | 33 lines | 20 code | 13 blank | 0 comment | 0 complexity | 63ae6af4c7a334c955786d133630d20a MD5 | raw file
 1import DOM
 2
 3class UIObject:
 4
 5    def getElement(self):
 6        return self.element
 7
 8    def setElement(self, element):
 9        self.element = element
10
11    def setStyleName(self, style):
12        DOM.setAttribute(self.element, "className", style)
13
14
15class Widget(UIObject):
16
17    def setParent(self, parent):
18        self.parent = parent
19
20
21class Panel(Widget):
22    pass
23
24
25class ComplexPanel(Panel):
26
27    def __init__(self):
28        self.children = []
29    
30    def add(self, widget):
31        self.children.append(widget)
32        widget.setParent(self)
33        return True