90c45e6e1bbf708acebced5408170d5c412f627e
[enigma2.git] / lib / python / Plugins / test / plugin.py
1 from enigma import *
2 from Screens.Screen import Screen
3 from Screens.MessageBox import MessageBox
4 from Components.ActionMap import NumberActionMap
5 from Components.Label import Label
6 from Components.Input import Input
7 from Components.GUIComponent import *
8
9 import os
10
11 class Test(Screen):
12         skin = """
13                 <screen position="100,100" size="550,400" title="Test" >
14                         <widget name="text" position="0,0" size="550,25" font="Regular;20" />
15                 </screen>"""
16                 
17         def __init__(self, session, args = None):
18                 self.skin = Test.skin
19                 Screen.__init__(self, session)
20
21                 self["text"] = Input("1234", maxSize=True, type=Input.NUMBER)
22                                 
23                 self["actions"] = NumberActionMap(["WizardActions", "InputActions"], 
24                 {
25                         "ok": self.close,
26                         "back": self.close,
27                         "left": self.keyLeft,
28                         "right": self.keyRight,
29                         "1": self.keyNumberGlobal,
30                         "2": self.keyNumberGlobal,
31                         "3": self.keyNumberGlobal,
32                         "4": self.keyNumberGlobal,
33                         "5": self.keyNumberGlobal,
34                         "6": self.keyNumberGlobal,
35                         "7": self.keyNumberGlobal,
36                         "8": self.keyNumberGlobal,
37                         "9": self.keyNumberGlobal,
38                         "0": self.keyNumberGlobal
39                 }, -1)
40                 
41         def keyLeft(self):
42                 self["text"].left()
43         
44         def keyRight(self):
45                 self["text"].right()
46         
47         def keyNumberGlobal(self, number):
48                 print "pressed", number
49                 self["text"].number(number)
50
51 def getPicturePaths():
52         return [ "" ]
53
54 def getPlugins():
55         return [("Test", "plugin to test some capabilities", "screen", "Test")]