Break out proxy preferences to include peer, web_seed, tracker and dht.

This commit is contained in:
Andrew Resch 2008-11-29 03:16:43 +00:00
parent 79684c3b11
commit d59a59dadc
3 changed files with 759 additions and 192 deletions

View File

@ -91,11 +91,37 @@ DEFAULT_PREFS = {
"move_completed": False,
"move_completed_path": deluge.common.get_default_download_dir(),
"new_release_check": True,
"proxy_type" : 0,
"proxy_server" : "",
"proxy_username" : "",
"proxy_password" : "",
"proxy_port": 8080,
"proxies": {
"peer": {
"type": 0,
"hostname": "",
"username": "",
"password": "",
"port": 8080
},
"web_seed": {
"type": 0,
"hostname": "",
"username": "",
"password": "",
"port": 8080
},
"tracker": {
"type": 0,
"hostname": "",
"username": "",
"password": "",
"port": 8080
},
"dht": {
"type": 0,
"hostname": "",
"username": "",
"password": "",
"port": 8080
},
},
"outgoing_ports": [0, 0],
"random_outgoing_ports": True,
"peer_tos": "0x00",
@ -172,16 +198,8 @@ class PreferencesManager(component.Component):
self._on_set_dont_count_slow_torrents)
self.config.register_set_function("send_info",
self._on_send_info)
self.config.register_set_function("proxy_type",
self._on_set_proxy)
self.config.register_set_function("proxy_username",
self._on_set_proxy)
self.config.register_set_function("proxy_password",
self._on_set_proxy)
self.config.register_set_function("proxy_server",
self._on_set_proxy)
self.config.register_set_function("proxy_port",
self._on_set_proxy)
self.config.register_set_function("proxies",
self._on_set_proxies)
self.new_release_timer = None
self.config.register_set_function("new_release_check",
self._on_new_release_check)
@ -436,19 +454,17 @@ class PreferencesManager(component.Component):
if self.new_release_timer:
gobject.source.remove(self.new_release_timer)
def _on_set_proxy(self, key, value):
log.debug("Proxy value %s set to %s..", key, value)
def _on_set_proxies(self, key, value):
for k, v in value.items():
if v["type"]:
proxy_settings = lt.proxy_settings()
proxy_settings.proxy_type = lt.proxy_type(self.config["proxy_type"])
if self.config["proxy_type"] != 0:
proxy_settings.username = self.config["proxy_username"]
proxy_settings.password = self.config["proxy_password"]
proxy_settings.hostname = self.config["proxy_server"]
proxy_settings.port = int(self.config["proxy_port"])
self.session.set_peer_proxy(proxy_settings)
self.session.set_web_seed_proxy(proxy_settings)
self.session.set_tracker_proxy(proxy_settings)
self.session.set_dht_proxy(proxy_settings)
proxy_settings.proxy_type = lt.proxy_type(v["type"])
proxy_settings.username = v["username"]
proxy_settings.password = v["password"]
proxy_settings.hostname = v["hostname"]
proxy_settings.port = v["port"]
log.debug("setting %s proxy settings", k)
getattr(self.session, "set_%s_proxy" % k)(proxy_settings)
def _on_rate_limit_ip_overhead(self, key, value):
log.debug("%s: %s", key, value)

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Sat Nov 22 00:50:52 2008 -->
<!--Generated with glade3 3.4.5 on Fri Nov 28 18:46:39 2008 -->
<glade-interface>
<widget class="GtkDialog" id="pref_dialog">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@ -2879,6 +2879,10 @@ Disabled</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox26">
<property name="visible">True</property>
<property name="spacing">5</property>
<child>
<widget class="GtkFrame" id="frame23">
<property name="visible">True</property>
@ -2890,71 +2894,12 @@ Disabled</property>
<property name="left_padding">12</property>
<property name="right_padding">12</property>
<child>
<widget class="GtkTable" id="table5">
<widget class="GtkTable" id="table11">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="column_spacing">5</property>
<child>
<widget class="GtkAlignment" id="alignment30">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="xscale">0</property>
<child>
<widget class="GtkSpinButton" id="spin_proxy_port">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="adjustment">0 0 65000 1 10 10</property>
<property name="numeric">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label73">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Port:</property>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label60">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Host:</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label61">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Password:</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label62">
<property name="visible">True</property>
@ -2980,7 +2925,7 @@ Disabled</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="combo_proxy_type">
<widget class="GtkComboBox" id="combo_proxy_type_peer">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="items" translatable="yes">None
@ -2997,7 +2942,7 @@ HTTP W/ Auth</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="txt_proxy_username">
<widget class="GtkEntry" id="txt_proxy_username_peer">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@ -3007,24 +2952,46 @@ HTTP W/ Auth</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="txt_proxy_password">
<widget class="GtkAlignment" id="alignment30">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="xscale">0</property>
<child>
<widget class="GtkSpinButton" id="spin_proxy_port_peer">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="visibility">False</property>
<property name="adjustment">8080 0 65535 1 10 0</property>
<property name="numeric">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="txt_proxy_server">
<widget class="GtkLabel" id="label73">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Port:</property>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="txt_proxy_server_peer">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
@ -3036,6 +3003,46 @@ HTTP W/ Auth</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label60">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Host:</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="txt_proxy_password_peer">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="visibility">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label61">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Password:</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
</widget>
</child>
</widget>
@ -3043,7 +3050,183 @@ HTTP W/ Auth</property>
<child>
<widget class="GtkLabel" id="label59">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Settings&lt;/b&gt;</property>
<property name="label" translatable="yes">&lt;b&gt;Peer&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkFrame" id="frame17">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkAlignment" id="alignment41">
<property name="visible">True</property>
<property name="left_padding">12</property>
<property name="right_padding">12</property>
<child>
<widget class="GtkTable" id="table5">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="column_spacing">5</property>
<child>
<widget class="GtkLabel" id="label92">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Username:</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label91">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Type:</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="combo_proxy_type_web_seed">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="items" translatable="yes">None
Socksv4
Socksv5
Socksv5 W/ Auth
HTTP
HTTP W/ Auth</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="txt_proxy_username_web_seed">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment42">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="xscale">0</property>
<child>
<widget class="GtkSpinButton" id="spin_proxy_port_web_seed">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="adjustment">8080 0 65535 1 10 0</property>
<property name="numeric">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label90">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Port:</property>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="txt_proxy_server_web_seed">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label89">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Host:</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="txt_proxy_password_web_seed">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="visibility">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label88">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Password:</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label93">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Web Seed&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
@ -3052,8 +3235,369 @@ HTTP W/ Auth</property>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame27">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkAlignment" id="alignment43">
<property name="visible">True</property>
<property name="left_padding">12</property>
<property name="right_padding">12</property>
<child>
<widget class="GtkTable" id="table12">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="column_spacing">5</property>
<child>
<widget class="GtkLabel" id="label98">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Username:</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label97">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Type:</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="combo_proxy_type_tracker">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="items" translatable="yes">None
Socksv4
Socksv5
Socksv5 W/ Auth
HTTP
HTTP W/ Auth</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="txt_proxy_username_tracker">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment44">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="xscale">0</property>
<child>
<widget class="GtkSpinButton" id="spin_proxy_port_tracker">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="adjustment">8080 0 65535 1 10 0</property>
<property name="numeric">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label96">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Port:</property>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="txt_proxy_server_tracker">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label95">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Host:</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="txt_proxy_password_tracker">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="visibility">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label94">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Password:</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label99">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Tracker&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkFrame" id="frame28">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkAlignment" id="alignment45">
<property name="visible">True</property>
<property name="left_padding">12</property>
<property name="right_padding">12</property>
<child>
<widget class="GtkTable" id="table13">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="column_spacing">5</property>
<child>
<widget class="GtkLabel" id="label104">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Username:</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label103">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Type:</property>
</widget>
<packing>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="combo_proxy_type_dht">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="items" translatable="yes">None
Socksv4
Socksv5
Socksv5 W/ Auth
HTTP
HTTP W/ Auth</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="txt_proxy_username_dht">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkAlignment" id="alignment46">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="xscale">0</property>
<child>
<widget class="GtkSpinButton" id="spin_proxy_port_dht">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="adjustment">8080 0 65535 1 10 0</property>
<property name="numeric">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label102">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Port:</property>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="txt_proxy_server_dht">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label101">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Host:</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="txt_proxy_password_dht">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="visibility">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label100">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Password:</property>
</widget>
<packing>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label105">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;DHT&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="position">3</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">5</property>
<property name="position">2</property>
</packing>

View File

@ -264,12 +264,14 @@ class Preferences(component.Component):
"chk_seed_ratio": ("active", self.core_config["stop_seed_at_ratio"]),
"spin_share_ratio": ("value", self.core_config["stop_seed_ratio"]),
"chk_remove_ratio": ("active", self.core_config["remove_seed_at_ratio"]),
"spin_proxy_port": ("value", self.core_config["proxy_port"]),
"combo_proxy_type": ("active", self.core_config["proxy_type"]),
"txt_proxy_server": ("text", self.core_config["proxy_server"]),
"txt_proxy_username": ("text", self.core_config["proxy_username"]),
"txt_proxy_password": ("text", self.core_config["proxy_password"]),
}
# Add proxy stuff
for t in ("peer", "web_seed", "tracker", "dht"):
core_widgets["spin_proxy_port_%s" % t] = ("value", self.core_config["proxies"][t]["port"])
core_widgets["combo_proxy_type_%s" % t] = ("active", self.core_config["proxies"][t]["type"])
core_widgets["txt_proxy_server_%s" % t] = ("text", self.core_config["proxies"][t]["hostname"])
core_widgets["txt_proxy_username_%s" % t] = ("text", self.core_config["proxies"][t]["username"])
core_widgets["txt_proxy_password_%s" % t] = ("text", self.core_config["proxies"][t]["password"])
# Change a few widgets if we're connected to a remote host
if not client.is_localhost():
@ -387,12 +389,14 @@ class Preferences(component.Component):
"spin_share_ratio_limit",
"spin_seed_time_ratio_limit",
"spin_seed_time_limit",
"spin_proxy_port",
"combo_proxy_type",
"txt_proxy_username",
"txt_proxy_password",
"txt_proxy_server",
]
for t in ("peer", "web_seed", "tracker", "dht"):
core_widget_list.append("spin_proxy_port_%s" % t)
core_widget_list.append("combo_proxy_type_%s" % t)
core_widget_list.append("txt_proxy_username_%s" % t)
core_widget_list.append("txt_proxy_password_%s" % t)
core_widget_list.append("txt_proxy_server_%s" % t)
# We don't appear to be connected to a daemon
for key in core_widget_list:
widget = self.glade.get_widget(key)
@ -644,16 +648,19 @@ class Preferences(component.Component):
self.glade.get_widget("chk_new_releases").get_active()
## Proxy tab ##
new_core_config["proxy_type"] = \
self.glade.get_widget("combo_proxy_type").get_active()
new_core_config["proxy_port"] = \
self.glade.get_widget("spin_proxy_port").get_value_as_int()
new_core_config["proxy_username"] = \
self.glade.get_widget("txt_proxy_username").get_text()
new_core_config["proxy_password"] = \
self.glade.get_widget("txt_proxy_password").get_text()
new_core_config["proxy_server"] = \
self.glade.get_widget("txt_proxy_server").get_text()
new_core_config["proxies"] = {}
for t in ("peer", "web_seed", "tracker", "dht"):
new_core_config["proxies"][t] = {}
new_core_config["proxies"][t]["type"] = \
self.glade.get_widget("combo_proxy_type_%s" % t).get_active()
new_core_config["proxies"][t]["port"] = \
self.glade.get_widget("spin_proxy_port_%s" % t).get_value_as_int()
new_core_config["proxies"][t]["username"] = \
self.glade.get_widget("txt_proxy_username_%s" % t).get_text()
new_core_config["proxies"][t]["password"] = \
self.glade.get_widget("txt_proxy_password_%s" % t).get_text()
new_core_config["proxies"][t]["hostname"] = \
self.glade.get_widget("txt_proxy_server_%s" % t).get_text()
## Queue tab ##
new_core_config["queue_new_to_top"] = \