fixes bug #291
[enigma2.git] / lib / python / Screens / MinuteInput.py
index 68909b613b103d0bf2fb5e45361617baf14a8ea6..f01fbbecc16ddb4f05e7330117ad94e10c31cc47 100644 (file)
@@ -1,19 +1,14 @@
 from Screen import Screen
 from Components.ActionMap import NumberActionMap
-from Components.Label import Label
-from Components.Button import Button
-from Components.Pixmap import Pixmap
-from Components.MenuList import MenuList
-from enigma import eSize, ePoint
+from Components.Input import Input
 
 class MinuteInput(Screen):
                def __init__(self, session, basemins = 5):
                        Screen.__init__(self, session)
                                                
-                       self["minutes"] = Label()
-                       self.updateValue(basemins)
+                       self["minutes"] = Input(str(basemins), type=Input.NUMBER)
                        
-                       self["actions"] = NumberActionMap([ "NumberZapActions", "MinuteInputActions" ],
+                       self["actions"] = NumberActionMap([ "InputActions" , "MinuteInputActions", "TextEntryActions", "KeyboardInputActions" ],
                        {
                                "1": self.keyNumberGlobal,
                                "2": self.keyNumberGlobal,
@@ -25,29 +20,48 @@ class MinuteInput(Screen):
                                "8": self.keyNumberGlobal,
                                "9": self.keyNumberGlobal,
                                "0": self.keyNumberGlobal,
+                               "left": self.left,
+                               "right": self.right,
+                               "home": self.home,
+                               "end": self.end,
+                               "deleteForward": self.deleteForward,
+                               "deleteBackward": self.deleteBackward,
                                "up": self.up,
                                "down": self.down,
                                "ok": self.ok,
                                "cancel": self.cancel
                        })
                        
-               def updateValue(self, minutes):
-                       self.minutes = minutes
-                       self["minutes"].setText(str(self.minutes) + _(" mins"))
-                       
                def keyNumberGlobal(self, number):
-                       #self.updateValue(self.minutes * 10 + number)
+                       self["minutes"].number(number)
                        pass
                        
+               def left(self):
+                       self["minutes"].left()
+                       
+               def right(self):
+                       self["minutes"].right()
+
+               def home(self):
+                       self["minutes"].home()
+
+               def end(self):
+                       self["minutes"].end()
+
+               def deleteForward(self):
+                       self["minutes"].delete()
+
+               def deleteBackward(self):
+                       self["minutes"].deleteBackward()
+
                def up(self):
-                       self.updateValue(self.minutes + 1)
+                       self["minutes"].up()
                
                def down(self):
-                       if self.minutes > 0:
-                               self.updateValue(self.minutes - 1)
+                       self["minutes"].down()
                                
                def ok(self):
-                       self.close(self.minutes)
+                       self.close(int(self["minutes"].getText()))
                        
                def cancel(self):
                        self.close(0)
\ No newline at end of file