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 | |
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)
-rw-r--r-- | pyload/config/Parser.py | 11 | ||||
-rw-r--r-- | pyload/webui/app/json.py | 7 | ||||
-rw-r--r-- | pyload/webui/app/pyloadweb.py | 2 | ||||
-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/css/log.css | 16 | ||||
-rw-r--r-- | pyload/webui/themes/Next/tml/settings_item.html | 2 |
8 files changed, 24 insertions, 20 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"] diff --git a/pyload/webui/app/json.py b/pyload/webui/app/json.py index d4af40dee..30778f1f7 100644 --- a/pyload/webui/app/json.py +++ b/pyload/webui/app/json.py @@ -203,7 +203,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"} @@ -250,7 +250,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') @@ -300,7 +301,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/app/pyloadweb.py b/pyload/webui/app/pyloadweb.py index b3baed3eb..154409655 100644 --- a/pyload/webui/app/pyloadweb.py +++ b/pyload/webui/app/pyloadweb.py @@ -471,7 +471,7 @@ def logs(item=-1): 'reversed': reversed, 'perpage': perpage, 'perpage_p': sorted(perpage_p), 'iprev': 1 if item - perpage < 1 else item - perpage, 'inext': (item + perpage) if item + perpage < len(log) else item, - 'color_template': color_template}, + 'color_template': color_template.title()}, [pre_processor]) 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/css/log.css b/pyload/webui/themes/Next/css/log.css index 71ba01edb..30e026821 100644 --- a/pyload/webui/themes/Next/css/log.css +++ b/pyload/webui/themes/Next/css/log.css @@ -51,41 +51,41 @@ td.loglevel { text-align:right; } -td.mixedDEBUG, td.lineDEBUG, td.loglevellineDEBUG +td.MixedDEBUG, td.LineDEBUG, td.loglevelLineDEBUG { color: darkcyan; } -td.mixedWARNING, td.lineWARNING, td.loglevellineWARNING +td.MixedWARNING, td.LineWARNING, td.loglevelLineWARNING { color: #660; } -td.mixedERROR, td.lineERROR, td.loglevellineERROR +td.MixedERROR, td.LineERROR, td.loglevelLineERROR { color: red; } -td.mixedCRITICAL, td.lineCRITICAL, td.loglevellineCRITICAL +td.MixedCRITICAL, td.LineCRITICAL, td.loglevelLineCRITICAL { color: purple; } -td.loglevelmixedDEBUG span, td.loglevellabelDEBUG span +td.loglevelMixedDEBUG span, td.loglevelLabelDEBUG span { font-weight: bold; color: white; background-color: darkcyan; } -td.loglevelmixedWARNING span, td.loglevellabelWARNING span +td.loglevelMixedWARNING span, td.loglevelLabelWARNING span { font-weight: bold; color: white; background-color: #660; } -td.loglevelmixedERROR span, td.loglevellabelERROR span +td.loglevelMixedERROR span, td.loglevelLabelERROR span { font-weight: bold; color: white; background-color: red; } -td.loglevelmixedCRITICAL span, td.loglevellabelCRITICAL span +td.loglevelMixedCRITICAL span, td.loglevelLabelCRITICAL span { font-weight: bold; color: white; 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}}" |