diff --git a/deluge/plugins/label/label/core.py b/deluge/plugins/label/label/core.py index 1e12a1ebc..4fc9d5228 100644 --- a/deluge/plugins/label/label/core.py +++ b/deluge/plugins/label/label/core.py @@ -64,19 +64,20 @@ CONFIG_DEFAULTS = { CORE_OPTIONS = ["hide_zero_hits", "gtk_alfa", "show_states", "show_trackers", "show_labels","auto_add","auto_add_trackers"] OPTIONS_DEFAULTS = { + "apply_max":False, "max_download_speed":-1, "max_upload_speed":-1, "max_connections":-1, "max_upload_slots":-1, "prioritize_first_last":False, - "apply_max":False, - "move_completed":False, - "move_completed_path":"", "apply_queue":False, "is_auto_managed":False, "stop_at_ratio":False, "stop_ratio":2.0, "remove_at_ratio":False, + "apply_move_completed":False, + "move_completed":False, + "move_completed_path":"", "auto_add":False, "auto_add_trackers":[], } @@ -315,6 +316,9 @@ class Core(CorePluginBase): options = self.labels[label_id] torrent = self.torrents[torrent_id] + if not options["move_completed_path"]: + options["move_completed_path"] = "" #no None. + if options["apply_max"]: torrent.set_max_download_speed(options["max_download_speed"]) torrent.set_max_upload_speed(options["max_upload_speed"]) @@ -328,9 +332,9 @@ class Core(CorePluginBase): torrent.set_stop_ratio(options['stop_ratio']) torrent.set_remove_at_ratio(options['remove_at_ratio']) - if options["move_completed"]: - #todo... - pass + if options["apply_move_completed"]: + torrent.set_move_on_completed(options["move_completed"]) + torrent.set_move_on_completed_path(options["move_completed_path"]) def _has_auto_match(self, torrent ,label_options): "match for auto_add fields" diff --git a/deluge/plugins/label/label/data/label_options.glade b/deluge/plugins/label/label/data/label_options.glade index dc31fc7e3..898ad29da 100644 --- a/deluge/plugins/label/label/data/label_options.glade +++ b/deluge/plugins/label/label/data/label_options.glade @@ -1,6 +1,6 @@ - + 5 @@ -54,103 +54,41 @@ - + True - 3 - 4 - GTK_FILL + 2 + 4 + 5 + GTK_FILL - + True True -1 -1 9999 1 10 10 + True 1 2 - 1 - 2 + 3 + 4 - - True - Kib/s - - - 2 - 3 - GTK_FILL - GTK_FILL - - - - - True - True - -1 -1 9999 1 10 10 - - - 1 - 2 - - - - - - + True 0 - Upload Slots: + Connections: - 2 - 3 - GTK_FILL - GTK_FILL - - - - - True - 0 - Upload Speed: - - - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - 0 - Download Speed: - True - - - GTK_FILL - GTK_FILL - - - - - True - Kib/s - - - 2 - 3 - 1 - 2 + 3 + 4 GTK_FILL GTK_FILL @@ -172,43 +110,105 @@ - + True - 0 - Connections: + Kib/s - 3 - 4 + 2 + 3 + 1 + 2 GTK_FILL GTK_FILL - + + True + 0 + Download Speed: + True + + + GTK_FILL + GTK_FILL + + + + + True + 0 + Upload Speed: + + + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + 0 + Upload Slots: + + + 2 + 3 + GTK_FILL + GTK_FILL + + + + True True -1 -1 9999 1 10 10 - True 1 2 - 3 - 4 - + + True + Kib/s + + + 2 + 3 + GTK_FILL + GTK_FILL + + + + + True + True + -1 -1 9999 1 10 10 + + + 1 + 2 + 1 + 2 + + + + + + True - 2 - 4 - 5 - GTK_FILL + 3 + 4 + GTK_FILL @@ -269,58 +269,14 @@ - + True - 2 - 3 - 1 - 2 - GTK_FILL - - - - - True - True - Auto Managed - 0 - True - - + 2 + 3 + 4 GTK_FILL - - - - - - True - True - Stop seed at ratio: - 0 - True - - - 1 - 2 - GTK_FILL - GTK_FILL - - - - - True - True - Remove at ratio - 0 - True - - - 2 - 3 - GTK_FILL - GTK_FILL @@ -340,14 +296,58 @@ - + + True + True + Remove at ratio + 0 + True + + + 2 + 3 + GTK_FILL + GTK_FILL + + + + + True + True + Stop seed at ratio: + 0 + True + + + 1 + 2 + GTK_FILL + GTK_FILL + + + + + True + True + Auto Managed + 0 + True + + + GTK_FILL + + + + + True - 2 - 3 - 4 - GTK_FILL + 2 + 3 + 1 + 2 + GTK_FILL @@ -397,34 +397,39 @@ 3 2 - + True - warning : not effective yet 2 2 3 + + + + + True + True + Move completed to: + 0 + True + + + 2 + GTK_FILL GTK_FILL True - - - 2 - GTK_FILL - - - - - True + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER 2 1 2 + GTK_FILL @@ -432,10 +437,10 @@ - + True True - Move completed to: + Apply move location settings: 0 True diff --git a/deluge/plugins/label/label/gtkui/sidebar.py b/deluge/plugins/label/label/gtkui/sidebar.py index e43accb4b..0f2d42ede 100644 --- a/deluge/plugins/label/label/gtkui/sidebar.py +++ b/deluge/plugins/label/label/gtkui/sidebar.py @@ -130,14 +130,18 @@ class AddDialog(object): class OptionsDialog(object): spin_ids = ["max_download_speed", "max_upload_speed", "max_upload_slots", "max_connections", "stop_ratio"] - chk_ids = ["apply_max", "apply_queue", "stop_at_ratio", "apply_queue", "remove_at_ratio", "move_completed", "is_auto_managed", "auto_add"] - sensitive_groups = { #keys must be checkboxes , value-list is to be enabled on checked. - "apply_max": ["max_download_speed", "max_upload_speed", "max_upload_slots", "max_connections"], - "apply_queue":["is_auto_managed", "remove_at_ratio", "stop_at_ratio", "stop_ratio"], - #"stop_at_ratio":["stop_at_ratio","remove_at_ratio"], #nested from apply_queue, will probably cause bugs. - "move_completed":["move_completed_path"], - "auto_add":["auto_add_trackers"] - } + chk_ids = ["apply_max", "apply_queue", "stop_at_ratio", "apply_queue", "remove_at_ratio", + "apply_move_completed", "move_completed", "is_auto_managed", "auto_add"] + + #list of tuples, because order matters when nesting. + 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"]) + ] def __init__(self): pass @@ -151,7 +155,7 @@ class OptionsDialog(object): "on_options_cancel":self.on_cancel, }) - for chk_id in self.sensitive_groups: + for chk_id, group in self.sensitive_groups: log.debug(chk_id) chk = self.glade.get_widget(chk_id) chk.connect("toggled",self.apply_sensitivity) @@ -193,16 +197,14 @@ class OptionsDialog(object): self.dialog.destroy() def apply_sensitivity(self, event=None): + nested = [] log.debug("apply-sensitivity") - for chk_id , sensitive_list in self.sensitive_groups.iteritems(): - sens = self.glade.get_widget(chk_id).get_active() + 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) - - - - def on_cancel(self, event=None): self.dialog.destroy()