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 | |
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
-rw-r--r-- | pyload/config/Parser.py | 11 | ||||
-rw-r--r-- | pyload/webui/app/json.py | 7 | ||||
-rw-r--r-- | pyload/webui/themes/Dark/tml/settings_item.html | 2 | ||||
-rw-r--r-- | pyload/webui/themes/Default/tml/settings_item.html | 2 | ||||
-rw-r--r-- | pyload/webui/themes/Flat/tml/settings_item.html | 2 | ||||
-rw-r--r-- | pyload/webui/themes/Next/tml/settings_item.html | 2 |
6 files changed, 15 insertions, 11 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"] diff --git a/pyload/webui/app/json.py b/pyload/webui/app/json.py index 12dce2484..0805e9f5b 100644 --- a/pyload/webui/app/json.py +++ b/pyload/webui/app/json.py @@ -202,7 +202,7 @@ def edit_package(): id = int(request.forms.get("pack_id")) data = {"name": request.forms.get("pack_name").decode("utf8", "ignore"), "folder": request.forms.get("pack_folder").decode("utf8", "ignore"), - "password": request.forms.get("pack_pws").decode("utf8", "ignore")} + "password": request.forms.get("pack_pws").decode("utf8", "ignore")} PYLOAD.setPackageData(id, data) return {"response": "success"} @@ -249,7 +249,8 @@ def load_config(category, section): option['value'] = decode(option['value']) - return render_to_response("settings_item.html", {"skey": section, "section": conf[section]}) + return render_to_response("settings_item.html", {"sorted_conf": lambda c: sorted(c.items(), key=lambda i: i[1]['idx'] if i[0] not in ("desc", "outline") else 0), + "skey": section, "section": conf[section]}) @route('/json/save_config/<category>', method='POST') @@ -299,7 +300,7 @@ def update_accounts(): elif action == "limitdl" and value.isdigit(): PYLOAD.updateAccount(plugin, user, options={"limitDL": [value]}) elif action == "delete": - deleted.append((plugin,user)) + deleted.append((plugin, user)) PYLOAD.removeAccount(plugin, user) diff --git a/pyload/webui/themes/Dark/tml/settings_item.html b/pyload/webui/themes/Dark/tml/settings_item.html index af24d6eaf..c7e60865e 100644 --- a/pyload/webui/themes/Dark/tml/settings_item.html +++ b/pyload/webui/themes/Dark/tml/settings_item.html @@ -2,7 +2,7 @@ {% if section.outline %} <tr><th colspan="2">{{ section.outline }}</th></tr> {% endif %} - {% for okey, option in section.iteritems() %} + {% for okey, option in sorted_conf(section) %} {% if okey not in ("desc","outline") %} <tr> <td><label for="{{skey}}|{{okey}}" diff --git a/pyload/webui/themes/Default/tml/settings_item.html b/pyload/webui/themes/Default/tml/settings_item.html index 6642d34b4..83a008619 100644 --- a/pyload/webui/themes/Default/tml/settings_item.html +++ b/pyload/webui/themes/Default/tml/settings_item.html @@ -2,7 +2,7 @@ {% if section.outline %} <tr><th colspan="2">{{ section.outline }}</th></tr> {% endif %} - {% for okey, option in section.iteritems() %} + {% for okey, option in sorted_conf(section) %} {% if okey not in ("desc", "outline") %} <tr> <td><label for="{{skey}}|{{okey}}" diff --git a/pyload/webui/themes/Flat/tml/settings_item.html b/pyload/webui/themes/Flat/tml/settings_item.html index 28de1a1a9..71c212304 100644 --- a/pyload/webui/themes/Flat/tml/settings_item.html +++ b/pyload/webui/themes/Flat/tml/settings_item.html @@ -2,7 +2,7 @@ {% if section.outline %} <tr><th colspan="2">{{ section.outline }}</th></tr> {% endif %} - {% for okey, option in section.iteritems() %} + {% for okey, option in sorted_conf(section) %} {% if okey not in ("desc","outline") %} <tr> <td><label for="{{skey}}|{{okey}}" diff --git a/pyload/webui/themes/Next/tml/settings_item.html b/pyload/webui/themes/Next/tml/settings_item.html index 4d07eddb4..72566950f 100644 --- a/pyload/webui/themes/Next/tml/settings_item.html +++ b/pyload/webui/themes/Next/tml/settings_item.html @@ -3,7 +3,7 @@ {% if section.outline %} <tr><th colspan="2">{{ section.outline }}</th></tr> {% endif %} - {% for okey, option in section.iteritems() %} + {% for okey, option in sorted_conf(section) %} {% if okey not in ("desc","outline") %} <tr> <td><label for="{{skey}}|{{okey}}" |