diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-04-19 20:54:41 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-04-19 20:54:41 +0200 |
commit | 5645ae5a454b95245813c78ff2da541ec648441f (patch) | |
tree | aef7b4aebf11e9f10872b6fc314b2e45344be7e1 /pyload/config | |
parent | Spare code cosmetics (6) (diff) | |
parent | fix typo (diff) | |
download | pyload-5645ae5a454b95245813c78ff2da541ec648441f.tar.xz |
Merge pull request #9 from ardi69/0.4.10
sorted config in webui ("Activated" always on top)
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 a5be1444e..45fb1c8d0 100644 --- a/pyload/config/Parser.py +++ b/pyload/config/Parser.py @@ -142,7 +142,8 @@ class ConfigParser(object): if not listmode: conf[section][option] = {"desc": desc, "type": typ, - "value": value} + "value": value, + "idx": len(conf[section])} else: @@ -171,7 +172,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" @@ -208,7 +210,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 @@ -319,7 +321,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"] |