diff --git a/deluge/plugins/label/label/data/apply_sensitivity.js b/deluge/plugins/label/label/data/apply_sensitivity.js new file mode 100644 index 000000000..9026d50f3 --- /dev/null +++ b/deluge/plugins/label/label/data/apply_sensitivity.js @@ -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"]] +]; + + diff --git a/deluge/plugins/label/label/template/options.html b/deluge/plugins/label/label/template/options.html index b1f83e99b..8f53dd463 100644 --- a/deluge/plugins/label/label/template/options.html +++ b/deluge/plugins/label/label/template/options.html @@ -1,10 +1,34 @@ -$def with (label_id) +$def with (label_id, options_form) $:render.basic_header(_("Label Options")) +

$label_id Options.

label= $label_id +

max

+ + $:(options_form.as_table(["apply_max", "max_download_speed", "max_upload_speed", "max_upload_slots", "max_connections"])) +
+ +

queue

+ + $:(options_form.as_table(["apply_queue", "is_auto_managed", "stop_at_ratio", "stop_ratio", "remove_at_ratio"])) +
+ + +

location

+ + $:(options_form.as_table(["apply_move_completed", "move_completed", "move_completed_path"])) +
+ +

tracker

+ + $:(options_form.as_table(["auto_add", "auto_add_trackers"])) +
+ +
+ $:render.footer() \ No newline at end of file diff --git a/deluge/plugins/label/label/webui.py b/deluge/plugins/label/label/webui.py index d713503cd..978a98e65 100644 --- a/deluge/plugins/label/label/webui.py +++ b/deluge/plugins/label/label/webui.py @@ -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) diff --git a/deluge/plugins/webuipluginbase.py b/deluge/plugins/webuipluginbase.py index 2e40a0f3d..14d79bc7d 100644 --- a/deluge/plugins/webuipluginbase.py +++ b/deluge/plugins/webuipluginbase.py @@ -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)