X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/84670d3dc9c9dc29fd3af42b2f25092b3b6c2a09..54bd4123728628a6f77bad2584b70d1353a91666:/screens.py diff --git a/screens.py b/screens.py index a44f825e..72f0946d 100644 --- a/screens.py +++ b/screens.py @@ -1,5 +1,6 @@ from components import * import sys +from enigma import quitMainloop # some screens def doGlobal(screen): @@ -8,33 +9,89 @@ 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) -# a test dialog -class testDialog(Screen): - def testDialogClick(self): - 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 ) + def close(self, retval=None): + self.session.close() + +class mainMenu(Screen): + + def goEmu(self): + self["title"].setText("EMUs ARE ILLEGAL AND NOT SUPPORTED!") + + def goTimeshift(self): + self["title"].setText("JUST PRESS THE YELLOW BUTTON!") + + def goHDTV(self): + self["title"].setText("HDTV GREEN FLASHES: ENABLED") + + def goScan(self): + self.session.open(serviceScan()) + + def goClock(self): + self.session.open(clockDisplay(Clock())) - self.tries += 1 + def okbuttonClick(self): + selection = self["menu"].getCurrent() + selection[1]() def __init__(self): GUISkin.__init__(self) b = Button("ok") - b.onClick = [ self.testDialogClick ] + + b.onClick = [ self.okbuttonClick ] self["okbutton"] = b - self["title"] = Header("Test Dialog - press ok to leave!") + self["title"] = Header("Main Menu! - press ok to leave!") + self["menu"] = MenuList( + [ + ("Close Main Menu", self.close), + ("Service Scan", self.goScan), + ("Quit", quitMainloop), + ("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["title"] = Header("this is the\nMAIN MENU !!!"); +# self["okbutton"] = Button("ok") +# self["okbutton"].onClick = [ self.close ] + +class channelSelection(Screen): + def __init__(self): + GUISkin.__init__(self) + + self["list"] = ServiceList() + self["list"].setRoot(eServiceReference("1:0:1:0:0:0:0:0:0:0:PREMIERE")) - self.tries = 0 + self["okbutton"] = Button("ok", [self.channelSelected, self.close]) + + def channelSelected(self): +# print "channel selected!" + pass + +class infoBar(Screen): + def __init__(self): + GUISkin.__init__(self) + + self["channelSwitcher"] = Button("switch Channel", [self.switchChannel]) + self["okbutton"] = Button("mainMenu", [self.mainMenu]) + + def mainMenu(self): + self.session.open(mainMenu()) + + def switchChannel(self): + self.session.open(channelSelection()) # a clock display dialog class clockDisplay(Screen): def okbutton(self): - print "clockDisplay close" - self.session.close() def __init__(self, clock): @@ -45,9 +102,18 @@ class clockDisplay(Screen): self["okbutton"] = b self["title"] = Header("clock dialog: here you see the current uhrzeit!") -# defined screens -screens = { - "global": doGlobal, - "testDialog": testDialog, - "clockDisplay": clockDisplay } +class serviceScan(Screen): + def ok(self): + if self["scan"].isDone(): + self.close() + + def __init__(self): + GUISkin.__init__(self) + + self["scan_progress"] = ProgressBar() + self["scan_state"] = Label("scan state") + self["scan"] = ServiceScan(self["scan_progress"], self["scan_state"]) + + self["okbutton"] = Button("ok", [self.ok]) + self["okbutton"].disable()