webui:add some values to config pages
This commit is contained in:
parent
c585e75b36
commit
380966f3f1
|
@ -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 """
|
||||
<ul>
|
||||
<li>Active port:%(active_port)s </li>
|
||||
<li><a href="http://deluge-torrent.org/test-port.php?port=%(active_port)s">Test active port</li>
|
||||
</ul>
|
||||
""" % {'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")
|
||||
|
|
|
@ -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?"
|
||||
|
|
|
@ -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)
|
||||
"""
|
|
@ -29,11 +29,16 @@ $:form.as_table()
|
|||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
$if message:
|
||||
<div id="message">$message</div>
|
||||
$if error:
|
||||
<div class="error">$error</div>
|
||||
|
||||
<div>
|
||||
$:form.extra_html()
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue