diff options
author | Armin <Armin@Armin-PC.diedering.lan> | 2015-04-19 20:18:32 +0200 |
---|---|---|
committer | Armin <Armin@Armin-PC.diedering.lan> | 2015-04-19 20:18:32 +0200 |
commit | cc2ab2fa795ac68a2842a3743d9e4edeb47b56bf (patch) | |
tree | 965c07203c30b70c533618b85c88c0ea0f6aab46 /pyload/config | |
parent | added: colred logs for webui to (currently only for theme "Next") (diff) | |
download | pyload-cc2ab2fa795ac68a2842a3743d9e4edeb47b56bf.tar.xz |
sorted config in webui ("Activated" is always the top option)
NOTE:
The options are sorted like in pyload.conf & plugin.conf
For sorting like plugins "__config" - array plugin.conf must be
recreated by simply delete the file
Diffstat (limited to 'pyload/config')
-rw-r--r-- | pyload/config/Parser.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/pyload/config/Parser.py b/pyload/config/Parser.py index b26af6202..1d76c0164 100644 --- a/pyload/config/Parser.py +++ b/pyload/config/Parser.py @@ -146,7 +146,8 @@ class ConfigParser(object): if not listmode: conf[section][option] = {"desc": desc, "type": typ, - "value": value} + "value": value, + "idx": len(conf[section])} else: @@ -175,7 +176,8 @@ class ConfigParser(object): if not listmode: conf[section][option] = {"desc": desc, "type": typ, - "value": value} + "value": value, + "idx": len(conf[section])} except Exception, e: print "Config Warning" @@ -213,7 +215,7 @@ class ConfigParser(object): for section in config.iterkeys(): f.write('\n%s - "%s":\n' % (section, config[section]['desc'])) - for option, data in config[section].iteritems(): + for option, data in sorted(config[section].items(), key=lambda i: i[1]['idx'] if i[0] not in ("desc", "outline") else 0): if option in ("desc", "outline"): continue @@ -324,7 +326,8 @@ class ConfigParser(object): conf[item[0]] = { "desc": item[2], "type": item[1], - "value": self.cast(item[1], item[3]) + "value": self.cast(item[1], item[3]), + "idx": len(conf) } values = [x[0] for x in config] + ["desc", "outline"] |