android interface update and minor fixes

This commit is contained in:
ThomasV 2013-10-08 13:10:38 +02:00
parent a0d9a5efe4
commit c45fa4860f
2 changed files with 19 additions and 16 deletions

View File

@ -19,9 +19,11 @@
from __future__ import absolute_import
import android 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 electrum import util
from decimal import Decimal from decimal import Decimal
import datetime, re import datetime, re
@ -119,7 +121,7 @@ def select_from_addresses():
def protocol_name(p): def protocol_name(p):
if p == 't': return 'TCP' if p == 't': return 'TCP'
if p == 'h': return 'HTTP' if p == 'h': return 'HTTP'
if p == 's': return 'TCP/SSL' if p == 's': return 'SSL'
if p == 'g': return 'HTTPS' if p == 'g': return 'HTTPS'
@ -498,7 +500,7 @@ do_refresh = False
def update_callback(): def update_callback():
global do_refresh global do_refresh
print "gui callback", network.is_connected(), wallet.up_to_date print "gui callback", network.is_connected()
do_refresh = True do_refresh = True
droid.eventPost("refresh",'z') droid.eventPost("refresh",'z')
@ -791,7 +793,7 @@ def settings_loop():
if host in servers: if host in servers:
protocol = protocol_dialog(host, protocol, servers[host]) protocol = protocol_dialog(host, protocol, servers[host])
z = servers[host] z = servers[host]
port = z[p] port = z[protocol]
network_changed = True network_changed = True
elif pos == "2": #port elif pos == "2": #port
@ -882,7 +884,6 @@ class ElectrumGui:
def __init__(self, config, _network): def __init__(self, config, _network):
global wallet, network global wallet, network
wallet = w
network = _network network = _network
network.register_callback('updated', update_callback) network.register_callback('updated', update_callback)
network.register_callback('connected', update_callback) network.register_callback('connected', update_callback)
@ -894,8 +895,8 @@ class ElectrumGui:
print "Wallet not found. try 'electrum create'" print "Wallet not found. try 'electrum create'"
exit() exit()
self.wallet = Wallet(storage) wallet = Wallet(storage)
self.wallet.start_threads(network) wallet.start_threads(network)
def main(self, url): def main(self, url):

View File

@ -22,10 +22,8 @@ a SimpleConfig instance then reads the wallet file.
if options.get('portable') is not True: if options.get('portable') is not True:
self.read_system_config() self.read_system_config()
# read path # init path
self.path = self.system_config.get('electrum_path') self.init_path()
if self.path is None:
self.path = user_dir()
# user conf, writeable # user conf, writeable
self.user_config = {} self.user_config = {}
@ -35,19 +33,23 @@ a SimpleConfig instance then reads the wallet file.
# command-line options # command-line options
self.options_config = options self.options_config = options
# init path
self.init_path()
print_error( "electrum path", self.path)
def init_path(self): def init_path(self):
# Look for wallet file in the default data directory. # Read electrum path in the system configuration
# Make wallet directory if it does not yet exist. 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): if not os.path.exists(self.path):
os.mkdir(self.path) os.mkdir(self.path)
print_error( "electrum directory", self.path)
# portable wallet: use the same directory for wallet and headers file # portable wallet: use the same directory for wallet and headers file
#if options.get('portable'): #if options.get('portable'):