From fd8dc457faafde132dfd06a7dc049cd86d60d8c4 Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Fri, 2 Nov 2012 02:06:33 -0400 Subject: [PATCH 1/3] Add move completed option to add torrent dialog. --- ChangeLog | 1 + deluge/ui/gtkui/addtorrentdialog.py | 28 ++++++- .../ui/gtkui/glade/add_torrent_dialog.glade | 83 +++++++++++++++++-- 3 files changed, 106 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 02349fd52..996a3621e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ ==== Core ==== * Fix not properly detecting when torrent is at end of queue * #2049: Preserve order when moving multiple torrents in the queue + * Add move completed option to add torrent dialog ==== GtkUI ==== * Modified fix for #1957, keyerror with non-acsii columns diff --git a/deluge/ui/gtkui/addtorrentdialog.py b/deluge/ui/gtkui/addtorrentdialog.py index a26acf056..0f1dc56c3 100644 --- a/deluge/ui/gtkui/addtorrentdialog.py +++ b/deluge/ui/gtkui/addtorrentdialog.py @@ -142,7 +142,9 @@ class AddTorrentDialog(component.Component): "max_download_speed_per_torrent", "prioritize_first_last_pieces", "download_location", - "add_paused" + "add_paused", + "move_completed", + "move_completed_path" ] self.core_config = {} @@ -158,9 +160,13 @@ class AddTorrentDialog(component.Component): if client.is_localhost(): self.glade.get_widget("button_location").show() self.glade.get_widget("entry_download_path").hide() + self.glade.get_widget("button_move_completed_location").show() + self.glade.get_widget("entry_move_completed_path").hide() else: self.glade.get_widget("button_location").hide() self.glade.get_widget("entry_download_path").show() + self.glade.get_widget("button_move_completed_location").hide() + self.glade.get_widget("entry_move_completed_path").show() self.dialog.set_transient_for(component.get("MainWindow").window) self.dialog.present() @@ -366,9 +372,13 @@ class AddTorrentDialog(component.Component): if client.is_localhost(): self.glade.get_widget("button_location").set_current_folder( options["download_location"]) + self.glade.get_widget("button_move_completed_location").set_current_folder( + options["move_completed_path"]) else: self.glade.get_widget("entry_download_path").set_text( options["download_location"]) + self.glade.get_widget("entry_move_completed_path").set_text( + options["move_completed_path"]) self.glade.get_widget("radio_full").set_active( not options["compact_allocation"]) @@ -386,6 +396,8 @@ class AddTorrentDialog(component.Component): options["add_paused"]) self.glade.get_widget("chk_prioritize").set_active( options["prioritize_first_last_pieces"]) + self.glade.get_widget("chk_move_completed").set_active( + options["move_completed"]) def save_torrent_options(self, row=None): # Keeps the torrent options dictionary up-to-date with what the user has @@ -406,9 +418,13 @@ class AddTorrentDialog(component.Component): if client.is_localhost(): options["download_location"] = \ self.glade.get_widget("button_location").get_filename() + options["move_completed_path"] = \ + self.glade.get_widget("button_move_completed_location").get_filename() else: options["download_location"] = \ self.glade.get_widget("entry_download_path").get_text() + options["move_completed_path"] = \ + self.glade.get_widget("entry_move_completed_path").get_text() options["compact_allocation"] = \ self.glade.get_widget("radio_compact").get_active() @@ -431,6 +447,8 @@ class AddTorrentDialog(component.Component): self.glade.get_widget("chk_paused").get_active() options["prioritize_first_last_pieces"] = \ self.glade.get_widget("chk_prioritize").get_active() + options["move_completed"] = \ + self.glade.get_widget("chk_move_completed").get_active() self.options[torrent_id] = options @@ -456,9 +474,15 @@ class AddTorrentDialog(component.Component): if client.is_localhost(): self.glade.get_widget("button_location").set_current_folder( self.core_config["download_location"]) + self.glade.get_widget("button_move_completed_location").set_current_folder( + self.core_config["move_completed_path"] + ) else: self.glade.get_widget("entry_download_path").set_text( self.core_config["download_location"]) + self.glade.get_widget("entry_move_completed_path").set_text( + self.core_config["move_completed_path"] + ) self.glade.get_widget("radio_compact").set_active( self.core_config["compact_allocation"]) @@ -476,6 +500,8 @@ class AddTorrentDialog(component.Component): self.core_config["add_paused"]) self.glade.get_widget("chk_prioritize").set_active( self.core_config["prioritize_first_last_pieces"]) + self.glade.get_widget("chk_move_completed").set_active( + self.core_config["move_completed"]) def get_file_priorities(self, torrent_id): # A list of priorities diff --git a/deluge/ui/gtkui/glade/add_torrent_dialog.glade b/deluge/ui/gtkui/glade/add_torrent_dialog.glade index 8273340c6..d5593f252 100644 --- a/deluge/ui/gtkui/glade/add_torrent_dialog.glade +++ b/deluge/ui/gtkui/glade/add_torrent_dialog.glade @@ -375,8 +375,8 @@ True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True 1 @@ -404,6 +404,79 @@ 0 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + none + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + 5 + 5 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + True + False + True + + + False + 0 + + + + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + select-folder + Select A Folder + + + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + True + + + 2 + + + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + <b>Move Completed Location</b> + True + + + label_item + + + + + False + False + 1 + + True @@ -715,7 +788,7 @@ False False - 1 + 2 @@ -833,7 +906,7 @@ False False - 2 + 3 @@ -1022,9 +1095,9 @@ True True True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK True + True 1 @@ -1181,9 +1254,9 @@ True True True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK True + True 1 From ad8b7573875a805bd1aa08ee5c95c9ade3b4799a Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Fri, 2 Nov 2012 02:09:21 -0400 Subject: [PATCH 2/3] Fix changelog entry for move completed patch. --- ChangeLog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 996a3621e..4bb0d5fa0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,11 +2,13 @@ ==== Core ==== * Catch & log KeyError when removing a torrent from the queued torrents set +=== GtkUI === + * Add move completed option to add torrent dialog + === Deluge 1.3.5 (09 April 2012) === ==== Core ==== * Fix not properly detecting when torrent is at end of queue * #2049: Preserve order when moving multiple torrents in the queue - * Add move completed option to add torrent dialog ==== GtkUI ==== * Modified fix for #1957, keyerror with non-acsii columns From b8b27bdaf25e9840558d2bc9bd3fdb4d6273ff60 Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Fri, 2 Nov 2012 18:04:38 -0400 Subject: [PATCH 3/3] Make move completed field sensitive only when check box is enabled on add torrent dialog. --- deluge/ui/gtkui/addtorrentdialog.py | 10 +++++++++- deluge/ui/gtkui/glade/add_torrent_dialog.glade | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/deluge/ui/gtkui/addtorrentdialog.py b/deluge/ui/gtkui/addtorrentdialog.py index 0f1dc56c3..f63246b67 100644 --- a/deluge/ui/gtkui/addtorrentdialog.py +++ b/deluge/ui/gtkui/addtorrentdialog.py @@ -78,7 +78,8 @@ class AddTorrentDialog(component.Component): "on_button_cancel_clicked": self._on_button_cancel_clicked, "on_button_add_clicked": self._on_button_add_clicked, "on_button_apply_clicked": self._on_button_apply_clicked, - "on_button_revert_clicked": self._on_button_revert_clicked + "on_button_revert_clicked": self._on_button_revert_clicked, + "on_chk_move_completed_toggled": self._on_chk_move_completed_toggled }) self.torrent_liststore = gtk.ListStore(str, str, str) @@ -168,6 +169,8 @@ class AddTorrentDialog(component.Component): self.glade.get_widget("button_move_completed_location").hide() self.glade.get_widget("entry_move_completed_path").show() + self._on_chk_move_completed_toggled(self.glade.get_widget("chk_move_completed")) + self.dialog.set_transient_for(component.get("MainWindow").window) self.dialog.present() if focus: @@ -819,6 +822,11 @@ class AddTorrentDialog(component.Component): del self.options[model.get_value(row, 0)] self.set_default_options() + def _on_chk_move_completed_toggled(self, widget): + value = widget.get_active() + self.glade.get_widget("button_move_completed_location").set_sensitive(value) + self.glade.get_widget("entry_move_completed_path").set_sensitive(value) + def _on_delete_event(self, widget, event): self.hide() return True diff --git a/deluge/ui/gtkui/glade/add_torrent_dialog.glade b/deluge/ui/gtkui/glade/add_torrent_dialog.glade index d5593f252..fe6c48670 100644 --- a/deluge/ui/gtkui/glade/add_torrent_dialog.glade +++ b/deluge/ui/gtkui/glade/add_torrent_dialog.glade @@ -427,6 +427,7 @@ True False True + False