config.network = ConfigSubsection()
config.network.dhcp = configElement_nonSave("config.network.dhcp", configSelection, 1, ("no", "yes"))
- config.network.ip = configElement_nonSave("config.network.ip", configSequence, ip, (("."), (1,255)))
- config.network.netmask = configElement_nonSave("config.network.netmask", configSequence, [255,255,255,0], (("."), (1,255)))
- config.network.gateway = configElement_nonSave("config.network.gateway", configSequence, [192,168,1,3], (("."), (1,255)))
- config.network.dns = configElement_nonSave("config.network.dns", configSequence, [192,168,1,3], (("."), (1,255)))
- config.network.mac = configElement_nonSave("config.network.mac", configSequence, [00,11,22,33,44,55], ((":"), (1,255)))
+ config.network.ip = configElement_nonSave("config.network.ip", configSequence, ip, configsequencearg.get("IP"))
+ config.network.netmask = configElement_nonSave("config.network.netmask", configSequence, [255,255,255,0], configsequencearg.get("IP"))
+ config.network.gateway = configElement_nonSave("config.network.gateway", configSequence, [192,168,1,3], configsequencearg.get("IP"))
+ config.network.dns = configElement_nonSave("config.network.dns", configSequence, [192,168,1,3], configsequencearg.get("IP"))
+ config.network.mac = configElement_nonSave("config.network.mac", configSequence, [00,11,22,33,44,55], configsequencearg.get("MAC"))
iNetwork.loadNetworkConfig()
from config import ConfigSlider
from config import configSelection
from config import configSequence
+from config import configsequencearg
from config import configSatlist
+
import xml.dom.minidom
from xml.dom import EMPTY_NAMESPACE
from skin import elementsWithTag
config.Nims[x].diseqcB = configElement(cname + "diseqcB",configSatlist, 130, nimmgr.satList);
config.Nims[x].diseqcC = configElement(cname + "diseqcC",configSatlist, 0, nimmgr.satList);
config.Nims[x].diseqcD = configElement(cname + "diseqcD",configSatlist, 0, nimmgr.satList);
- config.Nims[x].longitude = configElement(cname + "longitude",configSequence, [0,0], (("."), (1,999)));
- config.Nims[x].latitude = configElement(cname + "latitude",configSequence, [0,0], (("."), (1,999)));
+ config.Nims[x].longitude = configElement(cname + "longitude",configSequence, [0,0], configsequencearg.get("FLOAT", [(1,90),(1,999)]));
+ config.Nims[x].latitude = configElement(cname + "latitude",configSequence, [0,0], configsequencearg.get("FLOAT", [(1,90),(1,999)]));
#perhaps the instance of the slot is more useful?
config.Nims[x].configMode.addNotifier(boundFunction(nimConfigModeChanged,x))
-from config import config
-from config import ConfigSubsection
-from config import configElement_nonSave
-from config import configSelection
-from config import configSequence
+from config import *
from Components.NimManager import nimmanager
def InitScanSetup():
config.scan.nims = configElement_nonSave("config.scan.nims", configSelection, 0, nimList)
# sat
- config.scan.sat.frequency = configElement_nonSave("config.scan.sat.frequency", configSequence, [12187], (("."), (10000,14000)))
+ config.scan.sat.frequency = configElement_nonSave("config.scan.sat.frequency", configSequence, [12187], configsequencearg.get("INTEGER", (10000, 14000)))
config.scan.sat.inversion = configElement_nonSave("config.scan.sat.inversion", configSelection, 0, ("off", "on"))
- config.scan.sat.symbolrate = configElement_nonSave("config.scan.sat.symbolrate", configSequence, [27500], (("."), (1,30000)))
+ config.scan.sat.symbolrate = configElement_nonSave("config.scan.sat.symbolrate", configSequence, [27500], configsequencearg.get("INTEGER", (1, 30000)))
config.scan.sat.polarzation = configElement_nonSave("config.scan.sat.polarzation", configSelection, 0, ("horizontal", "vertical"))
config.scan.sat.fec = configElement_nonSave("config.scan.sat.fec", configSelection, 0, ("Auto", "1/2", "2/3", "3/4", "4/5", "5/6", "7/8", "8/9"))
# cable
- config.scan.cab.frequency = configElement_nonSave("config.scan.cab.frequency", configSequence, [466], (("."), (10000,14000)))
+ config.scan.cab.frequency = configElement_nonSave("config.scan.cab.frequency", configSequence, [466], configsequencearg.get("INTEGER", (10000, 14000)))
config.scan.cab.inversion = configElement_nonSave("config.scan.cab.inversion", configSelection, 0, ("off", "on"))
config.scan.cab.modulation = configElement_nonSave("config.scan.cab.modulation", configSelection, 0, ("Auto", "16-QAM", "32-QAM", "64-QAM", "128-QAM", "256-QAM"))
config.scan.cab.fec = configElement_nonSave("config.scan.cab.fec", configSelection, 0, ("Auto", "1/2", "2/3", "3/4", "4/5", "5/6", "7/8", "8/9"))
- config.scan.cab.symbolrate = configElement_nonSave("config.scan.cab.symbolrate", configSequence, [6900], (("."), (1,30000)))
+ config.scan.cab.symbolrate = configElement_nonSave("config.scan.cab.symbolrate", configSequence, [6900], configsequencearg.get("INTEGER", (1, 30000)))
# terrestial
- config.scan.ter.frequency = configElement_nonSave("config.scan.ter.frequency", configSequence, [466], (("."), (10000,14000)))
+ config.scan.ter.frequency = configElement_nonSave("config.scan.ter.frequency", configSequence, [466], configsequencearg.get("INTEGER", (10000, 14000)))
config.scan.ter.inversion = configElement_nonSave("config.scan.ter.inversion", configSelection, 0, ("off", "on"))
config.scan.ter.bandwidth = configElement_nonSave("config.scan.ter.bandwidth", configSelection, 0, ("Auto", "6 MHz", "7MHz", "8MHz"))
config.scan.ter.fechigh = configElement_nonSave("config.scan.ter.fechigh", configSelection, 0, ("Auto", "1/2", "2/3", "3/4", "4/5", "5/6", "7/8", "8/9"))
self.checkValues()
#fixme
return ("text", str(self.parent.vals[self.parent.value][0]))
+
+class configSequenceArg:
+ def get(self, type, args = ()):
+ # configsequencearg.get ("IP")
+ if (type == "IP"):
+ return (("."), [(1,255),(1,255),(1,255),(1,255)])
+ # configsequencearg.get ("MAC")
+ if (type == "MAC"):
+ return ((":"), [(1,255),(1,255),(1,255),(1,255),(1,255),(1,255)])
+ # configsequencearg.get("INTEGER", (min, max)) => x with min <= x <= max
+ if (type == "INTEGER"):
+ return ((":"), [args])
+ # configsequencearg.get("FLOAT", [(min,max),(min1,max1)]) => x.y with min <= x <= max and min1 <= y <= max1
+ if (type == "FLOAT"):
+ return (("."), args)
+
+configsequencearg = configSequenceArg()
class configSequence:
def __init__(self, parent):
self.parent = parent
self.markedPos = 0
-
+ self.seperator = self.parent.vals[0]
+ self.valueBounds = self.parent.vals[1]
+
def checkValues(self):
- maxPos = len(self.parent.value) * len(self.parent.vals[1]) + len(self.parent.value)
+ maxPos = len(self.parent.value) * len(self.valueBounds) + len(self.parent.value)
if self.markedPos >= maxPos:
self.markedPos = maxPos - 1
if key >= config.key["0"] and key <= config.key["9"]:
number = 9 - config.key["9"] + key
# length of numberblock
- numberLen = len(str(self.parent.vals[1][1]))
+ numberLen = len(str(self.valueBounds[0][1]))
# position in the block
posinblock = self.markedPos % numberLen
# blocknumber
print "Positon: " + str(mPos)
for i in self.parent.value:
if len(value): #fixme no heading separator possible
- value += self.parent.vals[0]
+ value += self.seperator
if mPos >= len(value) - 1:
mPos += 1
- #diff = self.parent.vals[1] - len(str(i))
+ #diff = self.valueBounds - len(str(i))
#if diff > 0:
## if this helps?!
#value += " " * diff
- print (("%0" + str(len(str(self.parent.vals[1][1]))) + "d") % i)
- value += ("%0" + str(len(str(self.parent.vals[1][1]))) + "d") % i
+ print (("%0" + str(len(str(self.valueBounds[0][1]))) + "d") % i)
+ value += ("%0" + str(len(str(self.valueBounds[0][1]))) + "d") % i
# only mark cursor when we are selected
# (this code is heavily ink optimized!)