add timeout for MessageBox screens (just add timeout=<seconds> as argument when creat...
[enigma2.git] / lib / python / Plugins / DemoPlugins / TestPlugin / plugin.py
index 5991f594e12dde81f577dafd5fe756b00d1d8d71..e074aeecef2b65967cf98ef3d8a04c842a8d3a27 100644 (file)
@@ -7,6 +7,7 @@ from Components.Input import Input
 from Components.GUIComponent import *
 from Components.Pixmap import Pixmap
 from Components.FileList import FileEntryComponent, FileList
+from Screens.ChoiceBox import ChoiceBox
 from Plugins.Plugin import PluginDescriptor
 
 import os
@@ -45,6 +46,17 @@ class Test(Screen):
                        "0": self.keyNumberGlobal
                }, -1)
                
+               self.onShown.append(self.openTest)
+
+       def openTest(self):
+               self.session.openWithCallback(self.callback, MessageBox, _("Test-Messagebox?"))
+
+#              self.session.open(InputBox)
+       
+       def callback(self, answer):
+               print "answer:", answer
+               self.close()
+       
        def keyLeft(self):
                self["text"].left()
        
@@ -62,8 +74,12 @@ class Test(Screen):
                print "pressed", number
                self["text"].number(number)
 
-def main(session):
-       session.open(Test)
+def main(session, **kwargs):
+       session.openWithCallback(test, MessageBox, _("Test-Messagebox?"), timeout = 10)
+       #session.openWithCallback(test, ChoiceBox, title="Delete everything on this Dreambox?", list=[(_("yes"), "yes"), (_("no"), "no"), (_("perhaps"), "perhaps"), (_("ask me tomorrow"), "ask me tomorrow"), (_("leave me alone with this!"), "yes")])
+       
+def test(returnValue):
+       print "You entered", returnValue
 
-def Plugins():
-       return PluginDescriptor(name="Test", description="plugin to test some capabilities", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main)
+def Plugins(**kwargs):
+       return PluginDescriptor(name="Test", description="plugin to test some capabilities", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main)