1 from enigma import eDVBDB
2 from Screen import Screen
3 from Components.SystemInfo import SystemInfo
4 from Components.ActionMap import ActionMap
5 from Components.ConfigList import ConfigListScreen
6 from Components.MenuList import MenuList
7 from Components.NimManager import nimmanager
8 from Components.config import getConfigListEntry, config, ConfigNothing, ConfigSelection, updateConfigElement,\
10 from Components.Sources.List import List
11 from Screens.MessageBox import MessageBox
12 from Screens.ChoiceBox import ChoiceBox
13 from Screens.ServiceStopScreen import ServiceStopScreen
15 from time import mktime, localtime
16 from datetime import datetime
18 class NimSetup(Screen, ConfigListScreen, ServiceStopScreen):
19 def createSimpleSetup(self, list, mode):
22 list.append(getConfigListEntry(_("Satellite"), nim.diseqcA))
23 list.append(getConfigListEntry(_("Send DiSEqC"), nim.simpleSingleSendDiSEqC))
25 list.append(getConfigListEntry(_("Port A"), nim.diseqcA))
27 if mode in ("toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"):
28 list.append(getConfigListEntry(_("Port B"), nim.diseqcB))
29 if mode == "diseqc_a_b_c_d":
30 list.append(getConfigListEntry(_("Port C"), nim.diseqcC))
31 list.append(getConfigListEntry(_("Port D"), nim.diseqcD))
32 if mode != "toneburst_a_b":
33 list.append(getConfigListEntry(_("Set Voltage and 22KHz"), nim.simpleDiSEqCSetVoltageTone))
34 list.append(getConfigListEntry(_("Send DiSEqC only on satellite change"), nim.simpleDiSEqCOnlyOnSatChange))
36 def createPositionerSetup(self, list):
38 list.append(getConfigListEntry(_("Longitude"), nim.longitude))
39 list.append(getConfigListEntry(" ", nim.longitudeOrientation))
40 list.append(getConfigListEntry(_("Latitude"), nim.latitude))
41 list.append(getConfigListEntry(" ", nim.latitudeOrientation))
42 if SystemInfo["CanMeasureFrontendInputPower"]:
43 self.advancedPowerMeasurement = getConfigListEntry(_("Use Power Measurement"), nim.powerMeasurement)
44 list.append(self.advancedPowerMeasurement)
45 if nim.powerMeasurement.value:
46 list.append(getConfigListEntry(_("Power threshold in mA"), nim.powerThreshold))
47 self.turningSpeed = getConfigListEntry(_("Rotor turning speed"), nim.turningSpeed)
48 list.append(self.turningSpeed)
49 if nim.turningSpeed.value == "fast epoch":
50 self.turnFastEpochBegin = getConfigListEntry(_("Begin time"), nim.fastTurningBegin)
51 self.turnFastEpochEnd = getConfigListEntry(_("End time"), nim.fastTurningEnd)
52 list.append(self.turnFastEpochBegin)
53 list.append(self.turnFastEpochEnd)
55 if nim.powerMeasurement.value:
56 nim.powerMeasurement.value = False
57 nim.powerMeasurement.save()
59 def createConfigMode(self):
60 if self.nim.isCompatible("DVB-S"):
61 choices = { "nothing": _("nothing connected"),
62 "simple": _("simple"),
63 "advanced": _("advanced")}
64 #if len(nimmanager.getNimListOfType(nimmanager.getNimType(self.slotid), exception = x)) > 0:
65 # choices["equal"] = _("equal to")
66 # choices["satposdepends"] = _("second cable of motorized LNB")
67 if len(nimmanager.canEqualTo(self.slotid)) > 0:
68 choices["equal"] = _("equal to")
69 if len(nimmanager.canDependOn(self.slotid)) > 0:
70 choices["satposdepends"] = _("second cable of motorized LNB")
71 if len(nimmanager.canConnectTo(self.slotid)) > 0:
72 choices["loopthrough"] = _("loopthrough to")
73 self.nimConfig.configMode.setChoices(choices, default = "nothing")
75 def createSetup(self):
76 print "Creating setup"
80 self.configMode = None
81 self.diseqcModeEntry = None
82 self.advancedSatsEntry = None
83 self.advancedLnbsEntry = None
84 self.advancedDiseqcMode = None
85 self.advancedUsalsEntry = None
86 self.advancedLof = None
87 self.advancedPowerMeasurement = None
88 self.turningSpeed = None
89 self.turnFastEpochBegin = None
90 self.turnFastEpochEnd = None
91 self.uncommittedDiseqcCommand = None
92 self.cableScanType = None
93 self.have_advanced = False
94 self.advancedUnicable = None
95 self.advancedType = None
96 self.advancedManufacturer = None
97 self.advancedSCR = None
99 if self.nim.isMultiType():
100 multiType = self.nimConfig.multiType
101 self.multiType = getConfigListEntry(_("Tuner type"), multiType)
102 self.list.append(self.multiType)
104 if self.nim.isCompatible("DVB-S"):
105 self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode)
106 self.list.append(self.configMode)
108 if self.nimConfig.configMode.value == "simple": #simple setup
109 self.diseqcModeEntry = getConfigListEntry(_("Mode"), self.nimConfig.diseqcMode)
110 self.list.append(self.diseqcModeEntry)
111 if self.nimConfig.diseqcMode.value in ("single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"):
112 self.createSimpleSetup(self.list, self.nimConfig.diseqcMode.value)
113 if self.nimConfig.diseqcMode.value == "positioner":
114 self.createPositionerSetup(self.list)
115 elif self.nimConfig.configMode.value == "equal":
117 nimlist = nimmanager.canEqualTo(self.nim.slot)
119 #choices.append((str(id), str(chr(65 + id))))
120 choices.append((str(id), nimmanager.getNimDescription(id)))
121 self.nimConfig.connectedTo.setChoices(choices)
122 #self.nimConfig.connectedTo = updateConfigElement(self.nimConfig.connectedTo, ConfigSelection(choices = choices))
123 self.list.append(getConfigListEntry(_("Tuner"), self.nimConfig.connectedTo))
124 elif self.nimConfig.configMode.value == "satposdepends":
126 nimlist = nimmanager.canDependOn(self.nim.slot)
128 #choices.append((str(id), str(chr(65 + id))))
129 choices.append((str(id), nimmanager.getNimDescription(id)))
130 self.nimConfig.connectedTo.setChoices(choices)
131 #self.nimConfig.connectedTo = updateConfigElement(self.nimConfig.connectedTo, ConfigSelection(choices = choices))
132 self.list.append(getConfigListEntry(_("Tuner"), self.nimConfig.connectedTo))
133 elif self.nimConfig.configMode.value == "loopthrough":
135 print "connectable to:", nimmanager.canConnectTo(self.slotid)
136 connectable = nimmanager.canConnectTo(self.slotid)
137 for id in connectable:
138 choices.append((str(id), nimmanager.getNimDescription(id)))
139 self.nimConfig.connectedTo.setChoices(choices)
140 #self.nimConfig.connectedTo = updateConfigElement(self.nimConfig.connectedTo, ConfigSelection(choices = choices))
141 self.list.append(getConfigListEntry(_("Connected to"), self.nimConfig.connectedTo))
142 elif self.nimConfig.configMode.value == "nothing":
144 elif self.nimConfig.configMode.value == "advanced": # advanced
146 self.advancedSatsEntry = getConfigListEntry(_("Satellite"), self.nimConfig.advanced.sats)
147 self.list.append(self.advancedSatsEntry)
148 cur_orb_pos = self.nimConfig.advanced.sats.orbital_position
149 satlist = self.nimConfig.advanced.sat.keys()
150 if cur_orb_pos is not None:
151 if cur_orb_pos not in satlist:
152 cur_orb_pos = satlist[0]
153 currSat = self.nimConfig.advanced.sat[cur_orb_pos]
154 self.fillListWithAdvancedSatEntrys(currSat)
155 self.have_advanced = True
156 if self.nim.description == "Alps BSBE2" and config.usage.setup_level.index >= 2: # expert
157 self.list.append(getConfigListEntry(_("Tone Amplitude"), self.nimConfig.toneAmplitude))
158 elif self.nim.isCompatible("DVB-C"):
159 self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode)
160 self.list.append(self.configMode)
161 if self.nimConfig.configMode.value == "enabled":
162 self.cableScanType=getConfigListEntry(_("Used service scan type"), self.nimConfig.cable.scan_type)
163 self.list.append(self.cableScanType)
164 if self.nimConfig.cable.scan_type.value == "provider":
165 self.list.append(getConfigListEntry(_("Provider to scan"), self.nimConfig.cable.scan_provider))
167 if self.nimConfig.cable.scan_type.value == "bands":
168 self.list.append(getConfigListEntry(_("Scan band EU VHF I"), self.nimConfig.cable.scan_band_EU_VHF_I))
169 self.list.append(getConfigListEntry(_("Scan band EU MID"), self.nimConfig.cable.scan_band_EU_MID))
170 self.list.append(getConfigListEntry(_("Scan band EU VHF III"), self.nimConfig.cable.scan_band_EU_VHF_III))
171 self.list.append(getConfigListEntry(_("Scan band EU UHF IV"), self.nimConfig.cable.scan_band_EU_UHF_IV))
172 self.list.append(getConfigListEntry(_("Scan band EU UHF V"), self.nimConfig.cable.scan_band_EU_UHF_V))
173 self.list.append(getConfigListEntry(_("Scan band EU SUPER"), self.nimConfig.cable.scan_band_EU_SUPER))
174 self.list.append(getConfigListEntry(_("Scan band EU HYPER"), self.nimConfig.cable.scan_band_EU_HYPER))
175 self.list.append(getConfigListEntry(_("Scan band US LOW"), self.nimConfig.cable.scan_band_US_LOW))
176 self.list.append(getConfigListEntry(_("Scan band US MID"), self.nimConfig.cable.scan_band_US_MID))
177 self.list.append(getConfigListEntry(_("Scan band US HIGH"), self.nimConfig.cable.scan_band_US_HIGH))
178 self.list.append(getConfigListEntry(_("Scan band US SUPER"), self.nimConfig.cable.scan_band_US_SUPER))
179 self.list.append(getConfigListEntry(_("Scan band US HYPER"), self.nimConfig.cable.scan_band_US_HYPER))
180 elif self.nimConfig.cable.scan_type.value == "steps":
181 self.list.append(getConfigListEntry(_("Frequency scan step size(khz)"), self.nimConfig.cable.scan_frequency_steps))
182 self.list.append(getConfigListEntry(_("Scan QAM16"), self.nimConfig.cable.scan_mod_qam16))
183 self.list.append(getConfigListEntry(_("Scan QAM32"), self.nimConfig.cable.scan_mod_qam32))
184 self.list.append(getConfigListEntry(_("Scan QAM64"), self.nimConfig.cable.scan_mod_qam64))
185 self.list.append(getConfigListEntry(_("Scan QAM128"), self.nimConfig.cable.scan_mod_qam128))
186 self.list.append(getConfigListEntry(_("Scan QAM256"), self.nimConfig.cable.scan_mod_qam256))
187 self.list.append(getConfigListEntry(_("Scan SR6900"), self.nimConfig.cable.scan_sr_6900))
188 self.list.append(getConfigListEntry(_("Scan SR6875"), self.nimConfig.cable.scan_sr_6875))
189 self.list.append(getConfigListEntry(_("Scan additional SR"), self.nimConfig.cable.scan_sr_ext1))
190 self.list.append(getConfigListEntry(_("Scan additional SR"), self.nimConfig.cable.scan_sr_ext2))
191 self.have_advanced = False
192 elif self.nim.isCompatible("DVB-T"):
193 self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode)
194 self.list.append(self.configMode)
195 self.have_advanced = False
196 if self.nimConfig.configMode.value == "enabled":
197 self.list.append(getConfigListEntry(_("Terrestrial provider"), self.nimConfig.terrestrial))
198 self.list.append(getConfigListEntry(_("Enable 5V for active antenna"), self.nimConfig.terrestrial_5V))
200 self.have_advanced = False
201 self["config"].list = self.list
202 self["config"].l.setList(self.list)
205 checkList = (self.configMode, self.diseqcModeEntry, self.advancedSatsEntry, \
206 self.advancedLnbsEntry, self.advancedDiseqcMode, self.advancedUsalsEntry, \
207 self.advancedLof, self.advancedPowerMeasurement, self.turningSpeed, \
208 self.advancedType, self.advancedSCR, self.advancedManufacturer, self.advancedUnicable, \
209 self.uncommittedDiseqcCommand, self.cableScanType, self.multiType)
210 if self["config"].getCurrent() == self.multiType:
211 nimmanager.enumerateNIMs()
212 from Components.NimManager import InitNimManager
213 InitNimManager(nimmanager)
214 self.nim = nimmanager.nim_slots[self.slotid]
215 self.nimConfig = self.nim.config
217 if self["config"].getCurrent() == x:
222 if self.have_advanced and self.nim.config_mode == "advanced":
223 self.fillAdvancedList()
225 if x in (self.turnFastEpochBegin, self.turnFastEpochEnd):
226 # workaround for storing only hour*3600+min*60 value in configfile
227 # not really needed.. just for cosmetics..
228 tm = localtime(x[1].value)
229 dt = datetime(1970, 1, 1, tm.tm_hour, tm.tm_min)
230 x[1].value = int(mktime(dt.timetuple()))
232 nimmanager.sec.update()
235 def fillListWithAdvancedSatEntrys(self, Sat):
236 lnbnum = int(Sat.lnb.value)
237 currLnb = self.nimConfig.advanced.lnb[lnbnum]
239 if isinstance(currLnb, ConfigNothing):
243 self.advancedLnbsEntry = getConfigListEntry(_("LNB"), Sat.lnb)
244 self.list.append(self.advancedLnbsEntry)
247 self.list.append(getConfigListEntry(_("Priority"), currLnb.prio))
248 self.advancedLof = getConfigListEntry(_("LOF"), currLnb.lof)
249 self.list.append(self.advancedLof)
250 if currLnb.lof.value == "user_defined":
251 self.list.append(getConfigListEntry(_("LOF/L"), currLnb.lofl))
252 self.list.append(getConfigListEntry(_("LOF/H"), currLnb.lofh))
253 self.list.append(getConfigListEntry(_("Threshold"), currLnb.threshold))
254 # self.list.append(getConfigListEntry(_("12V Output"), currLnb.output_12v))
256 if currLnb.lof.value == "unicable":
257 self.advancedUnicable = getConfigListEntry("Unicable "+_("Configuration Mode"), currLnb.unicable)
258 self.list.append(self.advancedUnicable)
259 if currLnb.unicable.value == "unicable_user":
260 self.advancedSCR = getConfigListEntry(_("Channel"), currLnb.satcruser)
261 self.list.append(self.advancedSCR)
262 self.list.append(getConfigListEntry(_("Frequency"), currLnb.satcrvcouser[currLnb.satcruser.index]))
263 self.list.append(getConfigListEntry(_("LOF/L"), currLnb.lofl))
264 self.list.append(getConfigListEntry(_("LOF/H"), currLnb.lofh))
265 self.list.append(getConfigListEntry(_("Threshold"), currLnb.threshold))
266 elif currLnb.unicable.value == "unicable_matrix":
267 manufacturer_name = currLnb.unicableMatrixManufacturer.value
268 manufacturer = currLnb.unicableMatrix[manufacturer_name]
269 product_name = manufacturer.product.value
270 self.advancedManufacturer = getConfigListEntry(_("Manufacturer"), currLnb.unicableMatrixManufacturer)
271 self.advancedType = getConfigListEntry(_("Type"), manufacturer.product)
272 self.advancedSCR = getConfigListEntry(_("Channel"), manufacturer.scr[product_name])
273 self.list.append(self.advancedManufacturer)
274 self.list.append(self.advancedType)
275 self.list.append(self.advancedSCR)
276 self.list.append(getConfigListEntry(_("Frequency"), manufacturer.vco[product_name][manufacturer.scr[product_name].index]))
277 elif currLnb.unicable.value == "unicable_lnb":
278 manufacturer_name = currLnb.unicableLnbManufacturer.value
279 manufacturer = currLnb.unicableLnb[manufacturer_name]
280 product_name = manufacturer.product.value
281 self.advancedManufacturer = getConfigListEntry(_("Manufacturer"), currLnb.unicableLnbManufacturer)
282 self.advancedType = getConfigListEntry(_("Type"), manufacturer.product)
283 self.advancedSCR = getConfigListEntry(_("Channel"), manufacturer.scr[product_name])
284 self.list.append(self.advancedManufacturer)
285 self.list.append(self.advancedType)
286 self.list.append(self.advancedSCR)
287 self.list.append(getConfigListEntry(_("Frequency"), manufacturer.vco[product_name][manufacturer.scr[product_name].index]))
289 self.list.append(getConfigListEntry(_("Voltage mode"), Sat.voltage))
290 self.list.append(getConfigListEntry(_("Increased voltage"), currLnb.increased_voltage))
291 self.list.append(getConfigListEntry(_("Tone mode"), Sat.tonemode))
294 self.advancedDiseqcMode = getConfigListEntry(_("DiSEqC mode"), currLnb.diseqcMode)
295 self.list.append(self.advancedDiseqcMode)
296 if currLnb.diseqcMode.value != "none":
297 self.list.append(getConfigListEntry(_("Toneburst"), currLnb.toneburst))
298 self.list.append(getConfigListEntry(_("Committed DiSEqC command"), currLnb.commitedDiseqcCommand))
299 self.list.append(getConfigListEntry(_("Fast DiSEqC"), currLnb.fastDiseqc))
300 self.list.append(getConfigListEntry(_("Sequence repeat"), currLnb.sequenceRepeat))
301 if currLnb.diseqcMode.value == "1_0":
302 self.list.append(getConfigListEntry(_("Command order"), currLnb.commandOrder1_0))
304 if currLnb.uncommittedDiseqcCommand.index:
305 if currLnb.commandOrder.value == "ct":
306 currLnb.commandOrder.value = "cut"
307 elif currLnb.commandOrder.value == "tc":
308 currLnb.commandOrder.value = "tcu"
310 if currLnb.commandOrder.index & 1:
311 currLnb.commandOrder.value = "tc"
313 currLnb.commandOrder.value = "ct"
314 self.list.append(getConfigListEntry(_("Command order"), currLnb.commandOrder))
315 self.uncommittedDiseqcCommand = getConfigListEntry(_("Uncommitted DiSEqC command"), currLnb.uncommittedDiseqcCommand)
316 self.list.append(self.uncommittedDiseqcCommand)
317 self.list.append(getConfigListEntry(_("DiSEqC repeats"), currLnb.diseqcRepeats))
318 if currLnb.diseqcMode.value == "1_2":
319 self.list.append(getConfigListEntry(_("Longitude"), currLnb.longitude))
320 self.list.append(getConfigListEntry(" ", currLnb.longitudeOrientation))
321 self.list.append(getConfigListEntry(_("Latitude"), currLnb.latitude))
322 self.list.append(getConfigListEntry(" ", currLnb.latitudeOrientation))
323 if SystemInfo["CanMeasureFrontendInputPower"]:
324 self.advancedPowerMeasurement = getConfigListEntry(_("Use Power Measurement"), currLnb.powerMeasurement)
325 self.list.append(self.advancedPowerMeasurement)
326 if currLnb.powerMeasurement.value:
327 self.list.append(getConfigListEntry(_("Power threshold in mA"), currLnb.powerThreshold))
328 self.turningSpeed = getConfigListEntry(_("Rotor turning speed"), currLnb.turningSpeed)
329 self.list.append(self.turningSpeed)
330 if currLnb.turningSpeed.value == "fast epoch":
331 self.turnFastEpochBegin = getConfigListEntry(_("Begin time"), currLnb.fastTurningBegin)
332 self.turnFastEpochEnd = getConfigListEntry(_("End time"), currLnb.fastTurningEnd)
333 self.list.append(self.turnFastEpochBegin)
334 self.list.append(self.turnFastEpochEnd)
336 if currLnb.powerMeasurement.value:
337 currLnb.powerMeasurement.value = False
338 currLnb.powerMeasurement.save()
339 self.advancedUsalsEntry = getConfigListEntry(_("Use usals for this sat"), Sat.usals)
340 self.list.append(self.advancedUsalsEntry)
341 if not Sat.usals.value:
342 self.list.append(getConfigListEntry(_("Stored position"), Sat.rotorposition))
346 def fillAdvancedList(self):
348 self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode)
349 self.list.append(self.configMode)
350 self.advancedSatsEntry = getConfigListEntry(_("Satellite"), self.nimConfig.advanced.sats)
351 self.list.append(self.advancedSatsEntry)
352 for x in self.nimConfig.advanced.sat.keys():
353 Sat = self.nimConfig.advanced.sat[x]
354 self.fillListWithAdvancedSatEntrys(Sat)
355 self["config"].list = self.list
358 old_configured_sats = nimmanager.getConfiguredSats()
360 new_configured_sats = nimmanager.getConfiguredSats()
361 self.unconfed_sats = old_configured_sats - new_configured_sats
362 self.satpos_to_remove = None
363 self.restoreService(_("Zap back to service before tuner setup?"))
364 self.deleteConfirmed((None, "no"))
366 def deleteConfirmed(self, confirmed):
367 if confirmed[1] == "yes" or confirmed[1] == "yestoall":
368 eDVBDB.getInstance().removeServices(-1, -1, -1, self.satpos_to_remove)
370 if self.satpos_to_remove is not None:
371 self.unconfed_sats.remove(self.satpos_to_remove)
373 self.satpos_to_remove = None
374 for orbpos in self.unconfed_sats:
375 self.satpos_to_remove = orbpos
376 orbpos = self.satpos_to_remove
378 # why we need this cast?
379 sat_name = str(nimmanager.getSatDescription(orbpos))
381 if orbpos > 1800: # west
382 orbpos = 3600 - orbpos
386 sat_name = ("%d.%d" + h) % (orbpos / 10, orbpos % 10)
388 if confirmed[1] == "yes" or confirmed[1] == "no":
389 self.session.openWithCallback(self.deleteConfirmed, ChoiceBox, _("Delete no more configured satellite\n%s?") %(sat_name), [(_("Yes"), "yes"), (_("No"), "no"), (_("Yes to all"), "yestoall"), (_("No to all"), "notoall")])
390 if confirmed[1] == "yestoall" or confirmed[1] == "notoall":
391 self.deleteConfirmed(confirmed)
394 def __init__(self, session, slotid):
395 Screen.__init__(self, session)
398 ServiceStopScreen.__init__(self)
401 ConfigListScreen.__init__(self, self.list)
403 self["actions"] = ActionMap(["SetupActions", "SatlistShortcutAction"],
406 "cancel": self.keyCancel,
407 "nothingconnected": self.nothingConnectedShortcut
411 self.nim = nimmanager.nim_slots[slotid]
412 self.nimConfig = self.nim.config
413 self.createConfigMode()
417 ConfigListScreen.keyLeft(self)
421 ConfigListScreen.keyRight(self)
425 if self["config"].isChanged():
426 self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"))
428 self.restoreService(_("Zap back to service before tuner setup?"))
431 if self.nim.isCompatible("DVB-S"):
432 # reset connectedTo to all choices to properly store the default value
434 nimlist = nimmanager.getNimListOfType("DVB-S", self.slotid)
436 choices.append((str(id), nimmanager.getNimDescription(id)))
437 self.nimConfig.connectedTo.setChoices(choices)
438 for x in self["config"].list:
441 def cancelConfirm(self, result):
445 for x in self["config"].list:
447 # we need to call saveAll to reset the connectedTo choices
449 self.restoreService(_("Zap back to service before tuner setup?"))
451 def nothingConnectedShortcut(self):
452 if type(self["config"].getCurrent()[1]) is ConfigSatlist:
453 self["config"].getCurrent()[1].setValue("3601")
454 self["config"].invalidateCurrent()
456 class NimSelection(Screen):
457 def __init__(self, session):
458 Screen.__init__(self, session)
460 self.list = [None] * nimmanager.getSlotCount()
461 self["nimlist"] = List(self.list)
464 self.setResultClass()
466 self["actions"] = ActionMap(["OkCancelActions"],
468 "ok": self.okbuttonClick ,
472 def setResultClass(self):
473 self.resultclass = NimSetup
475 def okbuttonClick(self):
476 nim = self["nimlist"].getCurrent()
478 if nim is not None and not nim.empty:
479 self.session.openWithCallback(self.updateList, self.resultclass, nim.slot)
481 def showNim(self, nim):
484 def updateList(self):
486 for x in nimmanager.nim_slots:
488 nimConfig = nimmanager.getNimConfig(x.slot)
489 text = nimConfig.configMode.value
491 if x.isCompatible("DVB-S"):
492 if nimConfig.configMode.value in ("loopthrough", "equal", "satposdepends"):
493 text = { "loopthrough": _("loopthrough to"),
494 "equal": _("equal to"),
495 "satposdepends": _("second cable of motorized LNB") } [nimConfig.configMode.value]
496 text += " " + _("Tuner") + " " + ["A", "B", "C", "D"][int(nimConfig.connectedTo.value)]
497 elif nimConfig.configMode.value == "nothing":
498 text = _("nothing connected")
499 elif nimConfig.configMode.value == "simple":
500 if nimConfig.diseqcMode.value in ("single", "toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"):
501 text = {"single": _("Single"), "toneburst_a_b": _("Toneburst A/B"), "diseqc_a_b": _("DiSEqC A/B"), "diseqc_a_b_c_d": _("DiSEqC A/B/C/D")}[nimConfig.diseqcMode.value] + "\n"
502 text += _("Sats") + ": "
504 if nimConfig.diseqcA.orbital_position != 3601:
505 satnames.append(nimmanager.getSatName(int(nimConfig.diseqcA.value)))
506 if nimConfig.diseqcMode.value in ("toneburst_a_b", "diseqc_a_b", "diseqc_a_b_c_d"):
507 if nimConfig.diseqcB.orbital_position != 3601:
508 satnames.append(nimmanager.getSatName(int(nimConfig.diseqcB.value)))
509 if nimConfig.diseqcMode.value == "diseqc_a_b_c_d":
510 if nimConfig.diseqcC.orbital_position != 3601:
511 satnames.append(nimmanager.getSatName(int(nimConfig.diseqcC.value)))
512 if nimConfig.diseqcD.orbital_position != 3601:
513 satnames.append(nimmanager.getSatName(int(nimConfig.diseqcD.value)))
514 if len(satnames) <= 2:
515 text += ", ".join(satnames)
516 elif len(satnames) > 2:
517 # we need a newline here, since multi content lists don't support automtic line wrapping
518 text += ", ".join(satnames[:2]) + ",\n"
519 text += " " + ", ".join(satnames[2:])
520 elif nimConfig.diseqcMode.value == "positioner":
521 text = _("Positioner") + ":"
522 if nimConfig.positionerMode.value == "usals":
524 elif nimConfig.positionerMode.value == "manual":
528 elif nimConfig.configMode.value == "advanced":
530 elif x.isCompatible("DVB-T") or x.isCompatible("DVB-C"):
531 if nimConfig.configMode.value == "nothing":
532 text = _("nothing connected")
533 elif nimConfig.configMode.value == "enabled":
536 text = _("Switchable tuner types:") + "(" + ','.join(x.getMultiTypeList().values()) + ")" + "\n" + text
538 self.list.append((slotid, x.friendly_full_description, text, x))
539 self["nimlist"].setList(self.list)
540 self["nimlist"].updateList(self.list)