from config import ConfigSubsection
from config import ConfigSlider
from config import configSelection
+from config import currentConfigSelectionElement
+from config import getConfigSelectionElement
from config import configSequence
from config import configsequencearg
from config import configSatlist
nim = config.Nims[x]
if slot.nimType == self.NimManager.nimType["DVB-S"]:
print "slot: " + str(x) + " configmode: " + str(nim.configMode.value)
- if nim.configMode.value == 2:
+ if currentConfigSelectionElement(nim.configMode) == "loopthrough":
self.linkNIMs(x, nim.linkedTo.value)
nim = config.Nims[nim.linkedTo.value]
- if nim.configMode.value == 0: #simple config
- if nim.diseqcMode.value == 0: #single
+ elif currentConfigSelectionElement(nim.configMode) == "simple": #simple config
+ if currentConfigSelectionElement(nim.diseqcMode) == "single": #single
self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = 0, diseqcmode = 0, diseqcpos = 4)
- elif nim.diseqcMode.value == 1: #Toneburst A/B
+ elif currentConfigSelectionElement(nim.diseqcMode) == "toneburst_a_b": #Toneburst A/B
self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = 1, diseqcmode = 0, diseqcpos = 4)
self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = 1, diseqcmode = 0, diseqcpos = 4)
- elif nim.diseqcMode.value == 2: #DiSEqC A/B
+ elif currentConfigSelectionElement(nim.diseqcMode) == "diseqc_a_b": #DiSEqC A/B
self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = 0, diseqcmode = 1, diseqcpos = 0)
self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = 0, diseqcmode = 1, diseqcpos = 1)
- elif nim.diseqcMode.value == 3: #DiSEqC A/B/C/D
+ elif currentConfigSelectionElement(nim.diseqcMode) == "diseqc_a_b_c_d": #DiSEqC A/B/C/D
self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcA.vals[nim.diseqcA.value][1]), toneburstmode = 0, diseqcmode = 1, diseqcpos = 0)
self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcB.vals[nim.diseqcB.value][1]), toneburstmode = 0, diseqcmode = 1, diseqcpos = 1)
self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcC.vals[nim.diseqcC.value][1]), toneburstmode = 0, diseqcmode = 1, diseqcpos = 2)
self.addLNBSimple(slotid = x, orbpos = int(nim.diseqcD.vals[nim.diseqcD.value][1]), toneburstmode = 0, diseqcmode = 1, diseqcpos = 3)
- elif nim.diseqcMode.value == 4: #Positioner
+ elif currentConfigSelectionElement(nim.diseqcMode) == "positioner": #Positioner
self.addLNBSimple(slotid = x, diseqcmode = 3, longitude = float(str(nim.longitude.value[0]) + "." + str(nim.longitude.value[1])), loDirection = nim.longitudeOrientation.value - 2, latitude = float(str(nim.latitude.value[0]) + "." + str(nim.latitude.value[1])), laDirection = nim.latitudeOrientation.value)
pass
+ elif currentConfigSelectionElement(nim.configMode) == "nothing":
+ pass
else: #advanced config
print "FIXME add support for advanced config"
nim = config.Nims[x]
if slot.nimType == nimmgr.nimType["DVB-S"]:
- nim.configMode = configElement(cname + "configMode", configSelection, 0, (("simple", _("Simple")), ("nothing", _("Nothing connected")), ("loopthrough", _("Loopthrough to Socket A")))) # "Advanced"));
+ nim.configMode = configElement(cname + "configMode", configSelection, 0, (("simple", _("Simple")), ("nothing", _("Nothing connected")), ("loopthrough", _("Loopthrough to Socket A")), ("advanced", _("Advanced")))) # "Advanced"));
#important - check if just the 2nd one is LT only and the first one is DVB-S
- if nim.configMode.value == 2: #linked
+ if currentConfigSelectionElement(nim.configMode) == "loopthrough": #linked
if x == 0: #first one can never be linked to anything
- nim.configMode.value = 0 #reset to simple
+ nim.configMode.value = getConfigSelectionElement(nim.configMode, "simple") #reset to simple
nim.configMode.save()
else:
#FIXME: make it better
for y in nimmgr.nimslots:
if y.slotid == 0:
if y.nimType != nimmgr.nimType["DVB-S"]:
- nim.configMode.value = 0 #reset to simple
+ nim.configMode.value = getConfigSelectionElement(nim.configMode, "simple") #reset to simple
nim.configMode.save()
nim.diseqcMode = configElement(cname + "diseqcMode", configSelection, 2, (("single", _("Single")), ("toneburst_a_b", _("Toneburst A/B")), ("diseqc_a_b", _("DiSEqC A/B")), ("diseqc_a_b_c_d", _("DiSEqC A/B/C/D")), ("positioner", _("Positioner"))));
def createPositionerSetup(self, nim, list):
list.append(getConfigListEntry(_("Positioner mode"), config.Nims[nim.slotid].positionerMode))
- if (config.Nims[nim.slotid].positionerMode.value == 0): # USALS
+ if (currentConfigSelectionElement(config.Nims[nim.slotid].positionerMode) == "usals"): # USALS
list.append(getConfigListEntry(_("Longitude"), config.Nims[nim.slotid].longitude))
list.append(getConfigListEntry("", config.Nims[nim.slotid].longitudeOrientation))
list.append(getConfigListEntry(_("Latitude"), config.Nims[nim.slotid].latitude))
list.append(getConfigListEntry("", config.Nims[nim.slotid].latitudeOrientation))
- elif (config.Nims[nim.slotid].positionerMode.value == 1): # manual
+ elif (currentConfigSelectionElement(config.Nims[nim.slotid].positionerMode) == "manual"): # manual
pass
def createSetup(self):
self.list = [ ]
+ self.diseqcModeEntry = None
if (nimmanager.getNimType(self.nim.slotid) == nimmanager.nimType["DVB-S"]):
self.configMode = getConfigListEntry(_("Configuration Mode"), config.Nims[self.nim.slotid].configMode)
self.list.append(self.configMode)
- if config.Nims[self.nim.slotid].configMode.value == 0: #simple setup
+ if currentConfigSelectionElement(config.Nims[self.nim.slotid].configMode) == "simple": #simple setup
self.diseqcModeEntry = getConfigListEntry(_("DiSEqC Mode"), config.Nims[self.nim.slotid].diseqcMode)
self.list.append(self.diseqcModeEntry)
self.createSimpleSetup(self.nim, self.list, config.Nims[self.nim.slotid].diseqcMode.value)
if (config.Nims[self.nim.slotid].diseqcMode.value == 4):
self.createPositionerSetup(self.nim, self.list)
- elif config.Nims[self.nim.slotid].configMode.value == 1: # nothing
+ elif currentConfigSelectionElement(config.Nims[self.nim.slotid].configMode) == "nothing": # nothing
#self.list.append(getConfigListEntry(_("Linked to"), config.Nims[self.nim.slotid].linkedTo))
pass
- elif config.Nims[self.nim.slotid].configMode.value == 2: # linked
+ elif currentConfigSelectionElement(config.Nims[self.nim.slotid].configMode) == "loopthrough": # linked
pass
elif (nimmanager.getNimType(self.nim.slotid) == nimmanager.nimType["DVB-C"]):
self["config"].l.setList(self.list)
def newConfig(self):
- if self["config"].getCurrent() == self.diseqcModeEntry:
- self.createSetup()
if self["config"].getCurrent() == self.configMode:
self.createSetup()
+ if self["config"].getCurrent() == self.diseqcModeEntry:
+ self.createSetup()
def keyLeft(self):
if self["config"].getCurrent() == self.configMode: