1 from Screen import Screen
2 from ServiceScan import *
3 from Components.config import *
4 from Components.ActionMap import NumberActionMap
5 from Components.ConfigList import ConfigList
6 from Components.config import config
7 from Components.config import getConfigListEntry
8 from Components.NimManager import nimmanager
9 from Components.Label import Label
11 class ScanSetup(Screen):
12 def __init__(self, session):
13 Screen.__init__(self, session)
19 self["actions"] = NumberActionMap(["SetupActions"],
22 "cancel": self.keyCancel,
24 "right": self.keyRight,
25 "1": self.keyNumberGlobal,
26 "2": self.keyNumberGlobal,
27 "3": self.keyNumberGlobal,
28 "4": self.keyNumberGlobal,
29 "5": self.keyNumberGlobal,
30 "6": self.keyNumberGlobal,
31 "7": self.keyNumberGlobal,
32 "8": self.keyNumberGlobal,
33 "9": self.keyNumberGlobal,
34 "0": self.keyNumberGlobal
38 self["config"] = ConfigList(self.list)
41 self["introduction"] = Label("Press OK to start the scan")
43 def updateSatList(self):
45 for slot in nimmanager.nimslots:
46 self.satList.append(nimmanager.getSatListForNim(slot.slotid))
48 def createSetup(self):
51 self.list.append(getConfigListEntry("Type of scan", config.scan.type))
52 self.list.append(getConfigListEntry("Tuner", config.scan.nims))
54 # single transponder scan
55 if (config.scan.type.value == 0):
56 if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-S"]):
57 self.list.append(getConfigListEntry("Frequency", config.scan.sat.frequency))
58 self.list.append(getConfigListEntry("Inversion", config.scan.sat.inversion))
59 self.list.append(getConfigListEntry("Symbolrate", config.scan.sat.symbolrate))
60 self.list.append(getConfigListEntry("Polarity", config.scan.sat.polarzation))
61 self.list.append(getConfigListEntry("FEC", config.scan.sat.fec))
62 if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-C"]):
63 self.list.append(getConfigListEntry("Frequency", config.scan.cab.frequency))
64 self.list.append(getConfigListEntry("Inversion", config.scan.cab.inversion))
65 self.list.append(getConfigListEntry("Symbolrate", config.scan.cab.symbolrate))
66 self.list.append(getConfigListEntry("Modulation", config.scan.cab.modulation))
67 self.list.append(getConfigListEntry("FEC", config.scan.cab.fec))
68 if (nimmanager.getNimType(config.scan.nims.value) == nimmanager.nimType["DVB-T"]):
69 self.list.append(getConfigListEntry("Frequency", config.scan.ter.frequency))
70 self.list.append(getConfigListEntry("Inversion", config.scan.ter.inversion))
71 self.list.append(getConfigListEntry("Bandwidth", config.scan.ter.bandwidth))
72 self.list.append(getConfigListEntry("Code rate high", config.scan.ter.fechigh))
73 self.list.append(getConfigListEntry("Code rate low", config.scan.ter.feclow))
74 self.list.append(getConfigListEntry("Modulation", config.scan.ter.modulation))
75 self.list.append(getConfigListEntry("Transmission mode", config.scan.ter.transmission))
76 self.list.append(getConfigListEntry("Guard interval mode", config.scan.ter.guard))
77 self.list.append(getConfigListEntry("Hierarchy mode", config.scan.ter.hierarchy))
79 # single satellite scan
80 print config.scan.satselection
81 if (config.scan.type.value == 1):
83 print config.scan.satselection[config.scan.nims.value]
84 self.list.append(getConfigListEntry("Satellite", config.scan.satselection[config.scan.nims.value]))
88 if (config.scan.type.value == 2):
89 for sat in nimmanager.satList:
90 self.list.append(getConfigListEntry(sat[0], config.scan.scansat[sat[1]]))
92 self["config"].list = self.list
93 self["config"].l.setList(self.list)
96 print self["config"].getCurrent()
97 if self["config"].getCurrent()[0] == "Type of scan":
99 if self["config"].getCurrent()[0] == "Tuner":
102 def createConfig(self):
103 config.scan = ConfigSubsection()
104 config.scan.sat = ConfigSubsection()
105 config.scan.cab = ConfigSubsection()
106 config.scan.ter = ConfigSubsection()
108 config.scan.type = configElement_nonSave("config.scan.type", configSelection, 0, ("Single transponder", "Single satellite", "Multisat"))
110 for nim in nimmanager.nimList():
111 nimList.append(nim[0])
112 nimList.append("all")
113 config.scan.nims = configElement_nonSave("config.scan.nims", configSelection, 0, nimList)
116 config.scan.sat.frequency = configElement_nonSave("config.scan.sat.frequency", configSequence, [12187], configsequencearg.get("INTEGER", (10000, 14000)))
117 config.scan.sat.inversion = configElement_nonSave("config.scan.sat.inversion", configSelection, 0, ("off", "on"))
118 config.scan.sat.symbolrate = configElement_nonSave("config.scan.sat.symbolrate", configSequence, [27500], configsequencearg.get("INTEGER", (1, 30000)))
119 config.scan.sat.polarzation = configElement_nonSave("config.scan.sat.polarzation", configSelection, 0, ("horizontal", "vertical"))
120 config.scan.sat.fec = configElement_nonSave("config.scan.sat.fec", configSelection, 0, ("Auto", "1/2", "2/3", "3/4", "4/5", "5/6", "7/8", "8/9"))
123 config.scan.cab.frequency = configElement_nonSave("config.scan.cab.frequency", configSequence, [466], configsequencearg.get("INTEGER", (10000, 14000)))
124 config.scan.cab.inversion = configElement_nonSave("config.scan.cab.inversion", configSelection, 0, ("off", "on"))
125 config.scan.cab.modulation = configElement_nonSave("config.scan.cab.modulation", configSelection, 0, ("Auto", "16-QAM", "32-QAM", "64-QAM", "128-QAM", "256-QAM"))
126 config.scan.cab.fec = configElement_nonSave("config.scan.cab.fec", configSelection, 0, ("Auto", "1/2", "2/3", "3/4", "4/5", "5/6", "7/8", "8/9"))
127 config.scan.cab.symbolrate = configElement_nonSave("config.scan.cab.symbolrate", configSequence, [6900], configsequencearg.get("INTEGER", (1, 30000)))
130 config.scan.ter.frequency = configElement_nonSave("config.scan.ter.frequency", configSequence, [466], configsequencearg.get("INTEGER", (10000, 14000)))
131 config.scan.ter.inversion = configElement_nonSave("config.scan.ter.inversion", configSelection, 0, ("off", "on"))
132 config.scan.ter.bandwidth = configElement_nonSave("config.scan.ter.bandwidth", configSelection, 0, ("Auto", "6 MHz", "7MHz", "8MHz"))
133 config.scan.ter.fechigh = configElement_nonSave("config.scan.ter.fechigh", configSelection, 0, ("Auto", "1/2", "2/3", "3/4", "4/5", "5/6", "7/8", "8/9"))
134 config.scan.ter.feclow = configElement_nonSave("config.scan.ter.feclow", configSelection, 0, ("Auto", "1/2", "2/3", "3/4", "4/5", "5/6", "7/8", "8/9"))
135 config.scan.ter.modulation = configElement_nonSave("config.scan.ter.modulation", configSelection, 0, ("Auto", "16-QAM", "32-QAM", "64-QAM", "128-QAM", "256-QAM"))
136 config.scan.ter.transmission = configElement_nonSave("config.scan.ter.transmission", configSelection, 0, ("Auto", "2K", "8K"))
137 config.scan.ter.guard = configElement_nonSave("config.scan.ter.guard", configSelection, 0, ("Auto", "1/4", "1/8", "1/16", "1/32"))
138 config.scan.ter.hierarchy = configElement_nonSave("config.scan.ter.hierarchy", configSelection, 0, ("Auto", "1", "2", "4"))
140 config.scan.scansat = {}
141 for sat in nimmanager.satList:
143 config.scan.scansat[sat[1]] = configElement_nonSave("config.scan.scansat[" + str(sat[1]) + "]", configSelection, 0, ("yes", "no"))
145 config.scan.satselection = []
147 for slot in nimmanager.nimslots:
148 config.scan.satselection.append(configElement_nonSave("config.scan.satselection[" + str(slot.slotid) + "]", configSatlist, 0, self.satList[slot.slotid]))
151 self["config"].handleKey(config.key["prevElement"])
155 self["config"].handleKey(config.key["nextElement"])
158 def keyNumberGlobal(self, number):
159 print "You pressed number " + str(number)
160 if (self["config"].getCurrent()[1].parent.enabled == True):
161 self["config"].handleKey(config.key[str(number)])
164 for x in self["config"].list:
166 self.session.openWithCallback(self.keyCancel, ServiceScan)
171 for x in self["config"].list:
175 class ScanSimple(Screen):
178 print "start scan for sats:"
180 if x[1].parent.value == 0:
181 print " " + str(x[1].parent.configPath)
187 self["config"].handleKey(config.key["prevElement"])
190 self["config"].handleKey(config.key["nextElement"])
192 def Satexists(self, tlist, pos):
198 def __init__(self, session):
199 Screen.__init__(self, session)
201 self["actions"] = ActionMap(["SetupActions"],
204 "cancel": self.keyCancel,
205 "left": self.keyLeft,
206 "right": self.keyRight,
212 SatList = nimmanager.getConfiguredSats()
215 if self.Satexists(tlist, x) == 0:
217 sat = configElement_nonSave(x, configSelection, 0, ("Enable", "Disable"))
218 self.list.append(getConfigListEntry(nimmanager.getSatDescription(x), sat))
220 self["config"] = ConfigList(self.list)
221 self["header"] = Label("Automatic Scan")
222 self["footer"] = Label("Press OK to scan")