- fixed dvb scan
[enigma2.git] / mytest.py
index b3d1701c6c126516ec741b542de3e1f554a23ec7..e257f11a160c5a84e37599f10c808430080ddcda 100644 (file)
--- a/mytest.py
+++ b/mytest.py
@@ -34,15 +34,6 @@ components = {}
 # do global
 screens["global"](components)
 
-# test our screens
-components["$001"] = screens["testDialog"]()
-
-print "*** classes:"
-dump(screens)
-
-print "*** instances:"
-dump(components)
-
 # display
 
 class OutputDevice:
@@ -68,18 +59,26 @@ class Session:
                self.delayTimer.timeout.get().append(self.processDelay)
                
                self.currentDialog = None
+               
+               self.dialogStack = [ ]
        
        def processDelay(self):
-               self.currentDialog.close()
+               self.currentDialog.doClose()
                if self.currentWindow != None:
                        self.currentWindow.hide()
                
                del self.currentDialog
                del self.currentWindow
                
-               self.open(screens["testDialog"]())
-
+               if len(self.dialogStack):
+                       (self.currentDialog, self.currentWindow) = self.dialogStack.pop()
+                       self.currentWindow.show()
+       
        def open(self, screen):
+               if self.currentDialog:
+                       self.dialogStack.append((self.currentDialog, self.currentWindow))
+                       self.currentWindow.hide()
+               
                self.currentDialog = screen
                screen.session = self
                
@@ -100,7 +99,12 @@ class Session:
                        self.currentWindow = None
 
        def keyEvent(self, code):
-               self.currentDialog.data["okbutton"]["instance"].push()
+#              print "code " + str(code)
+               if code == 32:
+                       self.currentDialog.data["okbutton"]["instance"].push()
+               
+               if code >= 0x30 and code <= 0x39:
+                       self.currentDialog.data["menu"]["instance"].moveSelection(code - 0x31)
 
        def close(self):
                self.delayTimer.start(0, 1)
@@ -109,8 +113,8 @@ def runScreenTest():
        session = Session()
        session.desktop = getDesktop()
        
-       session.open(screens["clockDisplay"](components["clock"]))
-#      session.open(screens["testDialog"]())
+#      session.open(screens["clockDisplay"](components["clock"]))
+       session.open(screens["testDialog"]())
 
        # simple reason for this helper function: we want to call the currently
        # active "okbutton", even when we changed the dialog