mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-17 15:48:47 +00:00
[#2219] Update the UIs for single Proxy and I2P Proxy
This commit is contained in:
parent
fa0911dbdf
commit
14a55133af
9 changed files with 598 additions and 977 deletions
|
@ -317,6 +317,12 @@ what is currently in the config and it could not convert the value
|
||||||
>>> del config["test"]
|
>>> del config["test"]
|
||||||
"""
|
"""
|
||||||
del self.__config[key]
|
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
|
# We set the save_timer for 5 seconds if not already set
|
||||||
if not self._save_timer or not self._save_timer.active():
|
if not self._save_timer or not self._save_timer.active():
|
||||||
self._save_timer = callLater(5, self.save)
|
self._save_timer = callLater(5, self.save)
|
||||||
|
|
|
@ -424,18 +424,10 @@ class PreferencesManager(component.Component):
|
||||||
proxy_settings.username = value["username"]
|
proxy_settings.username = value["username"]
|
||||||
proxy_settings.password = value["password"]
|
proxy_settings.password = value["password"]
|
||||||
proxy_settings.hostname = value["hostname"]
|
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"]
|
proxy_settings.port = value["port"]
|
||||||
try:
|
proxy_settings.proxy_hostnames = value["proxy_hostnames"]
|
||||||
self.session.set_i2p_proxy(proxy_settings)
|
proxy_settings.proxy_peer_connections = value["proxy_peer_connections"]
|
||||||
except RuntimeError as ex:
|
self.session.set_proxy(proxy_settings)
|
||||||
log.error("Unable to set I2P Proxy: %s", ex)
|
|
||||||
|
|
||||||
def _on_set_i2p_proxy(self, key, value):
|
def _on_set_i2p_proxy(self, key, value):
|
||||||
log.debug("Setting I2P proxy to: %s", value)
|
log.debug("Setting I2P proxy to: %s", value)
|
||||||
|
|
|
@ -104,12 +104,33 @@ class BasePane:
|
||||||
for ipt in self.inputs:
|
for ipt in self.inputs:
|
||||||
if not isinstance(ipt,NoInput):
|
if not isinstance(ipt,NoInput):
|
||||||
# gross, have to special case in/out ports since they are tuples
|
# gross, have to special case in/out ports since they are tuples
|
||||||
if ipt.name in ("listen_ports_to","listen_ports_from",
|
if ipt.name in ("listen_ports_to", "listen_ports_from", "out_ports_from", "out_ports_to",
|
||||||
"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":
|
if ipt.name == "listen_ports_to":
|
||||||
conf_dict["listen_ports"] = (self.infrom.get_value(),self.into.get_value())
|
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())
|
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:
|
else:
|
||||||
conf_dict[ipt.name] = ipt.get_value()
|
conf_dict[ipt.name] = ipt.get_value()
|
||||||
if hasattr(ipt,"get_child"):
|
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))
|
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):
|
class DownloadsPane(BasePane):
|
||||||
def __init__(self, offset, parent, width):
|
def __init__(self, offset, parent, width):
|
||||||
BasePane.__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"])
|
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)
|
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"])
|
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)
|
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_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_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_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("prioritize_first_last_pieces", "Prioritize first and last pieces of torrent",
|
||||||
self.add_checked_input("add_paused","Add torrents in paused state",parent.core_config["add_paused"])
|
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):
|
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_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)
|
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):
|
class OtherPane(BasePane):
|
||||||
def __init__(self, offset, parent, width):
|
def __init__(self, offset, parent, width):
|
||||||
BasePane.__init__(self,offset,parent,width)
|
BasePane.__init__(self,offset,parent,width)
|
||||||
|
@ -393,8 +415,26 @@ class QueuePane(BasePane):
|
||||||
|
|
||||||
class ProxyPane(BasePane):
|
class ProxyPane(BasePane):
|
||||||
def __init__(self, offset, parent, width):
|
def __init__(self, offset, parent, width):
|
||||||
BasePane.__init__(self,offset,parent,width)
|
BasePane.__init__(self, offset, parent, width)
|
||||||
self.add_header("Proxy Settings Comming Soon")
|
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):
|
class CachePane(BasePane):
|
||||||
def __init__(self, offset, parent, width):
|
def __init__(self, offset, parent, width):
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -407,6 +407,15 @@ class Preferences(component.Component):
|
||||||
"chk_remove_ratio": ("active", "remove_seed_at_ratio"),
|
"chk_remove_ratio": ("active", "remove_seed_at_ratio"),
|
||||||
"spin_cache_size": ("value", "cache_size"),
|
"spin_cache_size": ("value", "cache_size"),
|
||||||
"spin_cache_expiry": ("value", "cache_expiry"),
|
"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_add": (None, None),
|
||||||
"accounts_listview": (None, None),
|
"accounts_listview": (None, None),
|
||||||
"button_cache_refresh": (None, None),
|
"button_cache_refresh": (None, None),
|
||||||
|
@ -417,24 +426,6 @@ class Preferences(component.Component):
|
||||||
"plugin_listview": (None, None),
|
"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.download_location_path_chooser] = ("path_chooser", "download_location")
|
||||||
core_widgets[self.move_completed_path_chooser] = ("path_chooser", "move_completed_path")
|
core_widgets[self.move_completed_path_chooser] = ("path_chooser", "move_completed_path")
|
||||||
core_widgets[self.copy_torrent_files_path_chooser] = ("path_chooser", "torrentfiles_location")
|
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()
|
self.builder.get_object("chk_new_releases").get_active()
|
||||||
|
|
||||||
## Proxy tab ##
|
## Proxy tab ##
|
||||||
new_core_config["proxies"] = {}
|
new_core_config["proxy"] = {}
|
||||||
for t in ("peer", "web_seed", "tracker", "dht"):
|
new_core_config["proxy"]["type"] = self.builder.get_object("combo_proxy_type").get_active()
|
||||||
new_core_config["proxies"][t] = {}
|
new_core_config["proxy"]["username"] = self.builder.get_object("entry_proxy_user").get_text()
|
||||||
new_core_config["proxies"][t]["type"] = \
|
new_core_config["proxy"]["password"] = self.builder.get_object("entry_proxy_pass").get_text()
|
||||||
self.builder.get_object("combo_proxy_type_%s" % t).get_active()
|
new_core_config["proxy"]["hostname"] = self.builder.get_object("entry_proxy_host").get_text()
|
||||||
new_core_config["proxies"][t]["port"] = \
|
new_core_config["proxy"]["port"] = self.builder.get_object("spin_proxy_port").get_value_as_int()
|
||||||
self.builder.get_object("spin_proxy_port_%s" % t).get_value_as_int()
|
new_core_config["proxy"]["proxy_hostnames"] = self.builder.get_object("chk_proxy_host_resolve").get_active()
|
||||||
new_core_config["proxies"][t]["username"] = \
|
new_core_config["proxy"]["proxy_peer_connections"] = self.builder.get_object(
|
||||||
self.builder.get_object("txt_proxy_username_%s" % t).get_text()
|
"chk_proxy_peer_conn").get_active()
|
||||||
new_core_config["proxies"][t]["password"] = \
|
new_core_config["i2p_proxy"] = {}
|
||||||
self.builder.get_object("txt_proxy_password_%s" % t).get_text()
|
new_core_config["i2p_proxy"]["hostname"] = self.builder.get_object("entry_i2p_host").get_text()
|
||||||
new_core_config["proxies"][t]["hostname"] = \
|
new_core_config["i2p_proxy"]["port"] = self.builder.get_object("spin_i2p_port").get_value_as_int()
|
||||||
self.builder.get_object("txt_proxy_server_%s" % t).get_text()
|
|
||||||
|
|
||||||
## Queue tab ##
|
## Queue tab ##
|
||||||
new_core_config["queue_new_to_top"] = \
|
new_core_config["queue_new_to_top"] = \
|
||||||
|
@ -1049,31 +1039,32 @@ class Preferences(component.Component):
|
||||||
combo_enclevel.set_sensitive(True)
|
combo_enclevel.set_sensitive(True)
|
||||||
|
|
||||||
def _on_combo_proxy_type_changed(self, widget):
|
def _on_combo_proxy_type_changed(self, widget):
|
||||||
name = widget.get_name().replace("combo_proxy_type_", "")
|
proxy_type = self.builder.get_object("combo_proxy_type").get_active()
|
||||||
proxy_type = widget.get_model()[widget.get_active()][0]
|
|
||||||
|
|
||||||
prefixes = ["txt_proxy_", "label_proxy_", "spin_proxy_"]
|
|
||||||
hides = []
|
hides = []
|
||||||
shows = []
|
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":
|
for hide_entry in hides:
|
||||||
hides.extend(["password", "username", "server", "port"])
|
self.builder.get_object(hide_entry).hide()
|
||||||
elif proxy_type in ("Socksv4", "Socksv5", "HTTP"):
|
for show_entry in shows:
|
||||||
hides.extend(["password", "username"])
|
self.builder.get_object(show_entry).show()
|
||||||
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()
|
|
||||||
|
|
||||||
def _on_button_associate_magnet_clicked(self, widget):
|
def _on_button_associate_magnet_clicked(self, widget):
|
||||||
common.associate_magnet_links(True)
|
common.associate_magnet_links(True)
|
||||||
|
|
|
@ -86,14 +86,6 @@ Deluge.preferences.Downloads = Ext.extend(Ext.FormPanel, {
|
||||||
optMan.bind('copy_torrent_file', field.toggle);
|
optMan.bind('copy_torrent_file', field.toggle);
|
||||||
optMan.bind('torrentfiles_location', field.input);
|
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({
|
fieldset = this.add({
|
||||||
xtype: 'fieldset',
|
xtype: 'fieldset',
|
||||||
border: false,
|
border: false,
|
||||||
|
|
|
@ -45,7 +45,8 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
|
||||||
Deluge.preferences.ProxyField.superclass.initComponent.call(this);
|
Deluge.preferences.ProxyField.superclass.initComponent.call(this);
|
||||||
this.proxyType = this.add({
|
this.proxyType = this.add({
|
||||||
xtype: 'combo',
|
xtype: 'combo',
|
||||||
fieldLabel: _('Type'),
|
fieldLabel: _('Type:'),
|
||||||
|
labelSeparator: '',
|
||||||
name: 'proxytype',
|
name: 'proxytype',
|
||||||
mode: 'local',
|
mode: 'local',
|
||||||
width: 150,
|
width: 150,
|
||||||
|
@ -53,11 +54,11 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
|
||||||
fields: ['id', 'text'],
|
fields: ['id', 'text'],
|
||||||
data: [
|
data: [
|
||||||
[0, _('None')],
|
[0, _('None')],
|
||||||
[1, _('Socksv4')],
|
[1, _('Socks4')],
|
||||||
[2, _('Socksv5')],
|
[2, _('Socks5')],
|
||||||
[3, _('Socksv5 with Auth')],
|
[3, _('Socks5 Auth')],
|
||||||
[4, _('HTTP')],
|
[4, _('HTTP')],
|
||||||
[5, _('HTTP with Auth')]
|
[5, _('HTTP Auth')]
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
editable: false,
|
editable: false,
|
||||||
|
@ -71,7 +72,8 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
|
||||||
this.hostname = this.add({
|
this.hostname = this.add({
|
||||||
xtype: 'textfield',
|
xtype: 'textfield',
|
||||||
name: 'hostname',
|
name: 'hostname',
|
||||||
fieldLabel: _('Host'),
|
fieldLabel: _('Host:'),
|
||||||
|
labelSeparator: '',
|
||||||
width: 220
|
width: 220
|
||||||
});
|
});
|
||||||
this.hostname.on('change', this.onFieldChange, this);
|
this.hostname.on('change', this.onFieldChange, this);
|
||||||
|
@ -79,18 +81,20 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
|
||||||
this.port = this.add({
|
this.port = this.add({
|
||||||
xtype: 'spinnerfield',
|
xtype: 'spinnerfield',
|
||||||
name: 'port',
|
name: 'port',
|
||||||
fieldLabel: _('Port'),
|
fieldLabel: _('Port:'),
|
||||||
|
labelSeparator: '',
|
||||||
width: 80,
|
width: 80,
|
||||||
decimalPrecision: 0,
|
decimalPrecision: 0,
|
||||||
minValue: -1,
|
minValue: 0,
|
||||||
maxValue: 99999
|
maxValue: 65535
|
||||||
});
|
});
|
||||||
this.port.on('change', this.onFieldChange, this);
|
this.port.on('change', this.onFieldChange, this);
|
||||||
|
|
||||||
this.username = this.add({
|
this.username = this.add({
|
||||||
xtype: 'textfield',
|
xtype: 'textfield',
|
||||||
name: 'username',
|
name: 'username',
|
||||||
fieldLabel: _('Username'),
|
fieldLabel: _('Username:'),
|
||||||
|
labelSeparator: '',
|
||||||
width: 220
|
width: 220
|
||||||
});
|
});
|
||||||
this.username.on('change', this.onFieldChange, this);
|
this.username.on('change', this.onFieldChange, this);
|
||||||
|
@ -98,12 +102,31 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
|
||||||
this.password = this.add({
|
this.password = this.add({
|
||||||
xtype: 'textfield',
|
xtype: 'textfield',
|
||||||
name: 'password',
|
name: 'password',
|
||||||
fieldLabel: _('Password'),
|
fieldLabel: _('Password:'),
|
||||||
|
labelSeparator: '',
|
||||||
inputType: 'password',
|
inputType: 'password',
|
||||||
width: 220
|
width: 220
|
||||||
});
|
});
|
||||||
this.password.on('change', this.onFieldChange, this);
|
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;
|
this.setting = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -117,7 +140,9 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
|
||||||
'hostname': this.hostname.getValue(),
|
'hostname': this.hostname.getValue(),
|
||||||
'port': Number(this.port.getValue()),
|
'port': Number(this.port.getValue()),
|
||||||
'username': this.username.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.port.setValue(value['port']);
|
||||||
this.username.setValue(value['username']);
|
this.username.setValue(value['username']);
|
||||||
this.password.setValue(value['password']);
|
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.onTypeSelect(this.type, record, index);
|
||||||
this.setting = false;
|
this.setting = false;
|
||||||
},
|
},
|
||||||
|
@ -150,9 +178,15 @@ Deluge.preferences.ProxyField = Ext.extend(Ext.form.FieldSet, {
|
||||||
if (typeId > 0) {
|
if (typeId > 0) {
|
||||||
this.hostname.show();
|
this.hostname.show();
|
||||||
this.port.show();
|
this.port.show();
|
||||||
|
this.proxy_peer_conn.show();
|
||||||
|
if (typeId != 1) {
|
||||||
|
this.proxy_host_resolve.show();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.hostname.hide();
|
this.hostname.hide();
|
||||||
this.port.hide();
|
this.port.hide();
|
||||||
|
this.proxy_host_resolve.hide();
|
||||||
|
this.proxy_peer_conn.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeId == 3 || typeId == 5) {
|
if (typeId == 3 || typeId == 5) {
|
||||||
|
|
95
deluge/ui/web/js/deluge-all/preferences/ProxyI2PField.js
Normal file
95
deluge/ui/web/js/deluge-all/preferences/ProxyI2PField.js
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
/*!
|
||||||
|
* Deluge.preferences.ProxyI2PField.js
|
||||||
|
*
|
||||||
|
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com>
|
||||||
|
*
|
||||||
|
* 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);
|
||||||
|
},
|
||||||
|
});
|
|
@ -48,39 +48,23 @@ Deluge.preferences.Proxy = Ext.extend(Ext.form.FormPanel, {
|
||||||
|
|
||||||
initComponent: function() {
|
initComponent: function() {
|
||||||
Deluge.preferences.Proxy.superclass.initComponent.call(this);
|
Deluge.preferences.Proxy.superclass.initComponent.call(this);
|
||||||
this.peer = this.add(new Deluge.preferences.ProxyField({
|
this.proxy = this.add(new Deluge.preferences.ProxyField({
|
||||||
title: _('Peer'),
|
title: _('Proxy'),
|
||||||
name: 'peer'
|
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({
|
this.i2p_proxy = this.add(new Deluge.preferences.ProxyI2PField({
|
||||||
title: _('Web Seed'),
|
title: _('I2P Proxy'),
|
||||||
name: 'web_seed'
|
name: 'i2p_proxy'
|
||||||
}));
|
}));
|
||||||
this.web_seed.on('change', this.onProxyChange, this);
|
deluge.preferences.getOptionsManager().bind('i2p_proxy', this.i2p_proxy);
|
||||||
|
|
||||||
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);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getValue: function() {
|
getValue: function() {
|
||||||
return {
|
return {
|
||||||
'dht': this.dht.getValue(),
|
'proxy': this.proxy.getValue(),
|
||||||
'peer': this.peer.getValue(),
|
|
||||||
'tracker': this.tracker.getValue(),
|
|
||||||
'web_seed': this.web_seed.getValue()
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue