+ 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)
+ # remove nims, that have a conntectedTo reference on
+ for testnim in slots[:]:
+ for nim in self.getNimListOfType("DVB-S", slotid):
+ nimConfig = self.getNimConfig(nim)
+ if nimConfig.content.items.has_key("configMode") and nimConfig.configMode.value == "loopthrough" and int(nimConfig.connectedTo.value) == testnim:
+ slots.remove(testnim)
+ break
+ slots.sort()
+
+ return slots
+
+ def canEqualTo(self, slotid):
+ type = self.getNimType(slotid)
+ if type == "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 type == "DVB-S2":
+ type = "DVB-S"
+ nimList = self.getNimListOfType(type, slotid)
+ positionerList = []
+ for nim in nimList[:]:
+ mode = self.getNimConfig(nim)
+ nimHaveRotor = mode.configMode.value == "simple" and mode.diseqcMode.value == "positioner"
+ if not nimHaveRotor and mode.configMode.value == "advanced":
+ for x in range(3601, 3605):
+ lnb = int(mode.advanced.sat[x].lnb.value)
+ if lnb != 0:
+ nimHaveRotor = True
+ break
+ if not nimHaveRotor:
+ for sat in mode.advanced.sat.values():
+ lnb_num = int(sat.lnb.value)
+ diseqcmode = lnb_num and mode.advanced.lnb[lnb_num].diseqcMode.value or ""
+ if diseqcmode == "1_2":
+ nimHaveRotor = True
+ break
+ if nimHaveRotor:
+ 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
+