commit 3c6cfc8b70671d314e9cac41d5237abbf5ac7266
parent 8ca17a3e705d8f22723fcc8012552e0172804290
Author: ThomasV <thomasv@gitorious>
Date: Thu, 29 Jan 2015 13:35:19 +0100
disable server selector if server is passed from cmd line
Diffstat:
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/gui/qt/network_dialog.py b/gui/qt/network_dialog.py
@@ -122,14 +122,15 @@ class NetworkDialog(QDialog):
lambda x,y: self.server_changed(x))
grid.addWidget(self.servers_list_widget, 1, 1, 1, 3)
- if not config.is_modifiable('server'):
- for w in [self.server_host, self.server_port, self.server_protocol, self.servers_list_widget]: w.setEnabled(False)
-
def enable_set_server():
- enabled = not self.autocycle_cb.isChecked()
- self.server_host.setEnabled(enabled)
- self.server_port.setEnabled(enabled)
- self.servers_list_widget.setEnabled(enabled)
+ if config.is_modifiable('server'):
+ enabled = not self.autocycle_cb.isChecked()
+ self.server_host.setEnabled(enabled)
+ self.server_port.setEnabled(enabled)
+ self.servers_list_widget.setEnabled(enabled)
+ else:
+ for w in [self.autocycle_cb, self.server_host, self.server_port, self.server_protocol, self.servers_list_widget]:
+ w.setEnabled(False)
self.autocycle_cb.clicked.connect(enable_set_server)
enable_set_server()
diff --git a/lib/network.py b/lib/network.py
@@ -234,11 +234,11 @@ class Network(threading.Thread):
def set_parameters(self, host, port, protocol, proxy, auto_connect):
proxy_str = interface.serialize_proxy(proxy)
+ server_str = ':'.join([ host, port, protocol ])
self.config.set_key('auto_cycle', auto_connect, True)
self.config.set_key("proxy", proxy_str, True)
self.config.set_key("protocol", protocol, True)
- server = ':'.join([ host, port, protocol ])
- self.config.set_key("server", server, True)
+ self.config.set_key("server", server_str, True)
if self.proxy != proxy_str or self.protocol != protocol:
print_error('restarting network')
@@ -256,7 +256,7 @@ class Network(threading.Thread):
if self.server_is_lagging():
self.stop_interface()
else:
- self.set_server(server)
+ self.set_server(server_str)
def switch_to_random_interface(self):