small optimizations and cleanups by Moritz Venn
[vuplus_dvbapp] / lib / python / Screens / NumericalTextInputHelpDialog.py
1 from Screen import Screen
2 from Components.Label import Label
3
4 class NumericalTextInputHelpDialog(Screen):
5         def __init__(self, session, textinput):
6                 Screen.__init__(self, session)
7                 for x in (1, 2, 3, 4, 5, 6, 7, 8, 9):
8                         self["key%d" % x] = Label(text=textinput.mapping[x].encode("utf-8"))
9                 self.last_marked = 0
10
11         def update(self, textinput):
12                 if 1 <= self.last_marked <= 9:
13                         self["key%d" % self.last_marked].setMarkedPos(-1)
14                 if 1 <= textinput.lastKey <= 9:
15                         self["key%d" % textinput.lastKey].setMarkedPos(textinput.pos)
16                         self.last_marked = textinput.lastKey