By Anders Holst:
[enigma2.git] / lib / python / Screens / ServiceScan.py
1 from Screen import Screen
2 from Components.ServiceScan import ServiceScan as CScan
3 from Components.ProgressBar import ProgressBar
4 from Components.Label import Label
5 from Components.ActionMap import ActionMap
6 from Components.FIFOList import FIFOList
7 from Components.Sources.FrontendInfo import FrontendInfo
8
9 class ServiceScanSummary(Screen):
10         skin = """
11         <screen position="0,0" size="132,64">
12                 <widget name="Title" position="6,4" size="120,42" font="Regular;16" transparent="1" />
13                 <widget name="scan_progress" position="6,50" zPosition="1" borderWidth="1" size="56,12" backgroundColor="dark" />
14                 <widget name="Service" position="6,22" size="120,26" font="Regular;12" transparent="1" />
15         </screen>"""
16         
17         def __init__(self, session, parent, showStepSlider = True):
18                 Screen.__init__(self, session, parent)
19                 
20                 self["Title"] = Label(parent.title or "ServiceScan")
21                 self["Service"] = Label("No Service")
22                 self["scan_progress"] = ProgressBar()
23                 
24         def updateProgress(self, value):
25                 self["scan_progress"].setValue(value)
26
27         def updateService(self, name):
28                 self["Service"].setText(name)
29
30 class ServiceScan(Screen):
31         
32         def ok(self):
33                 print "ok"
34                 if self["scan"].isDone():
35                         self.close()
36         
37         def cancel(self):
38                 self.close()
39         
40         def __init__(self, session, scanList):
41                 Screen.__init__(self, session)
42                 
43                 self.scanList = scanList
44                 
45                 self.session.nav.stopService()
46                 
47                 self["scan_progress"] = ProgressBar()
48                 self["scan_state"] = Label(_("scan state"))
49                 self["network"] = Label()
50                 self["transponder"] = Label()
51
52                 self["pass"] = Label("")
53                 self["servicelist"] = FIFOList(len=10)
54                 self["FrontendInfo"] = FrontendInfo()
55                 
56                 self["actions"] = ActionMap(["OkCancelActions"], 
57                         {
58                                 "ok": self.ok,
59                                 "cancel": self.cancel
60                         })
61                         
62                 self.onFirstExecBegin.append(self.doServiceScan)
63
64         def doServiceScan(self):
65                 self["scan"] = CScan(self["scan_progress"], self["scan_state"], self["servicelist"], self["pass"], self.scanList, self["network"], self["transponder"], self["FrontendInfo"], self.session.summary)
66
67         def createSummary(self):
68                 print "ServiceScanCreateSummary"
69                 return ServiceScanSummary