From 7a93e1a0fda1400418ddf129f6f7486543f9c29f Mon Sep 17 00:00:00 2001 From: Zach Tibbitts Date: Tue, 17 Jul 2007 22:29:53 +0000 Subject: [PATCH] preliminary smart pref dialog --- MANIFEST.in | 2 +- glade/preferences_dialog.glade | 439 ++++++++++++++++----------------- src/dialogs.py | 70 +++--- 3 files changed, 254 insertions(+), 257 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 92104a65e..6a7f9be49 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,7 +3,7 @@ include README include README.Packagers include Makefile include deluge.desktop -include deluge.xpm +include deluge.png include msgfmt.py recursive-include libtorrent/ * recursive-include glade/ *.glade diff --git a/glade/preferences_dialog.glade b/glade/preferences_dialog.glade index 8bd426b4f..081c5b380 100644 --- a/glade/preferences_dialog.glade +++ b/glade/preferences_dialog.glade @@ -55,9 +55,7 @@ True Ask where to save each download True - 0 True - @@ -67,15 +65,30 @@ 2 2 - + 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 + Store all downloads in: + Store all downloads in: + 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: + True + - 1 - 2 1 2 @@ -83,6 +96,7 @@ True + False 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 @@ -93,33 +107,20 @@ - + True - True + False 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 + GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER + Select A Folder + 1 + 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 - - 1 @@ -202,7 +203,6 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Enable selecting files for torrents before loading Enable selecting files for torrents before loading - 0 True @@ -249,7 +249,6 @@ Compact allocation will only allocate as much storage as it needs to keep the pieces downloaded so far. Use compact storage allocation True - 0 True @@ -293,7 +292,6 @@ True Queue torrents to bottom when they begin seeding True - 0 True @@ -301,10 +299,10 @@ True + False True Queue new torrents above completed ones True - 0 True @@ -320,9 +318,8 @@ True Stop seeding torrents when their share ratio reaches: True - 0 True - + False @@ -331,6 +328,7 @@ True + False True 1 0 0 10 0.050000000745099998 10 9 @@ -351,10 +349,10 @@ True + False True Automatically clear torrents that reach the max share ratio True - 0 True @@ -401,110 +399,25 @@ 4 2 - + True - True - The maximum upload speed for all torrents. Set -1 for unlimited. - 1 - -1 -1 9000 1 10 10 - 1 + 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. + 0 + Maximum Upload Speed (KiB/s): + + - 1 - 2 3 4 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 - -1 -1 9000 1 10 10 - 1 - - - 1 - 2 - 2 - 3 - GTK_FILL - - - - - True - True - The maximum number of upload slots. Set -1 for unlimited. - 1 - -1 -1 1000 1 10 10 - 1 - - - 1 - 2 - 1 - 2 - 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 - 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. - 0 - Maximum Connections: - - - - - 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 upload slots. Set -1 for unlimited. - 0 - Upload Slots: - - - - - 1 - 2 - GTK_FILL - - True @@ -526,20 +439,105 @@ - + 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 upload slots. Set -1 for unlimited. 0 - Maximum Upload Speed (KiB/s): + Upload Slots: + 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. + 0 + 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 + True + The maximum number of upload slots. Set -1 for unlimited. + 1 + -1 -1 1000 1 10 10 + 1 + + + 1 + 2 + 1 + 2 + 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 + -1 -1 9000 1 10 10 + 1 + + + 1 + 2 + 2 + 3 + GTK_FILL + + + + + True + True + The maximum upload speed for all torrents. Set -1 for unlimited. + 1 + -1 -1 9000 1 10 10 + 1 + + + 1 + 2 3 4 GTK_FILL @@ -744,7 +742,6 @@ True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Test Active Port - 0 @@ -800,7 +797,6 @@ Distributed hash table may improve the amount of active connections. Enable Mainline DHT True - 0 True @@ -852,7 +848,6 @@ Universal Plug and Play UPnP True - 0 True True @@ -867,7 +862,6 @@ NAT Port Mapping Protocol NAT-PMP True - 0 True True @@ -883,7 +877,6 @@ µTorrent Peer-Exchange µTorrent-PeX True - 0 True True @@ -991,7 +984,6 @@ Forced True Prefer to encrypt the entire stream True - 0 True @@ -1067,8 +1059,8 @@ Full Stream GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Affects regular bittorrent peers Peer Proxy - 0 True + @@ -1078,8 +1070,8 @@ Full Stream GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Only affects HTTP tracker connections (UDP tracker connections are affected if the given proxy supports UDP, e.g. SOCKS5). Tracker Proxy - 0 True + 1 @@ -1092,8 +1084,8 @@ Full Stream GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Affects the DHT messages. Since they are sent over UDP, it only has any effect if the proxy supports UDP. DHT Proxy - 0 True + 2 @@ -1114,86 +1106,30 @@ Full Stream - + True + False + 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 + 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 - Password - - - 2 - 3 - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - None -Socksv4 -Socksv5 -Socksv5 W/ Auth -HTTP -HTTP W/ Auth - - - 1 - 2 - - - - + True + False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 1 - 2 - 1 - 2 - - - - - True - 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 - - - 2 - 3 + 3 + 4 @@ -1210,30 +1146,91 @@ HTTP W/ Auth - + True - True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Server - 3 - 4 + 2 + 3 - + 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 + False - 3 - 4 + 1 + 2 + 2 + 3 + + + + + True + False + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 1 + 2 1 2 + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + None +Socksv4 +Socksv5 +Socksv5 W/ Auth +HTTP +HTTP W/ Auth + + + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Password + + + 2 + 3 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Username + + + 1 + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Proxy type + + 1 @@ -1314,10 +1311,9 @@ HTTP W/ Auth True Enable system tray icon True - 0 True True - + @@ -1327,9 +1323,9 @@ HTTP W/ Auth True + False Minimize to tray on close True - 0 True @@ -1349,11 +1345,12 @@ HTTP W/ Auth True + False True Password protect system tray True - 0 True + @@ -1378,6 +1375,7 @@ HTTP W/ Auth True + False True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK False @@ -1519,7 +1517,6 @@ HTTP W/ Auth True gtk-cancel True - 0 diff --git a/src/dialogs.py b/src/dialogs.py index 0f5d05904..b10412ec2 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -43,12 +43,7 @@ class PreferencesDlg: self.dialog = self.glade.get_widget("pref_dialog") self.dialog.set_icon_from_file(common.get_pixmap("deluge32.png")) self.glade.signal_autoconnect({ - 'on_chk_use_tray_toggled': self.tray_toggle, - 'on_save_all_to' : self.toggle_move_chk, - 'on_ask_save' : self.toggle_move_chk, - 'on_chk_seedbottom' : self.toggle_queue_above_completed_chk, - 'on_chk_autoseed' : self.toggle_clear_max_ratio_torrents_chk, - 'on_btn_testport_clicked': self.TestPort, + 'toggle_ui': self.toggle_ui }) self.preferences = preferences @@ -160,36 +155,41 @@ class PreferencesDlg: def TestPort(self, widget): common.open_url_in_browser('http://www.deluge-torrent.org/test-port.php?port=%s' % self.active_port) - - def tray_toggle(self, widget): - is_active = widget.get_active() - self.glade.get_widget("chk_min_on_close").set_sensitive(is_active) - self.glade.get_widget("chk_lock_tray").set_sensitive(is_active) - self.glade.get_widget("txt_tray_passwd").set_sensitive(is_active) - - def toggle_clear_max_ratio_torrents_chk(self, widget): - if(self.glade.get_widget("chk_autoseed").get_active()): - self.glade.get_widget("chk_clear_max_ratio_torrents").set_sensitive(True) - else: - self.glade.get_widget("chk_clear_max_ratio_torrents").set_active(False) - self.glade.get_widget("chk_clear_max_ratio_torrents").set_sensitive(False) - - def toggle_queue_above_completed_chk(self, widget): - if(self.glade.get_widget("chk_seedbottom").get_active()): - self.glade.get_widget("chk_queue_above_completed").set_sensitive(True) - else: - self.glade.get_widget("chk_queue_above_completed").set_active(False) - self.glade.get_widget("chk_queue_above_completed").set_sensitive(False) - - def toggle_move_chk(self, widget): - if(self.glade.get_widget("radio_ask_save").get_active()): - self.glade.get_widget("chk_move_completed").set_active(False) - self.glade.get_widget("chk_move_completed").set_sensitive(False) - self.glade.get_widget("finished_path_button").set_sensitive(False) - else: - self.glade.get_widget("chk_move_completed").set_sensitive(True) - self.glade.get_widget("finished_path_button").set_sensitive(True) + + def toggle_ui(self, widget): + value = widget.get_active() + print widget.get_name() + 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) + #self.toggle_ui(self.glade.get_widget('chk_move_completed')) + 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) + elif widget == self.glade.get_widget('chk_peer_proxy') or \ + widget == self.glade.get_widget('chk_tracker_proxy') or \ + widget == self.glade.get_widget('chk_dht_proxy'): + value = self.glade.get_widget('chk_peer_proxy').get_active() or self.glade.get_widget('chk_tracker_proxy').get_active() or self.glade.get_widget('chk_dht_proxy').get_active() + for x in ['combo_proxy_type', 'txt_proxy_hostname', 'txt_proxy_username', + 'spin_proxy_port', 'txt_proxy_password']: + self.glade.get_widget(x).set_sensitive(value) + elif widget == self.glade.get_widget('chk_use_tray'): + self.glade.get_widget('chk_min_on_close').set_sensitive(value) + self.glade.get_widget('chk_lock_tray').set_sensitive(value) + if not value: + self.glade.get_widget('chk_min_on_close').set_active(value) + self.glade.get_widget('chk_lock_tray').set_active(value) + elif widget == self.glade.get_widget('chk_lock_tray'): + self.glade.get_widget('txt_tray_passwd').set_sensitive(value) + + + + class FilesDlg: def __init__(self, manager, unique_id):