return True
return False
+ def getNimType(self, slotid):
+ return self.nim_slots[slotid].type
+
def getNimDescription(self, slotid):
return self.nim_slots[slotid].friendly_full_description
def hasOutputs(self, slotid):
return self.nim_slots[slotid].hasOutputs()
- def connectableTo(self, slotid):
+ def canConnectTo(self, slotid):
slots = []
if self.nim_slots[slotid].internallyConnectableTo() is not None:
slots.append(self.nim_slots[slotid].internallyConnectableTo())
for type in self.nim_slots[slotid].connectableTo():
for slot in self.getNimListOfType(type, exception = slotid):
- if self.hasOutputs(slot):
- slots.append(slot)
+ # FIXME we restrict loopthrough from dvb-s2 to dvb-s, because the c++ part can't handle it
+ if not (type == "DVB-S" and self.getNimType(slot)):
+ if self.hasOutputs(slot):
+ slots.append(slot)
slots.sort()
return slots
+ def canEqualTo(self, slotid):
+ type = self.getNimType(slotid)
+ if self.getNimConfig(slotid) == "DVB-S2":
+ type = "DVB-S"
+ nimList = self.getNimListOfType(type, slotid)
+ for nim in nimList[:]:
+ mode = self.getNimConfig(nim)
+ if mode.configMode.value == "loopthrough" or mode.configMode.value == "satposdepends":
+ nimList.remove(nim)
+ return nimList
+
+ def canDependOn(self, slotid):
+ type = self.getNimType(slotid)
+ if self.getNimConfig(slotid) == "DVB-S2":
+ type = "DVB-S"
+ nimList = self.getNimListOfType(type, slotid)
+ positionerList = []
+ for nim in nimList[:]:
+ mode = self.getNimConfig(nim)
+ if mode.configMode.value == "simple" and mode.diseqcMode.value == "positioner":
+ alreadyConnected = False
+ for testnim in nimList:
+ testmode = self.getNimConfig(testnim)
+ if testmode.configMode.value == "satposdepends" and int(testmode.connectedTo.value) == int(nim):
+ alreadyConnected = True
+ break
+ if not alreadyConnected:
+ positionerList.append(nim)
+ return positionerList
+
def getNimConfig(self, slotid):
return config.Nims[slotid]
x = slot.slot
nim = config.Nims[x]
- # HACK: currently, we can only looptrough to socket A
-
if slot.isCompatible("DVB-S"):
choices = { "nothing": _("nothing connected"),
"simple": _("simple"),
if len(nimmgr.getNimListOfType(slot.type, exception = x)) > 0:
choices["equal"] = _("equal to")
choices["satposdepends"] = _("second cable of motorized LNB")
- if len(nimmgr.connectableTo(x)) > 0:
+ if len(nimmgr.canConnectTo(x)) > 0:
choices["loopthrough"] = _("loopthrough to")
nim.configMode = ConfigSelection(choices = choices, default = "simple")
from Components.ActionMap import ActionMap
from Components.ConfigList import ConfigListScreen
from Components.MenuList import MenuList
-from Components.NimManager import nimmanager
+from Components.NimManager import nimmanager, InitNimManager
from Components.config import getConfigListEntry, config, ConfigNothing, ConfigSelection
from Screens.MessageBox import MessageBox
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 = ConfigSelection(choices = choices, default = "simple")
+
def createSetup(self):
print "Creating setup"
self.list = [ ]
self.createSimpleSetup(self.list, self.nimConfig.diseqcMode.value)
if self.nimConfig.diseqcMode.value == "positioner":
self.createPositionerSetup(self.list)
- elif self.nimConfig.configMode.value in ["satposdepends", "equal"]:
+ elif self.nimConfig.configMode.value == "equal":
choices = []
- if self.nim.type == "DVB-S2":
- nimlist = nimmanager.getNimListOfType("DVB-S", exception = self.nim.slot)
- else:
- nimlist = nimmanager.getNimListOfType(self.nim.type, exception = self.nim.slot)
+ 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 = 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.list.append(getConfigListEntry(_("Tuner"), self.nimConfig.connectedTo))
elif self.nimConfig.configMode.value == "loopthrough":
choices = []
- print "connectable to:", nimmanager.connectableTo(self.slotid)
- connectable = nimmanager.connectableTo(self.slotid)
+ 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 = ConfigSelection(choices = choices)
self.slotid = slotid
self.nim = nimmanager.nim_slots[slotid]
self.nimConfig = self.nim.config
+ self.createConfigMode()
self.createSetup()
def keyLeft(self):