From 7405a758e87e5f8792bebc305b5d42d09f23c785 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Tue, 10 Apr 2012 19:57:39 +0200 Subject: [PATCH] protocols --- client/electrum4a.py | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/client/electrum4a.py b/client/electrum4a.py index 772042b1a..65b0436b7 100755 --- a/client/electrum4a.py +++ b/client/electrum4a.py @@ -116,7 +116,10 @@ def protocol_name(p): def protocol_dialog(host, protocol, z): droid.dialogCreateAlert('Protocol',host) - protocols = z.keys() + if z: + protocols = z.keys() + else: + protocols = ['t','h','n'] l = [] current = protocols.index(protocol) for p in protocols: @@ -788,7 +791,7 @@ def settings_loop(): is_encrypted = 'yes' if wallet.use_encryption else 'no' protocol = protocol_name(p) droid.fullShow(settings_layout) - droid.fullSetList("myListView",['Server: ' + server, 'Port: '+port, 'Protocol: '+ protocol, 'Fee: '+fee, 'Password: '+is_encrypted, 'Seed']) + droid.fullSetList("myListView",['Server: ' + server, 'Protocol: '+ protocol, 'Port: '+port, 'Fee: '+fee, 'Password: '+is_encrypted, 'Seed']) set_listview() @@ -824,25 +827,25 @@ def settings_loop(): modal_dialog('error','invalid server') set_listview() - elif pos == "1": #port - a_port = modal_input('Port', 'port number', port, "number") - if a_port: - if a_port != port: - srv = host + ':' + a_port + ':t' + elif pos == "1": #protocol + if host in plist: + srv = protocol_dialog(host, protocol, plist[host]) + if srv: try: wallet.set_server(srv) except: - modal_dialog('error','invalid port number') + modal_dialog('error','invalid server') set_listview() - elif pos == "2": #protocol - if host in plist: - srv = protocol_dialog(host, protocol, plist[host]) - if srv: + elif pos == "2": #port + a_port = modal_input('Port number', 'If you use a public server, this field is set automatically when you set the protocol', port, "number") + if a_port: + if a_port != port: + srv = host + ':' + a_port + ':'+ protocol try: wallet.set_server(srv) except: - modal_dialog('error','invalid server') + modal_dialog('error','invalid port number') set_listview() elif pos == "3": #fee