protocols
authorThomasV <thomasv@gitorious>
Tue, 10 Apr 2012 17:57:39 +0000 (19:57 +0200)
committerThomasV <thomasv@gitorious>
Tue, 10 Apr 2012 17:57:39 +0000 (19:57 +0200)
client/electrum4a.py

index 772042b..65b0436 100755 (executable)
@@ -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