X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/a5307ff8aa3456aa5bec285e7d94d8d7c014d131..6b7b7977a92c9a092763bf699cba85347f9f2ec6:/screens.py diff --git a/screens.py b/screens.py index f0b06bda..3dbcb4aa 100644 --- a/screens.py +++ b/screens.py @@ -8,19 +8,36 @@ def doGlobal(screen): class Screen(dict, HTMLSkin, GUISkin): """ bla """ - def close(self): + # never call this directly - it will be called from the session! + def doClose(self): GUISkin.close(self) + def close(self, retval=None): + self.session.close() + # a test dialog class testDialog(Screen): def testDialogClick(self): - print "test dialog clicked!" - 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 + selection = self["menu"].getCurrent() + selection[1]() + + def goMain(self): + self.session.open(screens["mainMenu"]()) + + def goEmu(self): +# self.close(1) + self["title"].setText("EMUs ARE ILLEGAL AND NOT SUPPORTED!") + + def goTimeshift(self): +# self.close(2) + self["title"].setText("JUST PRESS THE YELLOW BUTTON!") + + def goHDTV(self): +# self.close(3) + self["title"].setText("HDTV GREEN FLASHES: ENABLED") + + def goClock(self): + self.session.open(screens["clockDisplay"](Clock())) def __init__(self): GUISkin.__init__(self) @@ -28,14 +45,27 @@ class testDialog(Screen): b.onClick = [ self.testDialogClick ] self["okbutton"] = b self["title"] = Header("Test Dialog - press ok to leave!") + self["menu"] = MenuList( + [ + ("MAIN MENU", self.goMain), + ("EMU SETUP", self.goEmu), + ("TIMESHIFT SETUP", self.goTimeshift), + ("HDTV PIP CONFIG", self.goHDTV), + ("wie spaet ists?!", self.goClock) + ]) + +class mainMenu(Screen): + def __init__(self): + GUISkin.__init__(self) - self.tries = 0 + self["title"] = Header("this is the\nMAIN MENU !!!"); + self["okbutton"] = Button("ok") + self["okbutton"].onClick = [ self.close ] + # a clock display dialog class clockDisplay(Screen): def okbutton(self): - print "clockDisplay close" - self.session.close() def __init__(self, clock): @@ -46,9 +76,10 @@ class clockDisplay(Screen): self["okbutton"] = b self["title"] = Header("clock dialog: here you see the current uhrzeit!") -# defined screens +# defined screens (evtl. kann man sich das sparen, ich seh den sinn gerade nicht mehr) screens = { "global": doGlobal, "testDialog": testDialog, - "clockDisplay": clockDisplay } + "clockDisplay": clockDisplay , + "mainMenu": mainMenu }