aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorRonny Strutz <ronny.strutz@multimedia-labs.de>2005-08-31 01:15:09 +0000
committerRonny Strutz <ronny.strutz@multimedia-labs.de>2005-08-31 01:15:09 +0000
commitbc7774d93d62c8c63ffc37af68df9f3b7b0c4c54 (patch)
tree274424b1e9795a971401f7f2f0bb44b04de17f0f /lib/python
parentf5c84f0897d9aeb7a82778610bca39f77da4fa6b (diff)
downloadenigma2-bc7774d93d62c8c63ffc37af68df9f3b7b0c4c54.tar.gz
enigma2-bc7774d93d62c8c63ffc37af68df9f3b7b0c4c54.zip
new save / cancel
some small fixes
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Components/config.py76
1 files changed, 49 insertions, 27 deletions
diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py
index 15119617..0d1489aa 100644
--- a/lib/python/Components/config.py
+++ b/lib/python/Components/config.py
@@ -2,30 +2,34 @@
class configBoolean:
def __init__(self, parent):
self.parent = parent
- self.val = parent.value
- self.vals = parent.vals
-
+
+ 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
+
+ def cancel(self):
+ print "cancel"
+
+ def save(self):
+ print "save"
+
def handleKey(self, key):
if key == 1:
- self.val = self.val - 1
+ self.parent.value = self.parent.value - 1
if key == 2:
- self.val = self.val + 1
-
- if self.val < 0:
- self.val = 0
+ self.parent.value = self.parent.value + 1
+
+ self.checkValues()
+
+ self.parent.change()
-# if self.val > 1:
-# self.val = 1
-
def __call__(self): #needed by configlist
+ self.checkValues()
- print len(self.vals)
- print self.val
-
- if(self.val > (len(self.vals) - 1)):
- self.val = len(self.vals) - 1
-
- return ("text",self.vals[self.val])
+ return ("text", self.parent.vals[self.parent.value])
class configValue:
def __init__(self, obj):
@@ -52,20 +56,32 @@ config = Config();
class ConfigSlider:
def __init__(self, parent):
self.parent = parent
- self.val = parent.value
+
+ def cancel(self):
+ print "slider - cancel"
+
+ def save(self):
+ print "slider - save"
+
+ def checkValues(self):
+ if self.parent.value < 0:
+ self.parent.value = 0
+
+ if self.parent.value > 10:
+ self.parent.value = 10
+
def handleKey(self, key):
if key == 1:
- self.val = self.val - 1
+ self.parent.value = self.parent.value - 1
if key == 2:
- self.val = self.val + 1
-
- if self.val < 0:
- self.val = 0
+ self.parent.value = self.parent.value + 1
+
+ self.checkValues()
+ self.parent.change()
- if self.val > 10:
- self.val = 10
def __call__(self): #needed by configlist
- return ("slider", self.val * 10)
+ self.checkValues()
+ return ("slider", self.parent.value * 10)
class ConfigSubsection:
def __init__(self):
@@ -76,9 +92,15 @@ class configElement:
self.configPath = configPath
# self.value = 0 #read from registry else use default
self.value = defaultValue #read from registry else use default
+ self.defaultValue = defaultValue
self.controlType = control
self.vals = vals
self.notifierList = [ ]
def addNotifier(self, notifier):
self.notifierList.append(notifier);
notifier(self);
+ def change(self):
+ for notifier in self.notifierList:
+ notifier(self)
+ def reload(self):
+ self.value = self.defaultValue #HACK :-)