aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components
diff options
context:
space:
mode:
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>2005-10-12 22:22:50 +0000
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>2005-10-12 22:22:50 +0000
commit2b8587722d707e88dbc8d381a74c12c380c6db04 (patch)
tree22d21f69baa8d121ce7dd5fb2b1e2867a7b83bb2 /lib/python/Components
parent3e76780009c5934db28c37aae9c32d0bc5a495e2 (diff)
downloadenigma2-2b8587722d707e88dbc8d381a74c12c380c6db04.tar.gz
enigma2-2b8587722d707e88dbc8d381a74c12c380c6db04.zip
prepare better configSequence
Diffstat (limited to 'lib/python/Components')
-rw-r--r--lib/python/Components/Network.py10
-rw-r--r--lib/python/Components/NimManager.py6
-rw-r--r--lib/python/Components/ScanSetup.py16
-rw-r--r--lib/python/Components/config.py33
4 files changed, 41 insertions, 24 deletions
diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py
index cd82081b..60c98ea3 100644
--- a/lib/python/Components/Network.py
+++ b/lib/python/Components/Network.py
@@ -132,11 +132,11 @@ def InitNetwork():
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()
diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py
index bbce2d50..01ef4bf4 100644
--- a/lib/python/Components/NimManager.py
+++ b/lib/python/Components/NimManager.py
@@ -5,8 +5,10 @@ from config import ConfigSubsection
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
@@ -161,8 +163,8 @@ def InitNimManager(nimmgr):
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))
diff --git a/lib/python/Components/ScanSetup.py b/lib/python/Components/ScanSetup.py
index 6cdefe43..95e47671 100644
--- a/lib/python/Components/ScanSetup.py
+++ b/lib/python/Components/ScanSetup.py
@@ -1,8 +1,4 @@
-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():
@@ -18,21 +14,21 @@ 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"))
diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py
index 5a92f076..93479b66 100644
--- a/lib/python/Components/config.py
+++ b/lib/python/Components/config.py
@@ -111,14 +111,33 @@ class configSatlist:
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
@@ -142,7 +161,7 @@ class configSequence:
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
@@ -171,16 +190,16 @@ class configSequence:
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!)