[FritzCall] Major UPD: make plugin Python2 and Python3 compatible (#30)
[enigma2-plugins.git] / webinterface / src / WebComponents / Sources / Settings.py
1 from Components.config import config
2 from Components.Sources.Source import Source
3
4 class Settings(Source):
5         def __init__(self, session):
6                 self.cmd = []
7                 self.session = session
8                 Source.__init__(self)
9
10         def handleCommand(self, cmd):
11                 self.cmd = cmd
12
13         def do_func(self):
14                 result = []
15                 self.pickle_this("config", config.saved_value, result)
16                 return result
17
18         def pickle_this(self, prefix, topickle, result):
19                 for (key, val) in topickle.items():
20                         name = prefix + "." + key
21                         if isinstance(val, dict):
22                                 self.pickle_this(name, val, result)
23                         elif isinstance(val, tuple):
24                                 result.append((name, val[0]))
25                         else:
26                                 result.append((name, val))
27
28         list = property(do_func)
29         lut = {"Name": 0
30                         , "Value": 1
31                         }