fixes bug #556
[enigma2.git] / lib / python / Screens / ServiceScan.py
index 60701e60b17fd386fc236de26e1acd4e8183ab12..1fd32e0678619c8ebaa0fc30db65cb03650826a4 100644 (file)
@@ -6,18 +6,57 @@ from Components.ActionMap import ActionMap
 from Components.FIFOList import FIFOList
 from Components.Sources.FrontendInfo import FrontendInfo
 
+class ServiceScanSummary(Screen):
+       skin = """
+       <screen position="0,0" size="132,64">
+               <widget name="Title" position="6,4" size="120,42" font="Regular;16" transparent="1" />
+               <widget name="scan_progress" position="6,50" zPosition="1" borderWidth="1" size="56,12" backgroundColor="dark" />
+               <widget name="Service" position="6,22" size="120,26" font="Regular;12" transparent="1" />
+       </screen>"""
+       
+       def __init__(self, session, parent, showStepSlider = True):
+               Screen.__init__(self, session, parent)
+               
+               self["Title"] = Label(parent.title or "ServiceScan")
+               self["Service"] = Label("No Service")
+               self["scan_progress"] = ProgressBar()
+               
+       def updateProgress(self, value):
+               self["scan_progress"].setValue(value)
+
+       def updateService(self, name):
+               self["Service"].setText(name)
+
 class ServiceScan(Screen):
+       
        def ok(self):
                print "ok"
                if self["scan"].isDone():
+                       self.resetTimeout()
                        self.close()
        
        def cancel(self):
+               self.resetTimeout()
                self.close()
+               
+       def setTimeout(self):
+               try:
+                       self.oldtimeoutvalue = open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "r").readline()
+                       open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write("0")
+               except:
+                       print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available"                
+               
+       def resetTimeout(self):
+               try:
+                       open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write(self.oldtimeoutvalue)
+               except:
+                       print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available"
        
        def __init__(self, session, scanList):
                Screen.__init__(self, session)
                
+               self.scanList = scanList
+               
                self.session.nav.stopService()
                
                self["scan_progress"] = ProgressBar()
@@ -28,10 +67,20 @@ class ServiceScan(Screen):
                self["pass"] = Label("")
                self["servicelist"] = FIFOList(len=10)
                self["FrontendInfo"] = FrontendInfo()
-               self["scan"] = CScan(self["scan_progress"], self["scan_state"], self["servicelist"], self["pass"], scanList, self["network"], self["transponder"], self["FrontendInfo"])
-
+               
                self["actions"] = ActionMap(["OkCancelActions"], 
                        {
                                "ok": self.ok,
                                "cancel": self.cancel
                        })
+               
+               self.setTimeout()
+               
+               self.onFirstExecBegin.append(self.doServiceScan)
+
+       def doServiceScan(self):
+               self["scan"] = CScan(self["scan_progress"], self["scan_state"], self["servicelist"], self["pass"], self.scanList, self["network"], self["transponder"], self["FrontendInfo"], self.session.summary)
+
+       def createSummary(self):
+               print "ServiceScanCreateSummary"
+               return ServiceScanSummary
\ No newline at end of file