From 380966f3f10a49d38ed055685fb535e4066f8af2 Mon Sep 17 00:00:00 2001 From: Martijn Voncken Date: Thu, 3 Apr 2008 19:06:17 +0000 Subject: [PATCH] webui:add some values to config pages --- deluge/ui/webui/config_tabs_deluge.py | 20 +++++++++++++++----- deluge/ui/webui/lib/newforms_plus.py | 5 +++++ deluge/ui/webui/pages.py | 10 ---------- deluge/ui/webui/templates/deluge/config.html | 5 +++++ 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/deluge/ui/webui/config_tabs_deluge.py b/deluge/ui/webui/config_tabs_deluge.py index 47351092b..386f07535 100644 --- a/deluge/ui/webui/config_tabs_deluge.py +++ b/deluge/ui/webui/config_tabs_deluge.py @@ -30,7 +30,7 @@ # this exception statement from your version. If you delete this exception # statement from all source files in the program, then also delete it here. -from deluge.ui.client import sclient as proxy +from deluge.ui.client import sclient from deluge.log import LOG as log import utils @@ -63,6 +63,14 @@ class NetworkPorts(config_forms.CfgForm ): if (data['_port_to'] < data['_port_from']): raise forms.ValidationError('"Port from" must be greater than "Port to"') + def extra_html(self): + return """ + + """ % {'active_port':sclient.get_listen_port()} + config_page.register('network','ports', NetworkPorts) class NetworkExtra(config_forms.CfgForm ): @@ -103,6 +111,8 @@ class BandwithTorrent(config_forms.CfgForm): title = _("Per Torrent") info = _("-1 = Unlimited") max_connections_per_torrent = forms.DelugeInt(_("Maximum Connections")) + max_download_speed_per_torrent = forms.DelugeFloat(_("Maximum Download Speed (Kib/s)")) + max_upload_speed_per_torrent = forms.DelugeFloat(_("Maximum Upload Speed (Kib/s)")) max_upload_slots_per_torrent = forms.DelugeInt(_("Maximum Upload Slots")) config_page.register('bandwidth','torrent', BandwithTorrent) @@ -113,8 +123,8 @@ class Download(config_forms.CfgForm): torrentfiles_location = forms.ServerFolder(_("Save .torrent files to")) autoadd_location = forms.ServerFolder(_("Auto Add folder"), required=False) compact_allocation = forms.CheckBox(_('Use Compact Allocation')) - prioritize_first_last_pieces = forms.CheckBox( - _('Prioritize first and last pieces')) + prioritize_first_last_pieces = forms.CheckBox(_('Prioritize first and last pieces')) + default_private = forms.CheckBox(_('Set private flag by default')) config_page.register('deluge','download', Download) @@ -130,11 +140,11 @@ class Plugins(forms.Form): title = _("Enabled Plugins") enabled_plugins = forms.LazyMultipleChoice( - choices_getter = lambda: [(p,p) for p in proxy.get_available_plugins()] + choices_getter = lambda: [(p,p) for p in sclient.get_available_plugins()] ) def initial_data(self): - return {'enabled_plugins':proxy.get_enabled_plugins()} + return {'enabled_plugins':sclient.get_enabled_plugins()} def save(self, value): raise forms.ValidationError("SAVE:TODO") diff --git a/deluge/ui/webui/lib/newforms_plus.py b/deluge/ui/webui/lib/newforms_plus.py index 8758f5252..a27d76bb9 100644 --- a/deluge/ui/webui/lib/newforms_plus.py +++ b/deluge/ui/webui/lib/newforms_plus.py @@ -74,6 +74,7 @@ class FilteredForm(newforms.Form): class Form(FilteredForm): info = "" title = "No Title" + def __init__(self,data = None): if data == None: data = self.initial_data() @@ -100,6 +101,10 @@ class Form(FilteredForm): def validate(self, data): pass + def extra_html(self): + return '' + + #convenience Input Fields. class CheckBox(newforms.BooleanField): "Non Required BooleanField,why the f is it required by default?" diff --git a/deluge/ui/webui/pages.py b/deluge/ui/webui/pages.py index c1e9a893c..98f182975 100644 --- a/deluge/ui/webui/pages.py +++ b/deluge/ui/webui/pages.py @@ -404,13 +404,3 @@ class pixmaps: web.header("Cache-Control" , "public, must-revalidate, max-age=86400") print content route("/pixmaps/(.*)", pixmaps) - -""" -#debug: -class catch_all: - @deco.deluge_page_noauth - def GET(self, name): - log.debug("xname=" + name) - print "name=" + name -route("(.*)", catch_all) -""" \ No newline at end of file diff --git a/deluge/ui/webui/templates/deluge/config.html b/deluge/ui/webui/templates/deluge/config.html index f58f2b4de..7c2b6a032 100644 --- a/deluge/ui/webui/templates/deluge/config.html +++ b/deluge/ui/webui/templates/deluge/config.html @@ -29,11 +29,16 @@ $:form.as_table() + $if message:
$message
$if error:
$error
+
+$:form.extra_html() +
+