from enigma import eDVBDB
from Screen import Screen
+from Components.SystemInfo import SystemInfo
from Components.ActionMap import ActionMap
from Components.ConfigList import ConfigListScreen
from Components.MenuList import MenuList
from Components.NimManager import nimmanager
-from Components.config import getConfigListEntry, config, ConfigNothing
+from Components.config import getConfigListEntry, config, ConfigNothing, ConfigSelection, updateConfigElement
from Screens.MessageBox import MessageBox
from time import mktime, localtime
list.append(getConfigListEntry(" ", nim.longitudeOrientation))
list.append(getConfigListEntry(_("Latitude"), nim.latitude))
list.append(getConfigListEntry(" ", nim.latitudeOrientation))
-
- self.advancedPowerMeasurement = getConfigListEntry(_("Use Power Measurement"), nim.powerMeasurement)
- list.append(self.advancedPowerMeasurement)
- if nim.powerMeasurement.value:
- list.append(getConfigListEntry(_("Power threshold in mA"), nim.powerThreshold))
- self.turningSpeed = getConfigListEntry(_("Rotor turning speed"), nim.turningSpeed)
- list.append(self.turningSpeed)
- if nim.turningSpeed.value == "fast epoch":
- self.turnFastEpochBegin = getConfigListEntry(_("Begin time"), nim.fastTurningBegin)
- self.turnFastEpochEnd = getConfigListEntry(_("End time"), nim.fastTurningEnd)
- list.append(self.turnFastEpochBegin)
- list.append(self.turnFastEpochEnd)
-
+ if SystemInfo["CanMeasureFrontendInputPower"]:
+ self.advancedPowerMeasurement = getConfigListEntry(_("Use Power Measurement"), nim.powerMeasurement)
+ list.append(self.advancedPowerMeasurement)
+ if nim.powerMeasurement.value:
+ list.append(getConfigListEntry(_("Power threshold in mA"), nim.powerThreshold))
+ self.turningSpeed = getConfigListEntry(_("Rotor turning speed"), nim.turningSpeed)
+ list.append(self.turningSpeed)
+ if nim.turningSpeed.value == "fast epoch":
+ self.turnFastEpochBegin = getConfigListEntry(_("Begin time"), nim.fastTurningBegin)
+ self.turnFastEpochEnd = getConfigListEntry(_("End time"), nim.fastTurningEnd)
+ list.append(self.turnFastEpochBegin)
+ list.append(self.turnFastEpochEnd)
+ else:
+ if nim.powerMeasurement.value:
+ nim.powerMeasurement.value = False
+ nim.powerMeasurement.save()
+
+ def createConfigMode(self):
+ choices = { "nothing": _("nothing connected"),
+ "simple": _("simple"),
+ "advanced": _("advanced")}
+ #if len(nimmanager.getNimListOfType(nimmanager.getNimType(self.slotid), exception = x)) > 0:
+ # choices["equal"] = _("equal to")
+ # choices["satposdepends"] = _("second cable of motorized LNB")
+ if len(nimmanager.canEqualTo(self.slotid)) > 0:
+ choices["equal"] = _("equal to")
+ if len(nimmanager.canDependOn(self.slotid)) > 0:
+ choices["satposdepends"] = _("second cable of motorized LNB")
+ if len(nimmanager.canConnectTo(self.slotid)) > 0:
+ choices["loopthrough"] = _("loopthrough to")
+ self.nimConfig.configMode.setChoices(choices)
+
def createSetup(self):
print "Creating setup"
self.list = [ ]
self.turnFastEpochEnd = None
self.uncommittedDiseqcCommand = None
self.cableScanType = None
+ self.have_advanced = False
if self.nim.isCompatible("DVB-S"):
self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode)
self.createSimpleSetup(self.list, self.nimConfig.diseqcMode.value)
if self.nimConfig.diseqcMode.value == "positioner":
self.createPositionerSetup(self.list)
- elif self.nimConfig.configMode.value in ["loopthrough", "satposdepends", "nothing", "equal"]:
+ elif self.nimConfig.configMode.value == "equal":
+ choices = []
+ nimlist = nimmanager.canEqualTo(self.nim.slot)
+ for id in nimlist:
+ #choices.append((str(id), str(chr(65 + id))))
+ choices.append((str(id), nimmanager.getNimDescription(id)))
+ self.nimConfig.connectedTo.setChoices(choices)
+ #self.nimConfig.connectedTo = updateConfigElement(self.nimConfig.connectedTo, ConfigSelection(choices = choices))
+ self.list.append(getConfigListEntry(_("Tuner"), self.nimConfig.connectedTo))
+ elif self.nimConfig.configMode.value == "satposdepends":
+ choices = []
+ nimlist = nimmanager.canDependOn(self.nim.slot)
+ for id in nimlist:
+ #choices.append((str(id), str(chr(65 + id))))
+ choices.append((str(id), nimmanager.getNimDescription(id)))
+ self.nimConfig.connectedTo.setChoices(choices)
+ #self.nimConfig.connectedTo = updateConfigElement(self.nimConfig.connectedTo, ConfigSelection(choices = choices))
+ self.list.append(getConfigListEntry(_("Tuner"), self.nimConfig.connectedTo))
+ elif self.nimConfig.configMode.value == "loopthrough":
+ choices = []
+ print "connectable to:", nimmanager.canConnectTo(self.slotid)
+ connectable = nimmanager.canConnectTo(self.slotid)
+ for id in connectable:
+ choices.append((str(id), nimmanager.getNimDescription(id)))
+ self.nimConfig.connectedTo.setChoices(choices)
+ #self.nimConfig.connectedTo = updateConfigElement(self.nimConfig.connectedTo, ConfigSelection(choices = choices))
+ self.list.append(getConfigListEntry(_("Connected to"), self.nimConfig.connectedTo))
+ elif self.nimConfig.configMode.value == "nothing":
pass
elif self.nimConfig.configMode.value == "advanced": # advanced
# SATs
self.list.append(self.advancedSatsEntry)
cur_orb_pos = self.nimConfig.advanced.sats.orbital_position
satlist = self.nimConfig.advanced.sat.keys()
- if cur_orb_pos not in satlist:
- cur_orb_pos = satlist[0]
- currSat = self.nimConfig.advanced.sat[cur_orb_pos]
- self.fillListWithAdvancedSatEntrys(currSat)
- self.have_advanced = True
+ if cur_orb_pos is not None:
+ if cur_orb_pos not in satlist:
+ cur_orb_pos = satlist[0]
+ currSat = self.nimConfig.advanced.sat[cur_orb_pos]
+ self.fillListWithAdvancedSatEntrys(currSat)
+ self.have_advanced = True
elif self.nim.isCompatible("DVB-C"):
self.configMode = getConfigListEntry(_("Configuration Mode"), self.nimConfig.configMode)
self.list.append(self.configMode)
self.list.append(getConfigListEntry(" ", currLnb.longitudeOrientation))
self.list.append(getConfigListEntry(_("Latitude"), currLnb.latitude))
self.list.append(getConfigListEntry(" ", currLnb.latitudeOrientation))
- self.advancedPowerMeasurement = getConfigListEntry(_("Use Power Measurement"), currLnb.powerMeasurement)
- self.list.append(self.advancedPowerMeasurement)
- if currLnb.powerMeasurement.value:
- self.list.append(getConfigListEntry(_("Power threshold in mA"), currLnb.powerThreshold))
- self.turningSpeed = getConfigListEntry(_("Rotor turning speed"), currLnb.turningSpeed)
- self.list.append(self.turningSpeed)
- if currLnb.turningSpeed.value == "fast epoch":
- self.turnFastEpochBegin = getConfigListEntry(_("Begin time"), currLnb.fastTurningBegin)
- self.turnFastEpochEnd = getConfigListEntry(_("End time"), currLnb.fastTurningEnd)
- self.list.append(self.turnFastEpochBegin)
- self.list.append(self.turnFastEpochEnd)
+ if SystemInfo["CanMeasureFrontendInputPower"]:
+ self.advancedPowerMeasurement = getConfigListEntry(_("Use Power Measurement"), currLnb.powerMeasurement)
+ self.list.append(self.advancedPowerMeasurement)
+ if currLnb.powerMeasurement.value:
+ self.list.append(getConfigListEntry(_("Power threshold in mA"), currLnb.powerThreshold))
+ self.turningSpeed = getConfigListEntry(_("Rotor turning speed"), currLnb.turningSpeed)
+ self.list.append(self.turningSpeed)
+ if currLnb.turningSpeed.value == "fast epoch":
+ self.turnFastEpochBegin = getConfigListEntry(_("Begin time"), currLnb.fastTurningBegin)
+ self.turnFastEpochEnd = getConfigListEntry(_("End time"), currLnb.fastTurningEnd)
+ self.list.append(self.turnFastEpochBegin)
+ self.list.append(self.turnFastEpochEnd)
+ else:
+ if currLnb.powerMeasurement.value:
+ currLnb.powerMeasurement.value = False
+ currLnb.powerMeasurement.save()
self.advancedLof = getConfigListEntry(_("LOF"), currLnb.lof)
self.list.append(self.advancedLof)
if currLnb.lof.value == "user_defined":
"cancel": self.keyCancel,
}, -2)
+ self.slotid = slotid
self.nim = nimmanager.nim_slots[slotid]
self.nimConfig = self.nim.config
+ self.createConfigMode()
self.createSetup()
+ # safeAll is needed, so that keyCancel works properly
+ ConfigListScreen.saveAll(self)
def keyLeft(self):
ConfigListScreen.keyLeft(self)
def keyRight(self):
ConfigListScreen.keyRight(self)
self.newConfig()
+
+ def saveAll(self):
+ if self.nim.isCompatible("DVB-S"):
+ # reset connectedTo to all choices to properly store the default value
+ choices = []
+ nimlist = nimmanager.getNimListOfType("DVB-S", self.slotid)
+ for id in nimlist:
+ choices.append((str(id), nimmanager.getNimDescription(id)))
+ self.nimConfig.connectedTo.setChoices(choices)
+ for x in self["config"].list:
+ x[1].save()
class NimSelection(Screen):
def __init__(self, session):