From cc2ab2fa795ac68a2842a3743d9e4edeb47b56bf Mon Sep 17 00:00:00 2001 From: Armin Date: Sun, 19 Apr 2015 20:18:32 +0200 Subject: 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 --- pyload/config/Parser.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'pyload/config') 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"] -- cgit v1.2.3