enigma2: 4.3.1r16
[enigma2.git] / usr / lib / enigma2 / python / Plugins / Extensions / MediaRenderer / LCDScreen.py
1 from Components.Label import Label
2 from Screens.Screen import Screen
3
4 class MediaRendererLCDScreen(Screen):
5         skin = (
6         """<screen name="MediaRendererLCDScreen" position="0,0" size="132,64" id="1">
7                 <widget name="text1" position="4,0" size="132,18" font="Regular;14"/>
8                 <widget name="text2" position="4,20" size="132,14" font="Regular;11"/>
9                 <widget name="text3" position="4,36" size="132,14" font="Regular;11"/>
10         </screen>""",
11         """<screen name="MediaRendererLCDScreen" position="0,0" size="96,64" id="2">
12                 <widget name="text1" position="0,0" size="96,18" font="Regular;13"/>
13                 <widget name="text2" position="0,20" size="96,14" font="Regular;10"/>
14                 <widget name="text3" position="0,36" size="96,14" font="Regular;10"/>
15         </screen>""",
16         """<screen name="MediaRendererLCDScreen" position="0,0" size="400,240" id="3">
17                 <ePixmap position="0,0" size="400,240" pixmap="skin_default/display_bg.png" zPosition="-1"/>
18                 <widget name="text1" font="Display;48" halign="center" position="0,5" size="400,48" transparent="1"/>
19                 <eLabel backgroundColor="yellow" position="0,52" size="400,2" />
20                 <widget name="text2" font="Display;36" halign="center" valign="center" position="0,56" size="400,72" transparent="1"/>
21                 <widget name="text3" font="Display;36" halign="center" valign="center" position="0,130" size="400,112" transparent="1"/>
22         </screen>"""
23         )
24
25         def __init__(self, session, parent):
26                 Screen.__init__(self, session)
27                 self["text1"] = Label("")
28                 self["text2"] = Label("")
29                 self["text3"] = Label("")
30
31         def setText(self, text, line):
32                 if line == 1:
33                         if len(text) > 100:
34                                 # TODO remove this hack
35                                 if text[-4:-3] == ".":
36                                         text = text[:-4]
37                                 if len(text) > 100:
38                                         text = text[-100:]
39                 else:
40                         if len(text) > 100:
41                                 # TODO remove this hack
42                                 if text[-4:-3] == ".":
43                                         text = text[:-4]
44                                 if len(text) > 100:
45                                         text = text[-100:]
46                 empty = "       "
47                 text = text + empty * 10
48                 if line == 1:
49                         self["text1"].setText(text)
50                 elif line == 2:
51                         self["text2"].setText(text)
52                 elif line == 3:
53                         self["text3"].setText(text)
54                 else:
55                         print "SimpleLCDScreen line %s does not exist!"
56
57         def clear(self):
58                 self["text1"].setText("")
59                 self["text2"].setText("")
60                 self["text3"].setText("")