From d7aed2778dbdd10e5b31a655761d22f438863f72 Mon Sep 17 00:00:00 2001 From: Martijn Voncken Date: Tue, 14 Oct 2008 20:37:06 +0000 Subject: [PATCH] webui:sidebar config for trackers and hide_zero --- deluge/ui/webui/config_tabs_webui.py | 6 ++++++ deluge/ui/webui/pages.py | 13 ++++++++----- deluge/ui/webui/webserver_common.py | 4 +++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/deluge/ui/webui/config_tabs_webui.py b/deluge/ui/webui/config_tabs_webui.py index cbaa8982e..66472c4e5 100644 --- a/deluge/ui/webui/config_tabs_webui.py +++ b/deluge/ui/webui/config_tabs_webui.py @@ -89,6 +89,12 @@ class Password(forms.Form): utils.end_session() #raise forms.ValidationError(_("Password changed,please login again")) +class Sidebar(config_forms.WebCfgForm): + title = _("Sidebar") + sidebar_show_zero = forms.CheckBox(_("Show zero hits")) + sidebar_show_trackers = forms.CheckBox(_("Show trackers")) + config_page.register('webui','template', Template) config_page.register('webui','server',Server) config_page.register('webui','password',Password) +config_page.register('webui','sidebar',Sidebar) diff --git a/deluge/ui/webui/pages.py b/deluge/ui/webui/pages.py index 106037a31..3106f0c51 100644 --- a/deluge/ui/webui/pages.py +++ b/deluge/ui/webui/pages.py @@ -98,21 +98,24 @@ class index: newvars['filter_value'] = vars.filter_value vars.update(newvars) - else: #has arguments:set cookies from arguments. for key in ["sort", "order", "filter_cat","filter_value"]: value = getattr(vars, key) or "" setcookie(key, value) - #organize-filters - label_filters = {} - + #Filters filter_dict = {} if vars.filter_cat and vars.filter_value and vars.filter_value <> "All": filter_dict = {vars.filter_cat:vars.filter_value} torrents = proxy.get_torrents_status(filter_dict, TORRENT_KEYS) - label_filters = proxy.get_filter_tree() + + #sidebar-config: + hide_cat = [] + if not config["sidebar_show_trackers"]: + hide_cat = ["tracker_host"] + + label_filters = proxy.get_filter_tree(config["sidebar_show_zero"], hide_cat) torrent_list = utils.get_enhanced_torrent_list(torrents) diff --git a/deluge/ui/webui/webserver_common.py b/deluge/ui/webui/webserver_common.py index 74f9a3505..70aa9f5e4 100644 --- a/deluge/ui/webui/webserver_common.py +++ b/deluge/ui/webui/webserver_common.py @@ -61,5 +61,7 @@ CONFIG_DEFAULTS = { "daemon":"http://localhost:58846", "base":"", "disallow":{}, - "sessions":[] + "sessions":[], + "sidebar_show_zero":False, + "sidebar_show_trackers":False }