diff --git a/deluge/config.py b/deluge/config.py index f63b31c7a..2e2484a2c 100644 --- a/deluge/config.py +++ b/deluge/config.py @@ -317,6 +317,12 @@ what is currently in the config and it could not convert the value >>> del config["test"] """ del self.__config[key] + + global callLater + if callLater is None: + # Must import here and not at the top or it will throw ReactorAlreadyInstalledError + from twisted.internet.reactor import callLater + # We set the save_timer for 5 seconds if not already set if not self._save_timer or not self._save_timer.active(): self._save_timer = callLater(5, self.save) diff --git a/deluge/core/preferencesmanager.py b/deluge/core/preferencesmanager.py index 58dedfac7..8eb3bea9f 100644 --- a/deluge/core/preferencesmanager.py +++ b/deluge/core/preferencesmanager.py @@ -424,18 +424,10 @@ class PreferencesManager(component.Component): proxy_settings.username = value["username"] proxy_settings.password = value["password"] proxy_settings.hostname = value["hostname"] - proxy_settings.port = v["port"] - self.session.set_proxy(proxy_settings) - - def _on_set_i2p_proxy(self, key, value): - log.debug("Setting I2P proxy to: %s", value) - proxy_settings = lt.proxy_settings() - proxy_settings.hostname = value["hostname"] proxy_settings.port = value["port"] - try: - self.session.set_i2p_proxy(proxy_settings) - except RuntimeError as ex: - log.error("Unable to set I2P Proxy: %s", ex) + proxy_settings.proxy_hostnames = value["proxy_hostnames"] + proxy_settings.proxy_peer_connections = value["proxy_peer_connections"] + self.session.set_proxy(proxy_settings) def _on_set_i2p_proxy(self, key, value): log.debug("Setting I2P proxy to: %s", value) diff --git a/deluge/ui/console/modes/preference_panes.py b/deluge/ui/console/modes/preference_panes.py index 315b1b6a6..09350addf 100644 --- a/deluge/ui/console/modes/preference_panes.py +++ b/deluge/ui/console/modes/preference_panes.py @@ -104,12 +104,33 @@ class BasePane: for ipt in self.inputs: if not isinstance(ipt,NoInput): # gross, have to special case in/out ports since they are tuples - if ipt.name in ("listen_ports_to","listen_ports_from", - "out_ports_from","out_ports_to"): + if ipt.name in ("listen_ports_to", "listen_ports_from", "out_ports_from", "out_ports_to", + "i2p_port", "i2p_hostname", "proxy_type", "proxy_username", "proxy_hostnames", + "proxy_password", "proxy_hostname", "proxy_port", "proxy_peer_connections" + ): if ipt.name == "listen_ports_to": conf_dict["listen_ports"] = (self.infrom.get_value(),self.into.get_value()) - if ipt.name == "out_ports_to": + elif ipt.name == "out_ports_to": conf_dict["outgoing_ports"] = (self.outfrom.get_value(),self.outto.get_value()) + elif ipt.name == "i2p_port": + conf_dict.setdefault("i2p_proxy", {})["port"] = ipt.get_value() + elif ipt.name == "i2p_hostname": + conf_dict.setdefault("i2p_proxy", {})["hostname"] = ipt.get_value() + elif ipt.name == "proxy_type": + conf_dict.setdefault("proxy", {})["type"] = ipt.get_value() + elif ipt.name == "proxy_username": + conf_dict.setdefault("proxy", {})["username"] = ipt.get_value() + elif ipt.name == "proxy_password": + conf_dict.setdefault("proxy", {})["password"] = ipt.get_value() + elif ipt.name == "proxy_hostname": + conf_dict.setdefault("proxy", {})["hostname"] = ipt.get_value() + elif ipt.name == "proxy_port": + conf_dict.setdefault("proxy", {})["port"] = ipt.get_value() + elif ipt.name == "proxy_hostnames": + conf_dict.setdefault("proxy", {})["proxy_hostnames"] = ipt.get_value() + elif ipt.name == "proxy_peer_connections": + conf_dict.setdefault("proxy", {})["proxy_peer_connections"] = ipt.get_value() + else: conf_dict[ipt.name] = ipt.get_value() if hasattr(ipt,"get_child"): @@ -216,6 +237,55 @@ class BasePane: self.inputs.append(FloatSpinInput(self.parent,message,name,self.move,value,inc_amt,precision,min_val,max_val)) +class InterfacePane(BasePane): + def __init__(self, offset, parent, width): + BasePane.__init__(self,offset,parent,width) + self.add_header("General options", False) + + self.add_checked_input("ring_bell","Ring system bell when a download finishes",parent.console_config["ring_bell"]) + + self.add_header("New Console UI", True) + + self.add_checked_input("separate_complete","List complete torrents after incomplete regardless of sorting order",parent.console_config["separate_complete"]) + self.add_checked_input("move_selection","Move selection when moving torrents in the queue",parent.console_config["move_selection"]) + + self.add_header("Legacy Mode", True) + + self.add_checked_input("ignore_duplicate_lines","Do not store duplicate input in history",parent.console_config["ignore_duplicate_lines"]) + self.add_checked_input("save_legacy_history","Store and load command line history in Legacy mode",parent.console_config["save_legacy_history"]) + + self.add_header("", False) + + self.add_checked_input("third_tab_lists_all","Third tab lists all remaining torrents in legacy mode",parent.console_config["third_tab_lists_all"]) + self.add_int_spin_input("torrents_per_tab_press","Torrents per tab press",parent.console_config["torrents_per_tab_press"], 5, 100) + + +class ColumnsPane(BasePane): + def __init__(self, offset, parent, width): + BasePane.__init__(self,offset,parent,width) + self.add_header("Columns To Display", True) + + default_prefs = deluge.ui.console.modes.alltorrents.DEFAULT_PREFS + + for cpn in deluge.ui.console.modes.alltorrents.column_pref_names: + pn = "show_%s"%cpn + #If there is no option for it, it's not togglable + # We check in default_prefs because it might still exist in config files + if pn not in default_prefs: + continue + self.add_checked_input(pn, + deluge.ui.console.modes.alltorrents.prefs_to_names[cpn], + parent.console_config[pn]) + self.add_header("Column Widths (-1 = expand)",True) + for cpn in deluge.ui.console.modes.alltorrents.column_pref_names: + pn = "%s_width"%cpn + if pn not in default_prefs: + continue + self.add_int_spin_input(pn, + deluge.ui.console.modes.alltorrents.prefs_to_names[cpn], + parent.console_config[pn],-1,100) + + class DownloadsPane(BasePane): def __init__(self, offset, parent, width): BasePane.__init__(self,offset,parent,width) @@ -224,18 +294,18 @@ class DownloadsPane(BasePane): self.add_text_input("download_location","Download To:",parent.core_config["download_location"]) cmptxt = TextInput(self.parent,self.move,self.width,None,"move_completed_path",parent.core_config["move_completed_path"],False) self.add_checkedplus_input("move_completed","Move completed to:",cmptxt,parent.core_config["move_completed"]) - autotxt = TextInput(self.parent,self.move,self.width,None,"autoadd_location",parent.core_config["autoadd_location"],False) - self.add_checkedplus_input("autoadd_enable","Auto add .torrents from:",autotxt,parent.core_config["autoadd_enable"]) copytxt = TextInput(self.parent,self.move,self.width,None,"torrentfiles_location",parent.core_config["torrentfiles_location"],False) self.add_checkedplus_input("copy_torrent_file","Copy of .torrent files to:",copytxt,parent.core_config["copy_torrent_file"]) self.add_checked_input("del_copy_torrent_file","Delete copy of torrent file on remove",parent.core_config["del_copy_torrent_file"]) - self.add_header("Allocation",True) - self.add_checked_input("pre_allocate_storage", "Pre-Allocate disk space", parent.core_config["pre_allocate_storage"]) - self.add_header("Options",True) - self.add_checked_input("prioritize_first_last_pieces","Prioritize first and last pieces of torrent",parent.core_config["prioritize_first_last_pieces"]) - self.add_checked_input("add_paused","Add torrents in paused state",parent.core_config["add_paused"]) + self.add_checked_input("prioritize_first_last_pieces", "Prioritize first and last pieces of torrent", + parent.core_config["prioritize_first_last_pieces"]) + self.add_checked_input("sequential_download", "", + parent.core_config["sequential_download"]) + self.add_checked_input("add_paused", "Sequential_download", parent.core_config["add_paused"]) + self.add_checked_input("pre_allocate_storage", "Pre-Allocate disk space", + parent.core_config["pre_allocate_storage"]) class NetworkPane(BasePane): @@ -303,54 +373,6 @@ class BandwidthPane(BasePane): self.add_float_spin_input("max_download_speed_per_torrent","Maximum Download Speed (KiB/s):",parent.core_config["max_download_speed_per_torrent"],1.0,1,-1.0,60000.0) self.add_float_spin_input("max_upload_speed_per_torrent","Maximum Upload Speed (KiB/s):",parent.core_config["max_upload_speed_per_torrent"],1.0,1,-1.0,60000.0) -class InterfacePane(BasePane): - def __init__(self, offset, parent, width): - BasePane.__init__(self,offset,parent,width) - self.add_header("General options", False) - - self.add_checked_input("ring_bell","Ring system bell when a download finishes",parent.console_config["ring_bell"]) - - self.add_header("New Console UI", True) - - self.add_checked_input("separate_complete","List complete torrents after incomplete regardless of sorting order",parent.console_config["separate_complete"]) - self.add_checked_input("move_selection","Move selection when moving torrents in the queue",parent.console_config["move_selection"]) - - self.add_header("Legacy Mode", True) - - self.add_checked_input("ignore_duplicate_lines","Do not store duplicate input in history",parent.console_config["ignore_duplicate_lines"]) - self.add_checked_input("save_legacy_history","Store and load command line history in Legacy mode",parent.console_config["save_legacy_history"]) - - self.add_header("", False) - - self.add_checked_input("third_tab_lists_all","Third tab lists all remaining torrents in legacy mode",parent.console_config["third_tab_lists_all"]) - self.add_int_spin_input("torrents_per_tab_press","Torrents per tab press",parent.console_config["torrents_per_tab_press"], 5, 100) - - -class ColumnsPane(BasePane): - def __init__(self, offset, parent, width): - BasePane.__init__(self,offset,parent,width) - self.add_header("Columns To Display", True) - - default_prefs = deluge.ui.console.modes.alltorrents.DEFAULT_PREFS - - for cpn in deluge.ui.console.modes.alltorrents.column_pref_names: - pn = "show_%s"%cpn - #If there is no option for it, it's not togglable - # We check in default_prefs because it might still exist in config files - if pn not in default_prefs: - continue - self.add_checked_input(pn, - deluge.ui.console.modes.alltorrents.prefs_to_names[cpn], - parent.console_config[pn]) - self.add_header("Column Widths (-1 = expand)",True) - for cpn in deluge.ui.console.modes.alltorrents.column_pref_names: - pn = "%s_width"%cpn - if pn not in default_prefs: - continue - self.add_int_spin_input(pn, - deluge.ui.console.modes.alltorrents.prefs_to_names[cpn], - parent.console_config[pn],-1,100) - class OtherPane(BasePane): def __init__(self, offset, parent, width): BasePane.__init__(self,offset,parent,width) @@ -393,8 +415,26 @@ class QueuePane(BasePane): class ProxyPane(BasePane): def __init__(self, offset, parent, width): - BasePane.__init__(self,offset,parent,width) - self.add_header("Proxy Settings Comming Soon") + BasePane.__init__(self, offset, parent, width) + self.add_header("Proxy Settings") + self.add_header("Proxy", True) + proxy = parent.core_config["proxy"] + self.add_int_spin_input("proxy_type","Type:", proxy["type"],0,5) + self.add_info_field(" 0: None 1: Socks4 2: Socks5", "", "") + self.add_info_field(" 3: Socks5 Auth 4: HTTP 5: HTTP Auth", "", "") + self.add_text_input("proxy_username", "Username:", proxy["username"]) + self.add_text_input("proxy_password", "Password:", proxy["password"]) + self.add_text_input("proxy_hostname", "Hostname:", proxy["hostname"]) + self.add_int_spin_input("proxy_port", "Port:", proxy["port"], 0, 65535) + self.add_checked_input("proxy_hostnames", "Proxy hostnames", proxy["proxy_hostnames"]) + self.add_checked_input("proxy_peer_connections", "Proxy peer connections", proxy["proxy_peer_connections"]) + + + self.add_header("I2P Proxy",True) + i2p_proxy = parent.core_config["i2p_proxy"] + self.add_text_input("i2p_hostname", "Hostname:", i2p_proxy["hostname"]) + self.add_int_spin_input("i2p_port", "Port:", i2p_proxy["port"], 0, 65535) + class CachePane(BasePane): def __init__(self, offset, parent, width): diff --git a/deluge/ui/gtkui/glade/preferences_dialog.ui b/deluge/ui/gtkui/glade/preferences_dialog.ui index 5c5f48d9b..54e302f44 100644 --- a/deluge/ui/gtkui/glade/preferences_dialog.ui +++ b/deluge/ui/gtkui/glade/preferences_dialog.ui @@ -2,86 +2,6 @@ - - 1 - 32000 - 60 - 1 - 10 - - - 999999 - 100 - 1 - 10 - - - 0.5 - 100 - 2 - 0.10000000000000001 - 1 - - - -1 - 100 - 1.5 - 0.10000000000000001 - 10 - - - -1 - 9999 - 1 - 10 - - - 65535 - 1 - 10 - - - -1 - 9999 - 1 - 10 - - - -1 - 9999 - 1 - 10 - - - -1 - 9999 - 1 - 10 - - - -1 - 9999 - 1 - 10 - - - -1 - 2097151 - 1 - 10 - - - -1 - 2097151 - 1 - 10 - - - -1 - 9999 - 1 - 10 - -1 2097151 @@ -126,23 +46,93 @@ 1 10 - + 65535 1 10 - + + 1 + 32000 + 60 + 1 + 10 + + + 999999 + 100 + 1 + 10 + + + 0.5 + 100 + 2 + 0.10000000000000001 + 1 + + + -1 + 100 + 1.5 + 0.10000000000000001 + 10 + + + -1 + 9999 + 1 + 10 + + 65535 1 10 - + + -1 + 9999 + 1 + 10 + + 65535 1 10 - - 65535 + + -1 + 9999 + 1 + 10 + + + -1 + 9999 + 1 + 10 + + + -1 + 9999 + 1 + 10 + + + -1 + 2097151 + 1 + 10 + + + -1 + 2097151 + 1 + 10 + + + -1 + 9999 1 10 @@ -216,110 +206,6 @@ - - - - - - - - None - - - Socksv4 - - - Socksv5 - - - Socksv5 W/ Auth - - - HTTP - - - HTTP W/ Auth - - - - - - - - - - - None - - - Socksv4 - - - Socksv5 - - - Socksv5 W/ Auth - - - HTTP - - - HTTP W/ Auth - - - - - - - - - - - None - - - Socksv4 - - - Socksv5 - - - Socksv5 W/ Auth - - - HTTP - - - HTTP W/ Auth - - - - - - - - - - - None - - - Socksv4 - - - Socksv5 - - - Socksv5 W/ Auth - - - HTTP - - - HTTP W/ Auth - - - @@ -328,6 +214,32 @@ + + + + + + + + None + + + Socks4 + + + Socks5 + + + Socks5 Auth + + + HTTP + + + HTTP Auth + + + False 5 @@ -352,6 +264,7 @@ gtk-cancel + False True True True @@ -367,6 +280,7 @@ gtk-apply + False True True True @@ -382,6 +296,7 @@ gtk-ok + False True True True @@ -497,6 +412,7 @@ Standalone + False True True False @@ -513,6 +429,7 @@ Thin Client + False True True False @@ -569,6 +486,7 @@ Show session speed in titlebar + False True True False @@ -583,6 +501,7 @@ Focus window when adding torrent + False True True False @@ -595,6 +514,35 @@ 1 + + + False + True + True + False + Besides being experimental, using the pieces bar +will increase the bandwidth used between client +and daemon(does not apply in classic mode). +Use at your own risk if you wish to help us debug +this new feature. + True + + + + True + False + Show a pieces bar in the torrent's +status tab (<b>EXPERIMENTAL!!!</b>) + True + + + + + True + True + 2 + + True @@ -624,6 +572,7 @@ + False True True True @@ -634,7 +583,7 @@ 1 2 - + @@ -652,6 +601,7 @@ + False True True True @@ -664,7 +614,7 @@ 2 1 2 - + @@ -682,6 +632,7 @@ + False True True True @@ -694,7 +645,7 @@ 2 2 3 - + @@ -712,6 +663,7 @@ + False True True True @@ -724,12 +676,13 @@ 2 3 4 - + gtk-revert-to-saved + False True False True @@ -742,12 +695,13 @@ 2 3 - + gtk-revert-to-saved + False True False True @@ -762,12 +716,13 @@ 3 1 2 - + gtk-revert-to-saved + False True False True @@ -782,12 +737,13 @@ 3 2 3 - + gtk-revert-to-saved + False True False True @@ -802,7 +758,7 @@ 3 3 4 - + @@ -823,34 +779,6 @@ 2 - - - True - True - False - Besides being experimental, using the pieces bar -will increase the bandwidth used between client -and daemon(does not apply in classic mode). -Use at your own risk if you wish to help us debug -this new feature. - True - - - - True - False - Show a pieces bar in the torrent's -status tab (<b>EXPERIMENTAL!!!</b>) - True - - - - - True - True - 2 - - @@ -893,6 +821,7 @@ status tab (<b>EXPERIMENTAL!!!</b>) Always show + False True True False @@ -912,6 +841,7 @@ status tab (<b>EXPERIMENTAL!!!</b>) Bring the dialog to focus + False True True False @@ -967,6 +897,7 @@ status tab (<b>EXPERIMENTAL!!!</b>) Enable system tray icon + False True False False @@ -988,6 +919,7 @@ status tab (<b>EXPERIMENTAL!!!</b>) Minimize to tray on close + False True False False @@ -1011,6 +943,7 @@ status tab (<b>EXPERIMENTAL!!!</b>) Start in tray + False True False False @@ -1034,6 +967,7 @@ status tab (<b>EXPERIMENTAL!!!</b>) Enable Application Indicator + False True False False @@ -1058,6 +992,7 @@ status tab (<b>EXPERIMENTAL!!!</b>) Password protect system tray + False True False True @@ -1167,6 +1102,7 @@ status tab (<b>EXPERIMENTAL!!!</b>) System Default + False True True False @@ -1302,6 +1238,7 @@ status tab (<b>EXPERIMENTAL!!!</b>) Move completed to: + False True True False @@ -1317,6 +1254,7 @@ status tab (<b>EXPERIMENTAL!!!</b>) Copy of .torrent files to: + False True True False @@ -1332,6 +1270,7 @@ status tab (<b>EXPERIMENTAL!!!</b>) Delete copy of torrent file on remove + False True True False @@ -1456,6 +1395,7 @@ status tab (<b>EXPERIMENTAL!!!</b>) Prioritize first and last pieces of torrent + False True True False @@ -1471,6 +1411,7 @@ status tab (<b>EXPERIMENTAL!!!</b>) Sequential download + False True True False @@ -1491,6 +1432,7 @@ used sparingly. Add torrents in Paused state + False True True False @@ -1505,6 +1447,7 @@ used sparingly. Pre-allocate disk space + False True True False @@ -1749,6 +1692,7 @@ used sparingly. Random + False True True False @@ -1823,6 +1767,7 @@ used sparingly. Test Active Port + False True True True @@ -1974,6 +1919,7 @@ used sparingly. Random + False True True False @@ -2196,6 +2142,7 @@ used sparingly. UPnP + False True True False @@ -2211,6 +2158,7 @@ used sparingly. NAT-PMP + False True True False @@ -2228,6 +2176,7 @@ used sparingly. Peer Exchange + False True True False @@ -2244,6 +2193,7 @@ used sparingly. Tracker Exchange + False True True False @@ -2262,6 +2212,7 @@ used sparingly. LSD + False True True False @@ -2277,6 +2228,7 @@ used sparingly. DHT + False True True False @@ -2686,6 +2638,7 @@ Requires a Hex value. Ignore limits on local network + False True True False @@ -2708,6 +2661,7 @@ Requires a Hex value. Rate limit IP overhead + False True True False @@ -3020,6 +2974,7 @@ Requires a Hex value. Be alerted about new releases + False True True False @@ -3095,6 +3050,7 @@ Requires a Hex value. Yes, please send anonymous statistics + False True True False @@ -3228,6 +3184,7 @@ Requires a Hex value. start + False True True True @@ -3440,6 +3397,7 @@ Requires a Hex value. Allow Remote Connections + False True True False @@ -3481,6 +3439,7 @@ Requires a Hex value. Periodically check the website for new releases + False True True False @@ -3543,6 +3502,7 @@ Requires a Hex value. gtk-add + False True True True @@ -3558,6 +3518,7 @@ Requires a Hex value. gtk-edit + False True False True @@ -3574,6 +3535,7 @@ Requires a Hex value. gtk-delete + False True False True @@ -3710,6 +3672,7 @@ Requires a Hex value. Queue new torrents to top + False True True False @@ -3782,7 +3745,7 @@ Requires a Hex value. 1 2 - + @@ -3803,7 +3766,7 @@ Requires a Hex value. 2 2 3 - + @@ -3848,7 +3811,7 @@ Requires a Hex value. 2 1 2 - + @@ -3874,6 +3837,7 @@ Requires a Hex value. Do not count slow torrents + False True True False @@ -3888,6 +3852,7 @@ Requires a Hex value. Prefer Seeding over Downloading + False True True False @@ -3997,7 +3962,7 @@ Requires a Hex value. 1 2 - + @@ -4018,7 +3983,7 @@ Requires a Hex value. 2 1 2 - + @@ -4038,7 +4003,7 @@ Requires a Hex value. 2 2 3 - + @@ -4056,6 +4021,7 @@ Requires a Hex value. Stop seeding when share ratio reaches: + False True True False @@ -4103,6 +4069,7 @@ Requires a Hex value. Remove torrent when share ratio reached + False True False True @@ -4219,7 +4186,7 @@ Requires a Hex value. False 5 - + True False 0 @@ -4228,17 +4195,18 @@ Requires a Hex value. True False + 5 12 12 True False - 5 + 7 2 5 - + True False 0 @@ -4251,7 +4219,7 @@ Requires a Hex value. - + True True False @@ -4270,11 +4238,11 @@ Requires a Hex value. - + True False 0 - Host: + Hostname: 3 @@ -4283,7 +4251,7 @@ Requires a Hex value. - + True True True @@ -4300,10 +4268,10 @@ Requires a Hex value. - + True False - 0 + 1 Port: @@ -4313,20 +4281,20 @@ Requires a Hex value. - + True False 0 0 - + True True False False True True - adjustment_spin_proxy_port_peer + adjustment_spin_proxy_port True @@ -4340,7 +4308,7 @@ Requires a Hex value. - + True True True @@ -4358,10 +4326,10 @@ Requires a Hex value. - + True False - liststore4 + liststore_proxy @@ -4371,26 +4339,13 @@ Requires a Hex value. - 1 2 GTK_FILL - + - - True - False - 0 - Type: - - - GTK_FILL - - - - - + True False 0 @@ -4402,15 +4357,53 @@ Requires a Hex value. GTK_FILL + + + Proxy Hostnames + False + True + True + False + Hostnames should be attempted to be resolved through +the proxy instead of using the local DNS service + True + True + + + 2 + 5 + 6 + GTK_FILL + + + + + Proxy Peer Connections + False + True + True + False + Proxy peer and web seed connections. + 0.49000000953674316 + True + True + + + 2 + 6 + 7 + GTK_FILL + + - + True False - Peer + Proxy @@ -4424,7 +4417,7 @@ Requires a Hex value. - + True False 0 @@ -4433,62 +4426,30 @@ Requires a Hex value. True False + 5 12 12 True False - 5 + 2 2 5 + 2 - + True False 0 - Password: + Hostname: - 2 - 3 GTK_FILL - - True - True - False - True - False - False - True - True - - - 1 - 2 - 2 - 3 - GTK_FILL - - - - - True - False - 0 - Host: - - - 3 - 4 - GTK_FILL - - - - + True True True @@ -4500,38 +4461,36 @@ Requires a Hex value. 1 2 - 3 - 4 - + True False - 0 + 1 Port: - 4 - 5 + 1 + 2 GTK_FILL - + True False 0 0 - + True True False False True True - adjustment_spin_proxy_port_web_seed + adjustment_spin_i2p_port True @@ -4539,69 +4498,6 @@ Requires a Hex value. 1 2 - 4 - 5 - GTK_FILL - - - - - True - True - True - False - False - True - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - False - liststore5 - - - - - 0 - - - - - 1 - 2 - GTK_FILL - - - - - - True - False - 0 - Type: - - - GTK_FILL - - - - - - True - False - 0 - Username: - - 1 2 GTK_FILL @@ -4612,10 +4508,10 @@ Requires a Hex value. - + True False - Web Seed + I2P Proxy @@ -4625,423 +4521,10 @@ Requires a Hex value. False False + 5 1 - - - True - False - 0 - none - - - True - False - 12 - 12 - - - True - False - 5 - 2 - 5 - - - True - False - 0 - Password: - - - 2 - 3 - GTK_FILL - - - - - True - True - False - True - False - False - True - True - - - 1 - 2 - 2 - 3 - GTK_FILL - - - - - True - False - 0 - Host: - - - 3 - 4 - GTK_FILL - - - - - True - True - True - False - False - True - True - - - 1 - 2 - 3 - 4 - - - - - True - False - 0 - Port: - - - 4 - 5 - GTK_FILL - - - - - True - False - 0 - 0 - - - True - True - False - False - True - True - adjustment_spin_proxy_port_tracker - True - - - - - 1 - 2 - 4 - 5 - GTK_FILL - - - - - True - True - True - False - False - True - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - False - liststore6 - - - - - 0 - - - - - 1 - 2 - GTK_FILL - - - - - - True - False - 0 - Type: - - - GTK_FILL - - - - - - True - False - 0 - Username: - - - 1 - 2 - GTK_FILL - - - - - - - - - True - False - Tracker - - - - - - - - False - False - 2 - - - - - True - False - 0 - none - - - True - False - 12 - 12 - - - True - False - 5 - 2 - 5 - - - True - False - 0 - Password: - - - 2 - 3 - GTK_FILL - - - - - - True - True - False - True - False - False - True - True - - - 1 - 2 - 2 - 3 - GTK_FILL - - - - - True - False - 0 - Host: - - - 3 - 4 - GTK_FILL - - - - - - True - True - True - False - False - True - True - - - 1 - 2 - 3 - 4 - - - - - True - False - 0 - Port: - - - 4 - 5 - GTK_FILL - - - - - - True - False - 0 - 0 - - - True - True - False - False - True - True - adjustment_spin_proxy_port_dht - True - - - - - 1 - 2 - 4 - 5 - GTK_FILL - - - - - True - True - True - False - False - True - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - False - liststore7 - - - - - 0 - - - - - 1 - 2 - GTK_FILL - - - - - - True - False - 0 - Type: - - - GTK_FILL - - - - - - True - False - 0 - Username: - - - 1 - 2 - GTK_FILL - - - - - - - - - - True - False - DHT - - - - - - - - False - False - 3 - - True @@ -5181,7 +4664,7 @@ Requires a Hex value. 1 2 - + @@ -5203,7 +4686,7 @@ Requires a Hex value. 2 1 2 - + @@ -5311,7 +4794,7 @@ Requires a Hex value. 1 2 - + @@ -5325,7 +4808,7 @@ Requires a Hex value. 2 1 2 - + @@ -5339,7 +4822,7 @@ Requires a Hex value. 2 2 3 - + @@ -5430,7 +4913,7 @@ Requires a Hex value. 1 2 - + @@ -5444,7 +4927,7 @@ Requires a Hex value. 2 1 2 - + @@ -5458,7 +4941,7 @@ Requires a Hex value. 2 3 4 - + @@ -5486,7 +4969,7 @@ Requires a Hex value. 2 2 3 - + @@ -5562,7 +5045,7 @@ Requires a Hex value. 1 2 - + @@ -5576,7 +5059,7 @@ Requires a Hex value. 2 1 2 - + @@ -5608,6 +5091,7 @@ Requires a Hex value. gtk-refresh + False True True True @@ -5781,7 +5265,7 @@ Requires a Hex value. 2 4 5 - + @@ -5795,7 +5279,7 @@ Requires a Hex value. 2 1 2 - + @@ -5807,7 +5291,7 @@ Requires a Hex value. 1 2 - + @@ -5836,7 +5320,7 @@ Requires a Hex value. 1 2 GTK_FILL - + @@ -5848,7 +5332,7 @@ Requires a Hex value. GTK_FILL - + @@ -5890,7 +5374,7 @@ Requires a Hex value. 2 3 4 - + @@ -5904,7 +5388,7 @@ Requires a Hex value. 2 2 3 - + @@ -5945,6 +5429,7 @@ Requires a Hex value. center + False True True True @@ -5991,6 +5476,7 @@ Requires a Hex value. + False True True True @@ -6048,6 +5534,7 @@ Requires a Hex value. False + False True True True diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py index e497b5c0a..2e178f183 100644 --- a/deluge/ui/gtkui/preferences.py +++ b/deluge/ui/gtkui/preferences.py @@ -407,6 +407,15 @@ class Preferences(component.Component): "chk_remove_ratio": ("active", "remove_seed_at_ratio"), "spin_cache_size": ("value", "cache_size"), "spin_cache_expiry": ("value", "cache_expiry"), + "combo_proxy_type": ("active", lambda: self.core_config["proxy"]["type"]), + "entry_proxy_user": ("text", lambda: self.core_config["proxy"]["username"]), + "entry_proxy_pass": ("text", lambda: self.core_config["proxy"]["password"]), + "entry_proxy_host": ("text", lambda: self.core_config["proxy"]["hostname"]), + "spin_proxy_port": ("value", lambda: self.core_config["proxy"]["port"]), + "chk_proxy_host_resolve": ("active", lambda: self.core_config["proxy"]["proxy_hostnames"]), + "chk_proxy_peer_conn": ("active", lambda: self.core_config["proxy"]["proxy_peer_connections"]), + "entry_i2p_host": ("text", lambda: self.core_config["i2p_proxy"]["hostname"]), + "spin_i2p_port": ("value", lambda: self.core_config["i2p_proxy"]["port"]), "accounts_add": (None, None), "accounts_listview": (None, None), "button_cache_refresh": (None, None), @@ -417,24 +426,6 @@ class Preferences(component.Component): "plugin_listview": (None, None), } - # Add proxy stuff - for t in ("peer", "web_seed", "tracker", "dht"): - core_widgets["spin_proxy_port_%s" % t] = ( - "value", lambda: self.core_config["proxies"][t]["port"] - ) - core_widgets["combo_proxy_type_%s" % t] = ( - "active", lambda: self.core_config["proxies"][t]["type"] - ) - core_widgets["txt_proxy_server_%s" % t] = ( - "text", lambda: self.core_config["proxies"][t]["hostname"] - ) - core_widgets["txt_proxy_username_%s" % t] = ( - "text", lambda: self.core_config["proxies"][t]["username"] - ) - core_widgets["txt_proxy_password_%s" % t] = ( - "text", lambda: self.core_config["proxies"][t]["password"] - ) - core_widgets[self.download_location_path_chooser] = ("path_chooser", "download_location") core_widgets[self.move_completed_path_chooser] = ("path_chooser", "move_completed_path") core_widgets[self.copy_torrent_files_path_chooser] = ("path_chooser", "torrentfiles_location") @@ -698,19 +689,18 @@ class Preferences(component.Component): self.builder.get_object("chk_new_releases").get_active() ## Proxy tab ## - new_core_config["proxies"] = {} - for t in ("peer", "web_seed", "tracker", "dht"): - new_core_config["proxies"][t] = {} - new_core_config["proxies"][t]["type"] = \ - self.builder.get_object("combo_proxy_type_%s" % t).get_active() - new_core_config["proxies"][t]["port"] = \ - self.builder.get_object("spin_proxy_port_%s" % t).get_value_as_int() - new_core_config["proxies"][t]["username"] = \ - self.builder.get_object("txt_proxy_username_%s" % t).get_text() - new_core_config["proxies"][t]["password"] = \ - self.builder.get_object("txt_proxy_password_%s" % t).get_text() - new_core_config["proxies"][t]["hostname"] = \ - self.builder.get_object("txt_proxy_server_%s" % t).get_text() + new_core_config["proxy"] = {} + new_core_config["proxy"]["type"] = self.builder.get_object("combo_proxy_type").get_active() + new_core_config["proxy"]["username"] = self.builder.get_object("entry_proxy_user").get_text() + new_core_config["proxy"]["password"] = self.builder.get_object("entry_proxy_pass").get_text() + new_core_config["proxy"]["hostname"] = self.builder.get_object("entry_proxy_host").get_text() + new_core_config["proxy"]["port"] = self.builder.get_object("spin_proxy_port").get_value_as_int() + new_core_config["proxy"]["proxy_hostnames"] = self.builder.get_object("chk_proxy_host_resolve").get_active() + new_core_config["proxy"]["proxy_peer_connections"] = self.builder.get_object( + "chk_proxy_peer_conn").get_active() + new_core_config["i2p_proxy"] = {} + new_core_config["i2p_proxy"]["hostname"] = self.builder.get_object("entry_i2p_host").get_text() + new_core_config["i2p_proxy"]["port"] = self.builder.get_object("spin_i2p_port").get_value_as_int() ## Queue tab ## new_core_config["queue_new_to_top"] = \ @@ -1049,31 +1039,32 @@ class Preferences(component.Component): combo_enclevel.set_sensitive(True) def _on_combo_proxy_type_changed(self, widget): - name = widget.get_name().replace("combo_proxy_type_", "") - proxy_type = widget.get_model()[widget.get_active()][0] + proxy_type = self.builder.get_object("combo_proxy_type").get_active() - prefixes = ["txt_proxy_", "label_proxy_", "spin_proxy_"] hides = [] shows = [] + # 0:"None" + if proxy_type == 0: + hides.extend(["entry_proxy_pass", "entry_proxy_user", "entry_proxy_host", "spin_proxy_port", + "label_proxy_pass", "label_proxy_user", "label_proxy_host", "label_proxy_port", + "chk_proxy_host_resolve", "chk_proxy_peer_conn"]) + # 1:"Socks4", 2:"Socks5", 4:"HTTP" + elif proxy_type in (1, 2, 4): + if proxy_type in (2, 4): + shows.extend(["chk_proxy_host_resolve"]) + hides.extend(["entry_proxy_pass", "entry_proxy_user", "label_proxy_pass", "label_proxy_user"]) + shows.extend(["entry_proxy_host", "spin_proxy_port", "label_proxy_host", + "label_proxy_port", "chk_proxy_peer_conn"]) + # 3:"Socks5 Auth", 5:"HTTP Auth" + elif proxy_type in (3, 5): + shows.extend(["entry_proxy_pass", "entry_proxy_user", "entry_proxy_host", "spin_proxy_port", + "label_proxy_pass", "label_proxy_user", "label_proxy_host", "label_proxy_port", + "chk_proxy_host_resolve", "chk_proxy_peer_conn"]) - if proxy_type == "None": - hides.extend(["password", "username", "server", "port"]) - elif proxy_type in ("Socksv4", "Socksv5", "HTTP"): - hides.extend(["password", "username"]) - shows.extend(["server", "port"]) - elif proxy_type in ("Socksv5 W/ Auth", "HTTP W/ Auth"): - shows.extend(["password", "username", "server", "port"]) - - for h in hides: - for p in prefixes: - w = self.builder.get_object(p + h + "_" + name) - if w: - w.hide() - for s in shows: - for p in prefixes: - w = self.builder.get_object(p + s + "_" + name) - if w: - w.show() + for hide_entry in hides: + self.builder.get_object(hide_entry).hide() + for show_entry in shows: + self.builder.get_object(show_entry).show() def _on_button_associate_magnet_clicked(self, widget): common.associate_magnet_links(True) diff --git a/deluge/ui/web/js/deluge-all/preferences/DownloadsPage.js b/deluge/ui/web/js/deluge-all/preferences/DownloadsPage.js index ad651494f..0003b55d4 100644 --- a/deluge/ui/web/js/deluge-all/preferences/DownloadsPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/DownloadsPage.js @@ -86,14 +86,6 @@ Deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, { optMan.bind('copy_torrent_file', field.toggle); optMan.bind('torrentfiles_location', field.input); - field = fieldset.add({ - name: 'autoadd_location', - fieldLabel: _('Autoadd .torrent files from'), - width: 280 - }); - optMan.bind('autoadd_enable', field.toggle); - optMan.bind('autoadd_location', field.input); - fieldset = this.add({ xtype: 'fieldset', border: false, diff --git a/deluge/ui/web/js/deluge-all/preferences/ProxyField.js b/deluge/ui/web/js/deluge-all/preferences/ProxyField.js index fe969b9ba..ed910ca72 100644 --- a/deluge/ui/web/js/deluge-all/preferences/ProxyField.js +++ b/deluge/ui/web/js/deluge-all/preferences/ProxyField.js @@ -45,7 +45,8 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { Deluge.preferences.ProxyField.superclass.initComponent.call(this); this.proxyType = this.add({ xtype: 'combo', - fieldLabel: _('Type'), + fieldLabel: _('Type:'), + labelSeparator: '', name: 'proxytype', mode: 'local', width: 150, @@ -53,11 +54,11 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { fields: ['id', 'text'], data: [ [0, _('None')], - [1, _('Socksv4')], - [2, _('Socksv5')], - [3, _('Socksv5 with Auth')], + [1, _('Socks4')], + [2, _('Socks5')], + [3, _('Socks5 Auth')], [4, _('HTTP')], - [5, _('HTTP with Auth')] + [5, _('HTTP Auth')] ] }), editable: false, @@ -71,7 +72,8 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { this.hostname = this.add({ xtype: 'textfield', name: 'hostname', - fieldLabel: _('Host'), + fieldLabel: _('Host:'), + labelSeparator: '', width: 220 }); this.hostname.on('change', this.onFieldChange, this); @@ -79,18 +81,20 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { this.port = this.add({ xtype: 'spinnerfield', name: 'port', - fieldLabel: _('Port'), + fieldLabel: _('Port:'), + labelSeparator: '', width: 80, decimalPrecision: 0, - minValue: -1, - maxValue: 99999 + minValue: 0, + maxValue: 65535 }); this.port.on('change', this.onFieldChange, this); this.username = this.add({ xtype: 'textfield', name: 'username', - fieldLabel: _('Username'), + fieldLabel: _('Username:'), + labelSeparator: '', width: 220 }); this.username.on('change', this.onFieldChange, this); @@ -98,12 +102,31 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { this.password = this.add({ xtype: 'textfield', name: 'password', - fieldLabel: _('Password'), + fieldLabel: _('Password:'), + labelSeparator: '', inputType: 'password', width: 220 }); this.password.on('change', this.onFieldChange, this); + this.proxy_host_resolve = this.add({ + xtype: 'checkbox', + name: 'proxy_host_resolve', + fieldLabel: '', + boxLabel: _('Proxy Hostnames'), + width: 220 + }); + this.proxy_host_resolve.on('change', this.onFieldChange, this); + + this.proxy_peer_conn = this.add({ + xtype: 'checkbox', + name: 'proxy_peer_conn', + fieldLabel: '', + boxLabel: _('Proxy Peer Connections'), + width: 220 + }); + this.proxy_peer_conn.on('change', this.onFieldChange, this); + this.setting = false; }, @@ -117,7 +140,9 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { 'hostname': this.hostname.getValue(), 'port': Number(this.port.getValue()), 'username': this.username.getValue(), - 'password': this.password.getValue() + 'password': this.password.getValue(), + 'proxy_hostnames': this.proxy_host_resolve.getValue(), + 'proxy_peer_connections': this.proxy_peer_conn.getValue(), } }, @@ -132,6 +157,9 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { this.port.setValue(value['port']); this.username.setValue(value['username']); this.password.setValue(value['password']); + this.proxy_host_resolve.setValue(value['proxy_hostnames']); + this.proxy_peer_conn.setValue(value['proxy_peer_connections']); + this.onTypeSelect(this.type, record, index); this.setting = false; }, @@ -150,9 +178,15 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, { if (typeId > 0) { this.hostname.show(); this.port.show(); + this.proxy_peer_conn.show(); + if (typeId != 1) { + this.proxy_host_resolve.show(); + } } else { this.hostname.hide(); this.port.hide(); + this.proxy_host_resolve.hide(); + this.proxy_peer_conn.hide(); } if (typeId == 3 || typeId == 5) { diff --git a/deluge/ui/web/js/deluge-all/preferences/ProxyI2PField.js b/deluge/ui/web/js/deluge-all/preferences/ProxyI2PField.js new file mode 100644 index 000000000..fa642ea1f --- /dev/null +++ b/deluge/ui/web/js/deluge-all/preferences/ProxyI2PField.js @@ -0,0 +1,95 @@ +/*! + * Deluge.preferences.ProxyI2PField.js + * + * Copyright (c) Damien Churchill 2009-2010 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, write to: + * The Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1301, USA. + * + * In addition, as a special exception, the copyright holders give + * permission to link the code of portions of this program with the OpenSSL + * library. + * You must obey the GNU General Public License in all respects for all of + * the code used other than OpenSSL. If you modify file(s) with this + * exception, you may extend this exception to your version of the file(s), + * but you are not obligated to do so. If you do not wish to do so, delete + * this exception statement from your version. If you delete this exception + * statement from all source files in the program, then also delete it here. + */ +Ext.ns('Deluge.preferences'); + +/** + * @class Deluge.preferences.ProxyI2PField + * @extends Ext.form.FieldSet + */ +Deluge.preferences.ProxyI2PField = Ext.extend(Ext.form.FieldSet, { + + border: false, + autoHeight: true, + labelWidth: 70, + + initComponent: function() { + Deluge.preferences.ProxyI2PField.superclass.initComponent.call(this); + this.hostname = this.add({ + xtype: 'textfield', + name: 'hostname', + fieldLabel: _('Host'), + width: 220 + }); + this.hostname.on('change', this.onFieldChange, this); + + this.port = this.add({ + xtype: 'spinnerfield', + name: 'port', + fieldLabel: _('Port'), + width: 80, + decimalPrecision: 0, + minValue: 0, + maxValue: 65535 + }); + this.port.on('change', this.onFieldChange, this); + + this.setting = false; + }, + + getName: function() { + return this.initialConfig.name; + }, + + getValue: function() { + return { + 'hostname': this.hostname.getValue(), + 'port': Number(this.port.getValue()), + } + }, + + // Set the values of the proxies + setValue: function(value) { + this.setting = true; + this.hostname.setValue(value['hostname']); + this.port.setValue(value['port']); + this.setting = false; + }, + + onFieldChange: function(field, newValue, oldValue) { + if (this.setting) return; + var newValues = this.getValue(); + var oldValues = Ext.apply({}, newValues); + oldValues[field.getName()] = oldValue; + + this.fireEvent('change', this, newValues, oldValues); + }, +}); diff --git a/deluge/ui/web/js/deluge-all/preferences/ProxyPage.js b/deluge/ui/web/js/deluge-all/preferences/ProxyPage.js index 0cb61a439..afb3a4d72 100644 --- a/deluge/ui/web/js/deluge-all/preferences/ProxyPage.js +++ b/deluge/ui/web/js/deluge-all/preferences/ProxyPage.js @@ -48,39 +48,23 @@ Deluge.preferences.Proxy = Ext.extend(Ext.form.FormPanel, { initComponent: function() { Deluge.preferences.Proxy.superclass.initComponent.call(this); - this.peer = this.add(new Deluge.preferences.ProxyField({ - title: _('Peer'), - name: 'peer' + this.proxy = this.add(new Deluge.preferences.ProxyField({ + title: _('Proxy'), + name: 'proxy' })); - this.peer.on('change', this.onProxyChange, this); + this.proxy.on('change', this.onProxyChange, this); + deluge.preferences.getOptionsManager().bind('proxy', this.proxy); - this.web_seed = this.add(new Deluge.preferences.ProxyField({ - title: _('Web Seed'), - name: 'web_seed' + this.i2p_proxy = this.add(new Deluge.preferences.ProxyI2PField({ + title: _('I2P Proxy'), + name: 'i2p_proxy' })); - this.web_seed.on('change', this.onProxyChange, this); - - this.tracker = this.add(new Deluge.preferences.ProxyField({ - title: _('Tracker'), - name: 'tracker' - })); - this.tracker.on('change', this.onProxyChange, this); - - this.dht = this.add(new Deluge.preferences.ProxyField({ - title: _('DHT'), - name: 'dht' - })); - this.dht.on('change', this.onProxyChange, this); - - deluge.preferences.getOptionsManager().bind('proxies', this); + deluge.preferences.getOptionsManager().bind('i2p_proxy', this.i2p_proxy); }, getValue: function() { return { - 'dht': this.dht.getValue(), - 'peer': this.peer.getValue(), - 'tracker': this.tracker.getValue(), - 'web_seed': this.web_seed.getValue() + 'proxy': this.proxy.getValue(), } },