git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
show how much services are found after the scan
[enigma2.git]
/
lib
/
python
/
Components
/
config.py
diff --git
a/lib/python/Components/config.py
b/lib/python/Components/config.py
index 3328a1685a4b494705161b978563330853c08675..3bbdde107af8f15d4ed8b19b5c6f91a1c266af3a 100644
(file)
--- a/
lib/python/Components/config.py
+++ b/
lib/python/Components/config.py
@@
-1,12
+1,13
@@
from time import *
from Tools.NumericalTextInput import *
from time import *
from Tools.NumericalTextInput import *
+from Tools.Directories import *
class configFile:
def __init__(self):
self.changed = 0
self.configElements = { }
try:
class configFile:
def __init__(self):
self.changed = 0
self.configElements = { }
try:
- self.file = open(
"config"
)
+ self.file = open(
resolveFilename(SCOPE_CONFIG, "config")
)
except IOError:
print "cannot open config file"
return
except IOError:
print "cannot open config file"
return
@@
-38,7
+39,7
@@
class configFile:
if self.changed == 0: #no changes, so no write to disk needed
return
if self.changed == 0: #no changes, so no write to disk needed
return
- fileHandle = open(
"config"
, "w")
+ fileHandle = open(
resolveFilename(SCOPE_CONFIG, "config")
, "w")
keys = self.configElements.keys()
keys.sort()
keys = self.configElements.keys()
keys.sort()
@@
-55,10
+56,9
@@
class configSelection:
def checkValues(self):
if self.parent.value < 0:
def checkValues(self):
if self.parent.value < 0:
- self.parent.value = 0
-
- if(self.parent.value >= (len(self.parent.vals) - 1)):
- self.parent.value = len(self.parent.vals) - 1
+ self.parent.value = len(self.parent.vals) - 1
+ elif(self.parent.value > (len(self.parent.vals) - 1)):
+ self.parent.value = 0
def cancel(self):
self.parent.reload()
def cancel(self):
self.parent.reload()
@@
-148,7
+148,7
@@
class configSequenceArg:
def get(self, type, args = ()):
# configsequencearg.get ("IP")
if (type == "IP"):
def get(self, type, args = ()):
# configsequencearg.get ("IP")
if (type == "IP"):
- return (("."), [(
1
,255),(0,255),(0,255),(0,255)], "")
+ return (("."), [(
0
,255),(0,255),(0,255),(0,255)], "")
# configsequencearg.get ("MAC")
if (type == "MAC"):
return ((":"), [(1,255),(1,255),(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)], "")
@@
-213,13
+213,26
@@
class configSequence:
self.markedPos += 1
if key >= config.key["0"] and key <= config.key["9"]:
self.markedPos += 1
if key >= config.key["0"] and key <= config.key["9"]:
+ self.blockLen = []
+ for x in self.valueBounds:
+ self.blockLen.append(len(str(x[1])))
+
+ pos = 0
+ blocknumber = 0
+ self.blockLenTotal = [0,]
+ for x in self.blockLen:
+ pos += self.blockLen[blocknumber]
+ self.blockLenTotal.append(pos)
+ if (pos - 1 >= self.markedPos):
+ pass
+ else:
+ blocknumber += 1
+
number = 9 - config.key["9"] + key
# length of numberblock
number = 9 - config.key["9"] + key
# length of numberblock
- numberLen = len(str(self.valueBounds[
0
][1]))
+ numberLen = len(str(self.valueBounds[
blocknumber
][1]))
# position in the block
# position in the block
- posinblock = self.markedPos % numberLen
- # blocknumber
- blocknumber = self.markedPos / numberLen
+ posinblock = self.markedPos - self.blockLenTotal[blocknumber]
oldvalue = self.parent.value[blocknumber]
olddec = oldvalue % 10 ** (numberLen - posinblock) - (oldvalue % 10 ** (numberLen - posinblock - 1))
oldvalue = self.parent.value[blocknumber]
olddec = oldvalue % 10 ** (numberLen - posinblock) - (oldvalue % 10 ** (numberLen - posinblock - 1))
@@
-261,8
+274,11
@@
class configSequence:
num += 1
# only mark cursor when we are selected
# (this code is heavily ink optimized!)
num += 1
# only mark cursor when we are selected
# (this code is heavily ink optimized!)
- return ("mtext"[1-selected:], value, [mPos])
-
+ if (self.parent.enabled == True):
+ return ("mtext"[1-selected:], value, [mPos])
+ else:
+ return ("text", value)
+
class configText:
# used as first parameter
# is the text of a fixed size or is the user able to extend the length of the text
class configText:
# used as first parameter
# is the text of a fixed size or is the user able to extend the length of the text
@@
-294,6
+310,8
@@
class configText:
def handleKey(self, key):
#this will no change anything on the value itself
#so we can handle it here in gui element
def handleKey(self, key):
#this will no change anything on the value itself
#so we can handle it here in gui element
+ if key == config.key["delete"]:
+ self.parent.value = self.parent.value[0:self.markedPos] + self.parent.value[self.markedPos + 1:]
if key == config.key["prevElement"]:
self.textInput.nextKey()
self.markedPos -= 1
if key == config.key["prevElement"]:
self.textInput.nextKey()
self.markedPos -= 1
@@
-330,6
+348,7
@@
class Config:
self.key = { "choseElement": 0,
"prevElement": 1,
"nextElement": 2,
self.key = { "choseElement": 0,
"prevElement": 1,
"nextElement": 2,
+ "delete": 3,
"0": 10,
"1": 11,
"2": 12,
"0": 10,
"1": 11,
"2": 12,