4 # some helper classes first:
12 def __init__(self, order):
15 def produceHTML(self):
17 for name in self.order:
18 res += self[name].produceHTML()
24 def createGUIScreen(self, parent):
25 for (name, val) in self.items():
27 val.GUIcreate(self.data[name], parent, None)
35 def GUIcreate(self, priv, parent, skindata):
36 i = self.GUIcreateInstance(self, parent, skindata)
38 print str(self) + " notifier list before " + str(self.notifier)
39 self.notifier.append(i)
40 print str(self) + " notifier list now " + str(self.notifier)
41 if self.notifierAdded:
45 """VariableText can be used for components which have a variable text, based on any widget with setText call"""
50 def notifierAdded(self, notifier):
51 notifier.setText(self.message)
53 def setText(self, text):
54 if self.message != text:
57 for x in self.notifier:
58 x.setText(self.message)
64 """VariableValue can be used for components which have a variable value (like eSlider), based on any widget with setValue call"""
69 def notifierAdded(self, notifier):
70 notifier.setValue(self.value)
72 def setValue(self, value):
73 if self.value != value:
75 for x in self.notifier:
76 x.setValue(self.value)
81 # now some "real" components:
83 class Clock(HTMLComponent, GUIComponent, VariableText):
85 VariableText.__init__(self)
86 GUIComponent.__init__(self)
91 self.setText("clock: " + time.asctime())
93 # realisierung als GUI
94 def GUIcreateInstance(self, priv, parent, skindata):
99 def produceHTML(self):
100 return self.getText()
102 class Button(HTMLComponent, GUIComponent, VariableText):
105 def __init__(self, text=""):
106 GUIComponent.__init__(self)
107 VariableText.__init__(self)
111 for x in self.onClick:
115 def produceHTML(self):
116 return "<input type=\"submit\" text=\"" + self.getText() + "\">\n"
119 def GUIcreateInstance(self, priv, parent, skindata):
121 # g.clicked = [ self.click ]
124 class Header(HTMLComponent, GUIComponent, VariableText):
126 def __init__(self, message):
127 GUIComponent.__init__(self)
128 VariableText.__init__(self)
129 self.setText(message)
131 def produceHTML(self):
132 return "<h2>" + self.getText() + "</h2>\n"
134 def GUIcreateInstance(self, priv, parent, skindata):
136 g.setText(self.message)
139 class VolumeBar(HTMLComponent, GUIComponent, VariableValue):
142 GUIComponent.__init__(self)
143 VariableValue.__init__(self)
145 def GUIcreateInstance(self, priv, parent, skindata):