update python
[enigma2.git] / screens.py
index bd0f6fc423bed4fe09a28424460c9e0360f14336..f0b06bdac8c31b5c421cd223b9e750efce2cd3c0 100644 (file)
@@ -1,4 +1,5 @@
 from components import *
+import sys
 
 # some screens
 def doGlobal(screen):
@@ -7,31 +8,42 @@ def doGlobal(screen):
 class Screen(dict, HTMLSkin, GUISkin):
        """ bla """
        
+       def close(self):
+               GUISkin.close(self)
+       
 # a test dialog
 class testDialog(Screen):
        def testDialogClick(self):
                print "test dialog clicked!"
-               self["title"].setText("bla")
+               if self.tries == 0:
+                       self["title"].setText("Hihi - no, this doesn't work!")
+               else:
+                       self["title"].setText("You tried it %d times without success now!" % self.tries )
+
+               self.tries += 1
 
        def __init__(self):
-               HTMLSkin.__init__(self, ("title", "okbutton"))
+               GUISkin.__init__(self)
                b = Button("ok")
                b.onClick = [ self.testDialogClick ]
                self["okbutton"] = b
                self["title"] = Header("Test Dialog - press ok to leave!")
+               
+               self.tries = 0
 
 # a clock display dialog
 class clockDisplay(Screen):
        def okbutton(self):
                print "clockDisplay close"
+               
+               self.session.close()
        
        def __init__(self, clock):
-               HTMLSkin.__init__(self, ("title", "theClock", "okbutton"))
+               GUISkin.__init__(self)
                self["theClock"] = clock
                b = Button("bye")
                b.onClick = [ self.okbutton ]
                self["okbutton"] = b
-               #VolumeBar()
                self["title"] = Header("clock dialog: here you see the current uhrzeit!")
 
 # defined screens