support for a final post-destroy value
[enigma2.git] / lib / python / Components / Sources / StaticText.py
1 from Source import Source
2
3 class StaticText(Source):
4         # filter is a function which filters external, untrusted strings
5         # this must be done to avoid XSS attacks!
6
7         # (and is probably not done yet. For this reason, be careful when
8         # using this on HTML pages. *DO* provide your filter function.)
9         def __init__(self, text = "", filter = lambda x: x):
10                 Source.__init__(self)
11                 self.__text = text
12                 self.filter = filter
13
14         def handleCommand(self, cmd):
15                 self.text = self.filter(cmd)
16
17         def getText(self):
18                 return self.__text
19
20         def setText(self, text):
21                 self.__text = text
22                 self.changed((self.CHANGED_ALL,))
23
24         text = property(getText, setText)