mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-26 23:13:25 +00:00
Merge branch 'master' of gitorious.org:electrum/electrum
This commit is contained in:
commit
c533b797e0
2 changed files with 59 additions and 36 deletions
|
@ -120,7 +120,8 @@ class MiniWindow(QDialog):
|
||||||
self.connect(expand_button, SIGNAL("clicked()"), expand_callback)
|
self.connect(expand_button, SIGNAL("clicked()"), expand_callback)
|
||||||
|
|
||||||
self.btc_balance = None
|
self.btc_balance = None
|
||||||
self.quote_currencies = ("EUR", "USD", "GBP")
|
self.quote_currencies = ["EUR", "USD", "GBP"]
|
||||||
|
self.actuator.set_configured_currency(self.set_quote_currency)
|
||||||
self.exchanger = exchange_rate.Exchanger(self)
|
self.exchanger = exchange_rate.Exchanger(self)
|
||||||
# Needed because price discovery is done in a different thread
|
# Needed because price discovery is done in a different thread
|
||||||
# which needs to be sent back to this main one to update the GUI
|
# which needs to be sent back to this main one to update the GUI
|
||||||
|
@ -212,9 +213,16 @@ class MiniWindow(QDialog):
|
||||||
def deactivate(self):
|
def deactivate(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def set_quote_currency(self, currency):
|
||||||
|
assert currency in self.quote_currencies
|
||||||
|
self.quote_currencies.remove(currency)
|
||||||
|
self.quote_currencies = [currency] + self.quote_currencies
|
||||||
|
self.refresh_balance()
|
||||||
|
|
||||||
def change_quote_currency(self):
|
def change_quote_currency(self):
|
||||||
self.quote_currencies = \
|
self.quote_currencies = \
|
||||||
self.quote_currencies[1:] + self.quote_currencies[0:1]
|
self.quote_currencies[1:] + self.quote_currencies[0:1]
|
||||||
|
self.actuator.set_config_currency(self.quote_currencies[0])
|
||||||
self.refresh_balance()
|
self.refresh_balance()
|
||||||
|
|
||||||
def refresh_balance(self):
|
def refresh_balance(self):
|
||||||
|
@ -440,9 +448,19 @@ class MiniActuator:
|
||||||
def __init__(self, wallet):
|
def __init__(self, wallet):
|
||||||
self.wallet = wallet
|
self.wallet = wallet
|
||||||
|
|
||||||
|
def set_configured_currency(self, set_quote_currency):
|
||||||
|
currency = self.wallet.conversion_currency
|
||||||
|
assert currency is not None
|
||||||
|
set_quote_currency(currency)
|
||||||
|
|
||||||
|
def set_config_currency(self, conversion_currency):
|
||||||
|
self.wallet.conversion_currency = conversion_currency
|
||||||
|
|
||||||
def copy_address(self, receive_popup):
|
def copy_address(self, receive_popup):
|
||||||
addrs = [addr for addr in self.wallet.all_addresses()
|
addrs = [addr for addr in self.wallet.all_addresses()
|
||||||
if not self.wallet.is_change(addr)]
|
if not self.wallet.is_change(addr)]
|
||||||
|
# Select most recent addresses from gap limit
|
||||||
|
addrs = addrs[-self.wallet.gap_limit:]
|
||||||
copied_address = random.choice(addrs)
|
copied_address = random.choice(addrs)
|
||||||
qApp.clipboard().setText(copied_address)
|
qApp.clipboard().setText(copied_address)
|
||||||
receive_popup.setup(copied_address)
|
receive_popup.setup(copied_address)
|
||||||
|
|
|
@ -281,6 +281,7 @@ class Wallet:
|
||||||
self.fee = 100000
|
self.fee = 100000
|
||||||
self.num_zeros = 0
|
self.num_zeros = 0
|
||||||
self.master_public_key = ''
|
self.master_public_key = ''
|
||||||
|
self.conversion_currency = None
|
||||||
|
|
||||||
# saved fields
|
# saved fields
|
||||||
self.use_encryption = False
|
self.use_encryption = False
|
||||||
|
@ -638,6 +639,9 @@ class Wallet:
|
||||||
|
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
|
# TODO: Need special config storage class. Should not be mixed
|
||||||
|
# up with the wallet.
|
||||||
|
# Settings should maybe be stored in a flat ini file.
|
||||||
s = {
|
s = {
|
||||||
'seed_version': self.seed_version,
|
'seed_version': self.seed_version,
|
||||||
'use_encryption': self.use_encryption,
|
'use_encryption': self.use_encryption,
|
||||||
|
@ -661,6 +665,7 @@ class Wallet:
|
||||||
'expert_mode': self.expert_mode,
|
'expert_mode': self.expert_mode,
|
||||||
'gap_limit': self.gap_limit,
|
'gap_limit': self.gap_limit,
|
||||||
'debug_server': self.debug_server,
|
'debug_server': self.debug_server,
|
||||||
|
'conversion_currency': self.conversion_currency
|
||||||
}
|
}
|
||||||
f = open(self.path,"w")
|
f = open(self.path,"w")
|
||||||
f.write( repr(s) )
|
f.write( repr(s) )
|
||||||
|
@ -689,7 +694,6 @@ class Wallet:
|
||||||
self.fee = int(d.get('fee'))
|
self.fee = int(d.get('fee'))
|
||||||
self.seed = d.get('seed')
|
self.seed = d.get('seed')
|
||||||
self.server = d.get('server')
|
self.server = d.get('server')
|
||||||
#blocks = d.get('blocks')
|
|
||||||
self.addresses = d.get('addresses')
|
self.addresses = d.get('addresses')
|
||||||
self.change_addresses = d.get('change_addresses')
|
self.change_addresses = d.get('change_addresses')
|
||||||
self.history = d.get('history')
|
self.history = d.get('history')
|
||||||
|
@ -705,6 +709,7 @@ class Wallet:
|
||||||
self.expert_mode = d.get('expert_mode', False)
|
self.expert_mode = d.get('expert_mode', False)
|
||||||
self.gap_limit = d.get('gap_limit', 5)
|
self.gap_limit = d.get('gap_limit', 5)
|
||||||
self.debug_server = d.get('debug_server', False)
|
self.debug_server = d.get('debug_server', False)
|
||||||
|
self.conversion_currency = d.get('conversion_currency', 'USD')
|
||||||
except:
|
except:
|
||||||
raise BaseException("cannot read wallet file")
|
raise BaseException("cannot read wallet file")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue