empty options page

This commit is contained in:
Martijn Voncken 2008-11-08 14:16:54 +00:00
parent db283d9a14
commit a183e665b0
4 changed files with 60 additions and 5 deletions

View File

@ -0,0 +1,20 @@
/*
see : gtkui/sidebar_menu.py:
def apply_sensitivity(self, event=None):
for chk_id , sensitive_list in self.sensitive_groups:
chk = self.glade.get_widget(chk_id)
sens = chk.get_active() and chk.get_property("sensitive")
for widget_id in sensitive_list:
self.glade.get_widget(widget_id).set_sensitive(sens)
*/
var sensitive_groups = [
["apply_max", ["max_download_speed", "max_upload_speed", "max_upload_slots", "max_connections"]],
["apply_queue", ["is_auto_managed", "stop_at_ratio"]],
["stop_at_ratio", ["remove_at_ratio", "stop_ratio"]], /*#nested*/
["apply_move_completed", ["move_completed"]],
["move_completed", ["move_completed_path"]], /*#nested*/
["auto_add", ["auto_add_trackers"]]
];

View File

@ -1,10 +1,34 @@
$def with (label_id)
$def with (label_id, options_form)
$:render.basic_header(_("Label Options"))
<script language="javascript" src="/label/data/apply_sensitivity.js"></script>
<h2>$label_id Options.</h2>
<div class="panel">
<form method="POST" action='$base/label/options/$label_id'>
label= $label_id
<h3>max</h3>
<table>
$:(options_form.as_table(["apply_max", "max_download_speed", "max_upload_speed", "max_upload_slots", "max_connections"]))
</table>
<h3>queue</h3>
<table>
$:(options_form.as_table(["apply_queue", "is_auto_managed", "stop_at_ratio", "stop_ratio", "remove_at_ratio"]))
</table>
<h3>location</h3>
<table>
$:(options_form.as_table(["apply_move_completed", "move_completed", "move_completed_path"]))
</table>
<h3>tracker</h3>
<table>
$:(options_form.as_table(["auto_add", "auto_add_trackers"]))
</table>
<input type="submit" value="$_("Save")">
</form>
</div>
$:render.footer()

View File

@ -48,7 +48,10 @@ forms = api.forms
class options:
@api.deco.deluge_page
def GET(self, label_id):
return api.render.label.options(label_id)
options_form = OptionsForm()
return api.render.label.options(label_id, options_form)
class add:
@api.deco.deluge_page
@ -60,13 +63,21 @@ class remove:
def GET(self, label_id):
return api.render.label.options(label_id)
class config_page:
"""for ajaxui."""
@api.deco.deluge_page
def GET(self, args):
labels = sclient.label_get_labels()
return api.render.label.config_page(labels)
class WebUI(WebUIPluginBase):
include_javascript = ["/label/data/label.js"]
urls = [
('/label/options/(.*)', options),
('/label/add', add),
('/label/remove/(.*)', remove)
('/label/remove/(.*)', remove),
('/label/config', config_page)
]
def enable(self):
@ -108,8 +119,8 @@ class OptionsForm(forms.Form):
move_completed_path = forms.CharField(label=_("move_completed_path"))
#tracker:
auto_add_trackers = forms.CharField(label=_("auto_add_trackers"), widget=forms.Textarea)
auto_add = forms.CheckBox(_("auto_add"))
auto_add_trackers = forms.CharField(label=_("auto_add_trackers"), widget=forms.Textarea)

View File

@ -74,7 +74,7 @@ class WebUIPluginBase:
#use as : api.render.plugin-name.template-name[excluding.html](parameters)
setattr(api.render, self.clean_plugin_name, api.egg_render(self.clean_plugin_name, "template"))
api.page_manager.register_page("/%s/data/(.*)" % self.clean_plugin_name , egg_data_static)
api.page_manager.register_page("/%s/data/(.*)" % self.clean_plugin_name , egg_data_static, use_module=False)
log.debug("%s plugin : end base_enable().." % self.plugin_name)