re-add autostart plugins
[enigma2.git] / lib / python / Components / Button.py
1 from HTMLComponent import *
2 from GUIComponent import *
3 from VariableText import *
4
5 from enigma import eButton
6
7 class Button(HTMLComponent, GUIComponent, VariableText):
8         def __init__(self, text="", onClick = [ ]):
9                 GUIComponent.__init__(self)
10                 VariableText.__init__(self)
11                 self.setText(text)
12                 self.onClick = onClick
13         
14         def push(self):
15                 for x in self.onClick:
16                         x()
17                 return 0
18         
19         def disable(self):
20                 pass
21         
22         def enable(self):
23                 pass
24
25 # html:
26         def produceHTML(self):
27                 return "<input type=\"submit\" text=\"" + self.getText() + "\">\n"
28
29 # GUI:
30         def createWidget(self, parent):
31                 g = eButton(parent)
32                 g.selected.get().append(self.push)
33                 return g
34
35         def removeWidget(self, w):
36                 w.selected.get().remove(self.push)
37