-class OutputDevice:
- def create(self, screen): pass
-
-# display: HTML
-
-class HTMLOutputDevice(OutputDevice):
- def create(self, comp):
- print comp.produceHTML()
-
-html = HTMLOutputDevice()
-
-class GUIOutputDevice(OutputDevice):
- parent = None
- def create(self, comp):
- comp.createGUIScreen(self.parent)
-
-
-
-def test():
- desktop = getDesktop()
- print "desktop: " + str(desktop)
-
- wnd = eWindow(desktop)
- print "window " + str(wnd)
- wnd.setTitle("python")
- wnd.move(ePoint(300, 100))
- wnd.resize(eSize(300, 300))
- wnd.show()
-
- gui = GUIOutputDevice()
- gui.parent = wnd
- gui.create(components["$002"])
-# for (x,y) in components["$001"].data.items():
-# print str(x) + " -> " + str(y) + " (" + y["instance"].getText() + ")"
-
-# print components["$001"].data["okbutton"]["instance"].doClick()
-
-# diese sachen gehoeren in den skin! :)
- applyGUIskin(components["$002"], None, "clockDialog")
-
-# das ist dann schon die echte funktionalitaet ;)
- components["clock"].doClock()
- components["clock"].doClock()
-
-
-# output as html
- print "--------------------------------------"
- html.create(components["$001"])
- print "--------------------------------------"
- html.create(components["$002"])
- print "--------------------------------------"
-
-
-# direkter test der GUI aus python:
-# label1 = eLabel(wnd)
-# label1.setText("hello world!\nfrom python!")
-# label1.move(ePoint(10, 10))
-# label1.resize(eSize(80, 50))
-#
-# label2 = eLabel(wnd)
-# label2.setText("the second\nlabel works\nas well!")
-# label2.move(ePoint(90, 10))
-# label2.resize(eSize(80, 50))
-#
-# button = eButton(wnd)
-# button.setText("OK")
-# button.move(ePoint(200, 10))
-# button.resize(eSize(80, 50))
-
- for x in range(200):
- time.sleep(0.1)
- components["clock"].doClock()
- if x > 100:
- r = 200 - x
+ self.pushCurrent()
+ dlg = self.current_dialog = self.instantiateDialog(screen, *arguments, **kwargs)
+ dlg.isTmp = True
+ dlg.callback = None
+ self.execBegin()
+ return dlg
+
+ def close(self, screen, *retval):
+ if not self.in_exec:
+ print "close after exec!"
+ return
+
+ # be sure that the close is for the right dialog!
+ # if it's not, you probably closed after another dialog
+ # was opened. this can happen if you open a dialog
+ # onExecBegin, and forget to do this only once.
+ # after close of the top dialog, the underlying will
+ # gain focus again (for a short time), thus triggering
+ # the onExec, which opens the dialog again, closing the loop.
+ assert screen == self.current_dialog
+
+ self.current_dialog.returnValue = retval
+ self.delay_timer.start(0, 1)
+ self.execEnd()
+
+ def pushSummary(self):
+ if self.summary is not None:
+ self.summary.hide()
+ self.summary_stack.append(self.summary)
+ self.summary = None
+
+ def popSummary(self):
+ if self.summary is not None:
+ self.summary.doClose()
+ self.summary = self.summary_stack.pop()
+ if self.summary is not None:
+ self.summary.show()
+
+profile("Standby,PowerKey")
+import Screens.Standby
+from Screens.Menu import MainMenu, mdom
+from GlobalActions import globalActionMap
+
+class PowerKey:
+ """ PowerKey stuff - handles the powerkey press and powerkey release actions"""
+
+ def __init__(self, session):
+ self.session = session
+ globalActionMap.actions["power_down"]=self.powerdown
+ globalActionMap.actions["power_up"]=self.powerup
+ globalActionMap.actions["power_long"]=self.powerlong
+ globalActionMap.actions["deepstandby"]=self.shutdown # frontpanel long power button press
+ self.standbyblocked = 1
+
+ def MenuClosed(self, *val):
+ self.session.infobar = None
+
+ def shutdown(self):
+ print "PowerOff - Now!"
+ if not Screens.Standby.inTryQuitMainloop and self.session.current_dialog and self.session.current_dialog.ALLOW_SUSPEND:
+ self.session.open(Screens.Standby.TryQuitMainloop, 1)
+
+ def powerlong(self):
+ if Screens.Standby.inTryQuitMainloop or (self.session.current_dialog and not self.session.current_dialog.ALLOW_SUSPEND):
+ return
+ self.doAction(action = config.usage.on_long_powerpress.value)
+
+ def doAction(self, action):
+ self.standbyblocked = 1
+ if action == "shutdown":
+ self.shutdown()
+ elif action == "show_menu":
+ print "Show shutdown Menu"
+ root = mdom.getroot()
+ for x in root.findall("menu"):
+ y = x.find("id")
+ if y is not None:
+ id = y.get("val")
+ if id and id == "shutdown":
+ self.session.infobar = self
+ menu_screen = self.session.openWithCallback(self.MenuClosed, MainMenu, x)
+ menu_screen.setTitle(_("Standby / Restart"))
+ return
+ elif action == "standby":
+ self.standby()
+
+ def powerdown(self):
+ self.standbyblocked = 0
+
+ def powerup(self):
+ if self.standbyblocked == 0:
+ self.doAction(action = config.usage.on_short_powerpress.value)
+
+ def standby(self):
+ if not Screens.Standby.inStandby and self.session.current_dialog and self.session.current_dialog.ALLOW_SUSPEND and self.session.in_exec:
+ self.session.open(Screens.Standby.Standby)
+
+profile("Scart")
+from Screens.Scart import Scart
+
+class AutoScartControl:
+ def __init__(self, session):
+ self.force = False
+ self.current_vcr_sb = eAVSwitch.getInstance().getVCRSlowBlanking()
+ if self.current_vcr_sb and config.av.vcrswitch.value:
+ self.scartDialog = session.instantiateDialog(Scart, True)
+ else:
+ self.scartDialog = session.instantiateDialog(Scart, False)
+ config.av.vcrswitch.addNotifier(self.recheckVCRSb)
+ eAVSwitch.getInstance().vcr_sb_notifier.get().append(self.VCRSbChanged)
+
+ def recheckVCRSb(self, configElement):
+ self.VCRSbChanged(self.current_vcr_sb)
+
+ def VCRSbChanged(self, value):
+ #print "vcr sb changed to", value
+ self.current_vcr_sb = value
+ if config.av.vcrswitch.value or value > 2:
+ if value:
+ self.scartDialog.showMessageBox()
+ else:
+ self.scartDialog.switchToTV()
+
+profile("Load:CI")
+from enigma import eDVBCIInterfaces
+from Screens.Ci import CiHandler
+
+profile("Load:VolumeControl")
+from Components.VolumeControl import VolumeControl
+
+def runScreenTest():
+ config.misc.startCounter.value += 1
+
+ profile("readPluginList")
+ plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
+
+ profile("Init:Session")
+ nav = Navigation(config.misc.isNextRecordTimerAfterEventActionAuto.value)
+ session = Session(desktop = getDesktop(0), summary_desktop = getDesktop(1), navigation = nav)
+
+ CiHandler.setSession(session)
+
+ screensToRun = [ p.__call__ for p in plugins.getPlugins(PluginDescriptor.WHERE_WIZARD) ]
+
+ profile("wizards")
+ screensToRun += wizardManager.getWizards()
+
+ screensToRun.append((100, Screens.InfoBar.InfoBar))
+
+ screensToRun.sort()
+
+ ePythonConfigQuery.setQueryFunc(configfile.getResolvedKey)
+
+# eDVBCIInterfaces.getInstance().setDescrambleRules(0 # Slot Number
+# ,( ["1:0:1:24:4:85:C00000:0:0:0:"], #service_list
+# ["PREMIERE"], #provider_list,
+# [] #caid_list
+# ));
+
+ def runNextScreen(session, screensToRun, *result):
+ if result:
+ quitMainloop(*result)
+ return
+
+ screen = screensToRun[0][1]
+ args = screensToRun[0][2:]
+
+ if screensToRun:
+ session.openWithCallback(boundFunction(runNextScreen, session, screensToRun[1:]), screen, *args)