From 4d2a2dd604ace51203fc6ee49f699f857e07b80f Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Mon, 20 Aug 2007 02:28:51 +0000 Subject: [PATCH] move "move completed downloads" into the "move torrent" plugin --- ChangeLog | 2 + glade/preferences_dialog.glade | 914 +++++++++++++------------- plugins/DesiredRatio/__init__.py | 17 +- plugins/MoveTorrent/__init__.py | 69 +- plugins/MoveTorrent/movetorrent.glade | 89 +++ plugins/WebSeed/__init__.py | 7 + src/core.py | 20 - src/dialogs.py | 14 - src/interface.py | 6 +- src/pref.py | 2 - 10 files changed, 617 insertions(+), 523 deletions(-) create mode 100644 plugins/MoveTorrent/movetorrent.glade diff --git a/ChangeLog b/ChangeLog index 195576150..50bc7b0a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,6 @@ Deluge 0.5.5 (xx August 2007) + * New Move torrent plugin - takes over for "move completed downloads" feature + and provides a "Move Torrent" option when right-clicking on a torrent * Save column widths * Queue order after restart fixes. * Use payload instead of including protocol overhead to ease user confusion diff --git a/glade/preferences_dialog.glade b/glade/preferences_dialog.glade index 234345c27..feac8b985 100644 --- a/glade/preferences_dialog.glade +++ b/glade/preferences_dialog.glade @@ -64,39 +64,8 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 2 + 1 2 - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Store all downloads in: - Store all downloads in: - 0 - True - True - radio_ask_save - - - - - - True - False - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Move completed downloads to (*same partition only*): - Move completed downloads to: - 0 - True - - - - 1 - 2 - - True @@ -111,19 +80,18 @@ - + True - False + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER - Select A Folder + Store all downloads in: + Store all downloads in: + 0 + True + True + radio_ask_save + - - 1 - 2 - 1 - 2 - @@ -1054,99 +1022,22 @@ Full Stream 4 2 - - True - True - The maximum upload slots for all torrents. Set -1 for unlimited. - 1 - -1 -1 9000 1 10 10 - 1 - - - 1 - 2 - 3 - 4 - GTK_FILL - - - - - True - True - The maximum upload speed for all torrents. Set -1 for unlimited. - 1 - 0 -1 9000 1 10 10 - 1 - - - 1 - 2 - 2 - 3 - GTK_FILL - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - The maximum download speed for all torrents. Set -1 for unlimited. - 1 - 0 -1 9000 1 10 10 - 1 - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - The maximum download speed for all torrents. Set -1 for unlimited. - 0 - Maximum Download Speed (KiB/s): - - - 1 - 2 - - - - - True - True - The maximum number of connections allowed. Set -1 for unlimited. - 1 - -1 -1 1000 1 10 10 - 1 - - - 1 - 2 - GTK_FILL - - - - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 10 - + True - The maximum number of connections allowed. Set -1 for unlimited. + The maximum upload speed for all torrents. Set -1 for unlimited. 0 - Maximum Connections: + Maximum Upload Slots: + 3 + 4 GTK_FILL @@ -1171,20 +1062,97 @@ Full Stream - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 10 - + True - The maximum upload speed for all torrents. Set -1 for unlimited. + The maximum number of connections allowed. Set -1 for unlimited. 0 - Maximum Upload Slots: + Maximum Connections: + GTK_FILL + + + + + True + True + The maximum number of connections allowed. Set -1 for unlimited. + 1 + -1 -1 1000 1 10 10 + 1 + + + 1 + 2 + GTK_FILL + + + + + True + The maximum download speed for all torrents. Set -1 for unlimited. + 0 + Maximum Download Speed (KiB/s): + + + 1 + 2 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + The maximum download speed for all torrents. Set -1 for unlimited. + 1 + 0 -1 9000 1 10 10 + 1 + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + True + The maximum upload speed for all torrents. Set -1 for unlimited. + 1 + 0 -1 9000 1 10 10 + 1 + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + True + The maximum upload slots for all torrents. Set -1 for unlimited. + 1 + -1 -1 9000 1 10 10 + 1 + + + 1 + 2 3 4 GTK_FILL @@ -1231,35 +1199,18 @@ Full Stream 2 2 - + True - True - The maximum upload slots per torrent. Set -1 for unlimited. - 1 - -1 -1 1000 1 10 10 - 1 + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Maximum Connections: + + - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - True - The maximum number of connections per torrent. Set -1 for unlimited. - 1 - -1 -1 1000 1 10 10 - - - 1 - 2 - GTK_FILL - @@ -1280,18 +1231,35 @@ Full Stream - + True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 - Maximum Connections: - - + True + The maximum number of connections per torrent. Set -1 for unlimited. + 1 + -1 -1 1000 1 10 10 + + 1 + 2 + GTK_FILL + + + + + True + True + The maximum upload slots per torrent. Set -1 for unlimited. + 1 + -1 -1 1000 1 10 10 + 1 + + + 1 + 2 + 1 + 2 + GTK_FILL + @@ -1387,46 +1355,73 @@ Full Stream - + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 8080 0 10000 1 10 10 + + + 3 + 4 + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Port + + + 2 + 3 + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Server + + + 2 + 3 + + + + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + 2 + 3 + + + + True False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 3 - 4 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Proxy type - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Username - - + 1 + 2 1 2 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Password - - - 2 - 3 - - True @@ -1445,71 +1440,44 @@ HTTP W/ Auth - + True - False - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Password - 1 - 2 - 1 - 2 - - - - - True - False - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 2 3 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Server + Username - 2 - 3 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Port - - - 2 - 3 1 2 - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Proxy type + + + + True False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 8080 0 10000 1 10 10 3 4 - 1 - 2 @@ -1581,46 +1549,73 @@ HTTP W/ Auth - + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 8080 0 10000 1 10 10 + + + 3 + 4 + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Port + + + 2 + 3 + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Server + + + 2 + 3 + + + + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + 2 + 3 + + + + True False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 3 - 4 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Proxy type - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Username - - + 1 + 2 1 2 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Password - - - 2 - 3 - - True @@ -1639,71 +1634,44 @@ HTTP W/ Auth - + True - False - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Password - 1 - 2 - 1 - 2 - - - - - True - False - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 2 3 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Server + Username - 2 - 3 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Port - - - 2 - 3 1 2 - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Proxy type + + + + True False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 8080 0 10000 1 10 10 3 4 - 1 - 2 @@ -1776,46 +1744,73 @@ HTTP W/ Auth - + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 8080 0 10000 1 10 10 + + + 3 + 4 + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Port + + + 2 + 3 + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Server + + + 2 + 3 + + + + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + 2 + 3 + + + + True False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 3 - 4 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Proxy type - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Username - - + 1 + 2 1 2 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Password - - - 2 - 3 - - True @@ -1834,71 +1829,44 @@ HTTP W/ Auth - + True - False - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Password - 1 - 2 - 1 - 2 - - - - - True - False - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 2 3 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Server + Username - 2 - 3 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Port - - - 2 - 3 1 2 - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Proxy type + + + + True False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 8080 0 10000 1 10 10 3 4 - 1 - 2 @@ -1971,46 +1939,73 @@ HTTP W/ Auth - + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 8080 0 10000 1 10 10 + + + 3 + 4 + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Port + + + 2 + 3 + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Server + + + 2 + 3 + + + + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + 1 + 2 + 2 + 3 + + + + True False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 3 - 4 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Proxy type - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Username - - + 1 + 2 1 2 - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Password - - - 2 - 3 - - True @@ -2029,71 +2024,44 @@ HTTP W/ Auth - + True - False - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Password - 1 - 2 - 1 - 2 - - - - - True - False - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - - - 1 - 2 2 3 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Server + Username - 2 - 3 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Port - - - 2 - 3 1 2 - + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Proxy type + + + + True False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 8080 0 10000 1 10 10 3 4 - 1 - 2 @@ -2328,41 +2296,22 @@ HTTP W/ Auth 2 2 - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 40 - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Open folder with: - 0 - True - True - - - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Custom: - 0 - True - True - radio_open_folder_stock - + + 1 + 2 1 2 @@ -2398,26 +2347,45 @@ Thunar - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 40 - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - + Custom: + 0 + True + True + radio_open_folder_stock + - 1 - 2 1 2 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Open folder with: + 0 + True + True + + + + False diff --git a/plugins/DesiredRatio/__init__.py b/plugins/DesiredRatio/__init__.py index 051ef0be9..bb5850343 100644 --- a/plugins/DesiredRatio/__init__.py +++ b/plugins/DesiredRatio/__init__.py @@ -48,7 +48,12 @@ class DesiredRatio: self.callback_ids = [] # Setup preferences - self.config = deluge.pref.Preferences(filename=deluge.common.CONFIG_DIR + "/desired_ratio.conf", global_defaults=False, defaults=DEFAULT_PREFS) + self.config_file = deluge.common.CONFIG_DIR + "/desired_ratio.conf" + self.config = deluge.pref.Preferences(self.config_file, global_defaults=False, defaults=DEFAULT_PREFS) + try: + self.config.load() + except IOError: + pass # Connect to events for the torrent menu so we know when to build and remove our sub-menu self.callback_ids.append(self.interface.torrent_menu.connect_after("realize", self.torrent_menu_show)) @@ -62,8 +67,6 @@ class DesiredRatio: # Make the sub-menu for the torrent menu self.ratio_menuitem = gtk.MenuItem(_("_Desired Ratio")) - - self.ratio_menu = self.interface.build_menu_radio_list(self.config.get("ratios"), self.ratio_clicked, self.get_torrent_desired_ratio(), None, True, _("_Not Set"), 1, None) self.ratio_menuitem.set_submenu(self.ratio_menu) @@ -81,6 +84,7 @@ class DesiredRatio: pass def unload(self): + self.config.save(self.config_file) # Disconnect all callbacks for callback_id in self.callback_ids: self.interface.torrent_menu.disconnect(callback_id) @@ -123,11 +127,12 @@ class DesiredRatio: # Set the ratio in the core and remember the setting self.core.set_ratio(self.unique_ID, value) self.set_ratios[self.unique_ID] = value + self.config.set[self.unique_ID]("ratios") = value # Update the ratios list if necessary - if value not in self.config.get("ratios") and value >= 1: - self.config.get("ratios").insert(0, value) - self.config.get("ratios").pop() + if value not in self.config.get("ratios")[self.unique_ID] and value >= 1: + self.config.get("ratios")[self.unique_ID].insert(0, value) + self.config.get("ratios")[self.unique_ID].pop() def get_torrent_desired_ratio(self): return self.set_ratios.get(self.unique_ID, 1) diff --git a/plugins/MoveTorrent/__init__.py b/plugins/MoveTorrent/__init__.py index 5b6a75c86..7c8f2b08a 100644 --- a/plugins/MoveTorrent/__init__.py +++ b/plugins/MoveTorrent/__init__.py @@ -21,7 +21,9 @@ plugin_author = "Marcos Pinto" plugin_version = "0.1" plugin_description = _("This plugin allows users to move the torrent to a \ different directory without having to remove and re-add the torrent. This \ - feature can be found by right-clicking on a torrent.") + feature can be found by right-clicking on a torrent.\nFurthermore, it \ + allows the user to automatically have finished torrents moved to a different \ + folder.") def deluge_init(deluge_path): global path @@ -37,6 +39,11 @@ from deluge import dialogs import gtk import os +DEFAULT_PREFS = { + "default_finished_path": os.path.expanduser("~/"), + "enable_move_completed": False +} + class movetorrentMenu: def __init__(self, path, core, interface): @@ -44,9 +51,25 @@ class movetorrentMenu: self.path = path self.core = core self.interface = interface + self.window = self.interface.window self.dialogs = deluge.dialogs + self.core.connect_event(self.core.constants['EVENT_STORAGE_MOVED'], self.handle_event) + self.core.connect_event(self.core.constants['EVENT_FINISHED'], self.handle_event) + self.glade = gtk.glade.XML(path + "/movetorrent.glade") + self.glade.signal_autoconnect({ + 'dialog_ok': self.dialog_ok, + 'dialog_cancel': self.dialog_cancel + }) + self.dialog = self.glade.get_widget("dialog") + self.dialog.set_position(gtk.WIN_POS_CENTER) + + self.config_file = deluge.common.CONFIG_DIR + "/move_torrent.conf" + self.config = deluge.pref.Preferences(self.config_file, global_defaults=False, defaults=DEFAULT_PREFS) + try: + self.config.load() + except IOError: + pass - # Add menu item to torrent context menu self.menuitem_image = gtk.Image() self.menuitem_image.set_from_stock(gtk.STOCK_SAVE_AS, gtk.ICON_SIZE_MENU) @@ -60,7 +83,10 @@ class movetorrentMenu: pass def unload(self): - self.interface.torrent_menu.remove(self.menuitem) + self.interface.torrent_menu.remove(self.menuitem) + self.core.disconnect_event(self.core.constants['EVENT_STORAGE_MOVED'], self.handle_event) + self.core.disconnect_event(self.core.constants['EVENT_FINISHED'], self.handle_event) + self.config.save(self.config_file) def movetorrent_clicked(self, widget): unique_ids = self.interface.get_selected_torrent_rows() @@ -70,3 +96,40 @@ class movetorrentMenu: if path: for unique_id in unique_ids: self.core.move_storage(unique_id, path) + + def configure(self, window): + import os.path + try: + self.glade.get_widget("chk_move_completed").set_active(self.config.get("enable_move_completed")) + self.glade.get_widget("finished_path_button").set_filename(self.config.get("default_finished_path")) + + except: + self.glade.get_widget("chk_move_completed").set_active(False) + self.glade.get_widget("default_finished_path").set_active(False) + self.dialog.set_transient_for(window) + self.dialog.show() + + def dialog_ok(self, source): + self.dialog.hide() + self.config.set("enable_move_completed", self.glade.get_widget("chk_move_completed").get_active()) + self.config.set("default_finished_path", self.glade.get_widget("finished_path_button").get_filename()) + + def dialog_cancel(self, source): + self.dialog.hide() + + def handle_event(self, event): + if event['event_type'] is self.core.constants['EVENT_STORAGE_MOVED']: + if event['message'] == self.core.unique_IDs[event['unique_ID']].save_dir: + self.dialogs.show_popup_warning(self.window, _("You cannot move torrent to a different partition. Please check your preferences. Or perhalps you are trying to move torrent's files to the same directory they are already stored?")) + self.core.unique_IDs[event['unique_ID']].save_dir = event['message'] + self.core.pickle_state() + + elif event['event_type'] is self.core.constants['EVENT_FINISHED']: + if event['message'] == "torrent has finished downloading": + if self.config.get('enable_move_completed') and \ + self.config.get('default_finished_path') != \ + self.core.get_pref('default_download_path') and \ + self.core.unique_IDs[event['unique_ID']].save_dir != \ + self.config.get('default_finished_path'): + self.core.move_storage(event['unique_ID'], + self.config.get('default_finished_path')) diff --git a/plugins/MoveTorrent/movetorrent.glade b/plugins/MoveTorrent/movetorrent.glade new file mode 100644 index 000000000..988ab6f66 --- /dev/null +++ b/plugins/MoveTorrent/movetorrent.glade @@ -0,0 +1,89 @@ + + + + + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + GTK_WIN_POS_CENTER_ON_PARENT + GDK_WINDOW_TYPE_HINT_DIALOG + False + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Move completed downloads to: + 0 + True + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER + Select A Folder + + + 1 + + + + + False + False + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_BUTTONBOX_END + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-cancel + True + 0 + + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-ok + True + 0 + + + + 1 + + + + + False + GTK_PACK_END + + + + + + diff --git a/plugins/WebSeed/__init__.py b/plugins/WebSeed/__init__.py index f13abe333..32a585efe 100644 --- a/plugins/WebSeed/__init__.py +++ b/plugins/WebSeed/__init__.py @@ -52,6 +52,13 @@ class webseedMenu: self.menuitem.connect("activate", self.webseed_clicked) self.interface.torrent_menu.append(self.menuitem) self.menuitem.show_all() + + self.config_file = deluge.common.CONFIG_DIR + "/web_seed.conf" + self.config = deluge.pref.Preferences(self.config_file, global_defaults=False) + try: + self.config.load() + except IOError: + pass def update(self): pass diff --git a/src/core.py b/src/core.py index ad7a2d67b..228831817 100644 --- a/src/core.py +++ b/src/core.py @@ -115,9 +115,6 @@ class InvalidEncodingError(DelugeError): class FilesystemError(DelugeError): pass -class StorageMoveFailed(DelugeError): - pass - # Note: this may be raised both from deluge-core.cpp and deluge.py, for # different reasons, both related to duplicate torrents class DuplicateTorrentError(DelugeError): @@ -622,23 +619,6 @@ class Manager: for callback in self.event_callbacks[event['event_type']]: callback(event) - if event['event_type'] is self.constants['EVENT_STORAGE_MOVED']: - if event['message'] == self.unique_IDs[event['unique_ID']].save_dir: - raise StorageMoveFailed(_("You cannot move torrent to a different partition. Please check your preferences. Or maybe you are trying to move torrent's files to the same directory they are already stored ?")) - - self.unique_IDs[event['unique_ID']].save_dir = event['message'] - self.pickle_state() - - elif event['event_type'] is self.constants['EVENT_FINISHED']: - if event['message'] == "torrent has finished downloading": - if self.get_pref('enable_move_completed') and \ - self.get_pref('default_finished_path') != \ - self.get_pref('default_download_path') and \ - self.unique_IDs[event['unique_ID']].save_dir != \ - self.get_pref('default_finished_path'): - self.move_storage(event['unique_ID'], - self.get_pref('default_finished_path')) - # Queue seeding torrent to bottom if needed if self.get_pref('queue_seeds_to_bottom'): self.queue_bottom(event['unique_ID']) diff --git a/src/dialogs.py b/src/dialogs.py index df73782f4..eb5f85c4e 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -94,7 +94,6 @@ class PreferencesDlg: self.glade.get_widget("txt_web_proxy_hostname").set_text(self.preferences.get("web_proxy_hostname")) self.glade.get_widget("txt_web_proxy_username").set_text(self.preferences.get("web_proxy_username")) self.glade.get_widget("txt_web_proxy_password").set_text(self.preferences.get("web_proxy_password")) - self.glade.get_widget("finished_path_button").set_filename(self.preferences.get("default_finished_path")) self.glade.get_widget("download_path_button").set_filename(self.preferences.get("default_download_path")) self.glade.get_widget("chk_enable_files_dialog").set_active(self.preferences.get("enable_files_dialog")) self.glade.get_widget("chk_prioritize_first_last_pieces").set_active(self.preferences.get("prioritize_first_last_pieces")) @@ -127,14 +126,8 @@ class PreferencesDlg: #smart dialog set sensitivities if(self.preferences.get("use_default_dir")): self.glade.get_widget("radio_save_all_to").set_active(True) - self.glade.get_widget("chk_move_completed").set_sensitive(True) - self.glade.get_widget("finished_path_button").set_sensitive(True) - if(self.preferences.get("enable_move_completed")): - self.glade.get_widget("chk_move_completed").set_active(True) else: self.glade.get_widget("radio_ask_save").set_active(True) - self.glade.get_widget("chk_move_completed").set_sensitive(False) - self.glade.get_widget("finished_path_button").set_sensitive(False) self.glade.get_widget('chk_min_on_close').set_sensitive( self.glade.get_widget('chk_use_tray').get_active()) @@ -204,8 +197,6 @@ class PreferencesDlg: self.preferences.set("peer_proxy_hostname", self.glade.get_widget("txt_peer_proxy_hostname").get_text()) self.preferences.set("use_default_dir", self.glade.get_widget("radio_save_all_to").get_active()) self.preferences.set("default_download_path", self.glade.get_widget("download_path_button").get_filename()) - self.preferences.set("enable_move_completed", self.glade.get_widget("chk_move_completed").get_active()) - self.preferences.set("default_finished_path", self.glade.get_widget("finished_path_button").get_filename()) self.preferences.set("enable_files_dialog", self.glade.get_widget("chk_enable_files_dialog").get_active()) self.preferences.set("prioritize_first_last_pieces", self.glade.get_widget("chk_prioritize_first_last_pieces").get_active()) self.preferences.set("auto_end_seeding", self.glade.get_widget("chk_autoseed").get_active()) @@ -242,11 +233,6 @@ class PreferencesDlg: value = widget.get_active() if widget == self.glade.get_widget('radio_save_all_to'): self.glade.get_widget('download_path_button').set_sensitive(value) - self.glade.get_widget('chk_move_completed').set_sensitive(value) - if not value: - self.glade.get_widget('chk_move_completed').set_active(value) - elif widget == self.glade.get_widget('chk_move_completed'): - self.glade.get_widget('finished_path_button').set_sensitive(value) elif widget == self.glade.get_widget('chk_autoseed'): self.glade.get_widget('ratio_spinner').set_sensitive(value) self.glade.get_widget('chk_clear_max_ratio_torrents').set_sensitive(value) diff --git a/src/interface.py b/src/interface.py index b7ffd9c25..f595c805b 100644 --- a/src/interface.py +++ b/src/interface.py @@ -864,11 +864,7 @@ class DelugeGTK: self.update_interface = self.window.get_property("visible") and not self.is_minimized # Handle the events - try: - self.manager.handle_events() - except core.StorageMoveFailed, e: - print "StorageMoveFailed", e - dialogs.show_popup_warning(self.window, e.value) + self.manager.handle_events() # Make sure that the interface still exists try: diff --git a/src/pref.py b/src/pref.py index 5cf94163c..40c9598f7 100644 --- a/src/pref.py +++ b/src/pref.py @@ -53,8 +53,6 @@ DEFAULT_PREFS = { "default_download_path" : os.path.expanduser("~/"), "open_torrent_dialog_path" : os.path.expanduser("~/"), "choose_directory_dialog_path": os.path.expanduser("~/"), - "default_finished_path" : os.path.expanduser("~/"), - "enable_move_completed" : False, "enable_dht" : True, "enable_system_tray" : True, "enabled_plugins" : "",