98b440c5bd604cf4d2032ed7f2cb17ca228efb78
[enigma2.git] / lib / python / Components / TextInput.py
1 from HTMLComponent import *
2 from GUIComponent import *
3
4 from tools import CONNECT, DISCONNECT
5
6 from enigma import eInput, eInputContentString
7
8 class TextInput(HTMLComponent, GUIComponent):
9         def __init__(self):
10                 GUIComponent.__init__(self)
11                 self.content = eInputContentString()
12
13         def contentChanged(self):
14                 print "content changed to %s!" % (self.getText())
15         
16         def getText(self):
17                 return self.content.getText()
18         
19         def setText(self, text):
20                 # TODO :  support unicode!
21                 self.content.setText(str(text))
22         
23         def GUIcreate(self, parent, skindata):
24                 self.instance = eInput(parent)
25                 CONNECT(self.instance.changed, self.contentChanged)
26                 self.instance.setContent(self.content)
27         
28         def GUIdelete(self):
29                 DISCONNECT(self.instance.changed, self.contentChanged)
30                 self.instance.setContent(None)
31                 self.instance = None