- add fake "main menu"
[enigma2.git] / mytest.py
index e4a722ac3cc265c527271649b03ac83c85e7a650..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
                
@@ -114,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