android interface update and minor fixes
authorThomasV <thomasv@gitorious>
Tue, 8 Oct 2013 11:10:38 +0000 (13:10 +0200)
committerThomasV <thomasv@gitorious>
Tue, 8 Oct 2013 11:10:38 +0000 (13:10 +0200)
gui/android.py
lib/simple_config.py

index cf4aac9..eed41d2 100644 (file)
 
 
 
+from __future__ import absolute_import
 import android
 
-from electrum import SimpleConfig, Wallet, WalletStorage, format_satoshis, mnemonic_encode, mnemonic_decode, is_valid
+from electrum import SimpleConfig, Wallet, WalletStorage, format_satoshis, mnemonic_encode, mnemonic_decode
+from electrum.bitcoin import is_valid
 from electrum import util
 from decimal import Decimal
 import datetime, re
@@ -119,7 +121,7 @@ def select_from_addresses():
 def protocol_name(p):
     if p == 't': return 'TCP'
     if p == 'h': return 'HTTP'
-    if p == 's': return 'TCP/SSL'
+    if p == 's': return 'SSL'
     if p == 'g': return 'HTTPS'
 
 
@@ -498,7 +500,7 @@ do_refresh = False
 
 def update_callback():
     global do_refresh
-    print "gui callback", network.is_connected(), wallet.up_to_date
+    print "gui callback", network.is_connected()
     do_refresh = True
     droid.eventPost("refresh",'z')
 
@@ -791,7 +793,7 @@ def settings_loop():
                 if host in servers:
                     protocol = protocol_dialog(host, protocol, servers[host])
                     z = servers[host]
-                    port = z[p]
+                    port = z[protocol]
                     network_changed = True
 
             elif pos == "2": #port
@@ -882,7 +884,6 @@ class ElectrumGui:
 
     def __init__(self, config, _network):
         global wallet, network
-        wallet = w
         network = _network
         network.register_callback('updated', update_callback)
         network.register_callback('connected', update_callback)
@@ -894,8 +895,8 @@ class ElectrumGui:
             print "Wallet not found. try 'electrum create'"
             exit()
 
-        self.wallet = Wallet(storage)
-        self.wallet.start_threads(network)
+        wallet = Wallet(storage)
+        wallet.start_threads(network)
 
 
     def main(self, url):
index 5483311..a57747d 100644 (file)
@@ -22,10 +22,8 @@ a SimpleConfig instance then reads the wallet file.
         if options.get('portable') is not True:
             self.read_system_config()
 
-        # read path
-        self.path = self.system_config.get('electrum_path')
-        if self.path is None:
-            self.path = user_dir()
+        # init path
+        self.init_path()
 
         # user conf, writeable
         self.user_config = {}
@@ -35,19 +33,23 @@ a SimpleConfig instance then reads the wallet file.
         # command-line options
         self.options_config = options
 
-        # init path
-        self.init_path()
 
-        print_error( "electrum path", self.path)
 
 
     def init_path(self):
 
-        # Look for wallet file in the default data directory.
-        # Make wallet directory if it does not yet exist.
+        # Read electrum path in the system configuration
+        self.path = self.system_config.get('electrum_path')
+
+        # If not set, use the user's default data directory.
+        if self.path is None:
+            self.path = user_dir()
+
+        # Make directory if it does not yet exist.
         if not os.path.exists(self.path):
             os.mkdir(self.path)
 
+        print_error( "electrum directory", self.path)
 
         # portable wallet: use the same directory for wallet and headers file
         #if options.get('portable'):