Merge branch 'master' of git://github.com/spesmilo/electrum
This commit is contained in:
commit
f352832879
|
@ -180,6 +180,9 @@ class TxDialog(QDialog):
|
||||||
|
|
||||||
def add_io(self, vbox):
|
def add_io(self, vbox):
|
||||||
|
|
||||||
|
if self.tx.locktime > 0:
|
||||||
|
vbox.addWidget(QLabel("LockTime: %d\n" % self.tx.locktime))
|
||||||
|
|
||||||
vbox.addWidget(QLabel(_("Inputs")))
|
vbox.addWidget(QLabel(_("Inputs")))
|
||||||
lines = map(lambda x: x.get('prevout_hash') + ":%d"%x.get('prevout_n') + u'\t' + "%s"%x.get('address') , self.tx.inputs )
|
lines = map(lambda x: x.get('prevout_hash') + ":%d"%x.get('prevout_n') + u'\t' + "%s"%x.get('address') , self.tx.inputs )
|
||||||
i_text = QTextEdit()
|
i_text = QTextEdit()
|
||||||
|
|
|
@ -376,6 +376,7 @@ class Transaction:
|
||||||
self.inputs = self.d['inputs']
|
self.inputs = self.d['inputs']
|
||||||
self.outputs = self.d['outputs']
|
self.outputs = self.d['outputs']
|
||||||
self.outputs = map(lambda x: (x['address'],x['value']), self.outputs)
|
self.outputs = map(lambda x: (x['address'],x['value']), self.outputs)
|
||||||
|
self.locktime = self.d['lockTime']
|
||||||
self.is_complete = is_complete
|
self.is_complete = is_complete
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|
|
@ -1847,7 +1847,7 @@ class Wallet(object):
|
||||||
is_hex = False
|
is_hex = False
|
||||||
|
|
||||||
if is_hex or (uses_electrum_words and len(words) != 13):
|
if is_hex or (uses_electrum_words and len(words) != 13):
|
||||||
print "old style wallet", len(words), words
|
#print "old style wallet", len(words), words
|
||||||
w = OldWallet(storage)
|
w = OldWallet(storage)
|
||||||
w.init_seed(seed) #hex
|
w.init_seed(seed) #hex
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -14,6 +14,7 @@ from electrum_gui.qt.util import *
|
||||||
|
|
||||||
|
|
||||||
EXCHANGES = ["BitcoinAverage",
|
EXCHANGES = ["BitcoinAverage",
|
||||||
|
"BitcoinVenezuela",
|
||||||
"BitPay",
|
"BitPay",
|
||||||
"Blockchain",
|
"Blockchain",
|
||||||
"BTCChina",
|
"BTCChina",
|
||||||
|
@ -78,6 +79,7 @@ class Exchanger(threading.Thread):
|
||||||
self.use_exchange = self.parent.config.get('use_exchange', "Blockchain")
|
self.use_exchange = self.parent.config.get('use_exchange', "Blockchain")
|
||||||
update_rates = {
|
update_rates = {
|
||||||
"BitcoinAverage": self.update_ba,
|
"BitcoinAverage": self.update_ba,
|
||||||
|
"BitcoinVenezuela": self.update_bv,
|
||||||
"BitPay": self.update_bp,
|
"BitPay": self.update_bp,
|
||||||
"Blockchain": self.update_bc,
|
"Blockchain": self.update_bc,
|
||||||
"BTCChina": self.update_CNY,
|
"BTCChina": self.update_CNY,
|
||||||
|
@ -226,6 +228,22 @@ class Exchanger(threading.Thread):
|
||||||
self.parent.set_currencies(quote_currencies)
|
self.parent.set_currencies(quote_currencies)
|
||||||
|
|
||||||
|
|
||||||
|
def update_bv(self):
|
||||||
|
try:
|
||||||
|
jsonresp = self.get_json('api.bitcoinvenezuela.com', "/")
|
||||||
|
except Exception:
|
||||||
|
return
|
||||||
|
quote_currencies = {}
|
||||||
|
try:
|
||||||
|
for r in jsonresp["BTC"]:
|
||||||
|
quote_currencies[r] = Decimal(jsonresp["BTC"][r])
|
||||||
|
with self.lock:
|
||||||
|
self.quote_currencies = quote_currencies
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
self.parent.set_currencies(quote_currencies)
|
||||||
|
|
||||||
|
|
||||||
def update_ba(self):
|
def update_ba(self):
|
||||||
try:
|
try:
|
||||||
jsonresp = self.get_json('api.bitcoinaverage.com', "/ticker/global/all")
|
jsonresp = self.get_json('api.bitcoinaverage.com', "/ticker/global/all")
|
||||||
|
@ -273,6 +291,7 @@ class Plugin(BasePlugin):
|
||||||
def init(self):
|
def init(self):
|
||||||
self.win = self.gui.main_window
|
self.win = self.gui.main_window
|
||||||
self.win.connect(self.win, SIGNAL("refresh_currencies()"), self.win.update_status)
|
self.win.connect(self.win, SIGNAL("refresh_currencies()"), self.win.update_status)
|
||||||
|
self.btc_rate = Decimal(0.0)
|
||||||
# Do price discovery
|
# Do price discovery
|
||||||
self.exchanger = Exchanger(self)
|
self.exchanger = Exchanger(self)
|
||||||
self.exchanger.start()
|
self.exchanger.start()
|
||||||
|
@ -290,10 +309,12 @@ class Plugin(BasePlugin):
|
||||||
def create_quote_text(self, btc_balance):
|
def create_quote_text(self, btc_balance):
|
||||||
quote_currency = self.config.get("currency", "EUR")
|
quote_currency = self.config.get("currency", "EUR")
|
||||||
self.exchanger.use_exchange = self.config.get("use_exchange", "Blockchain")
|
self.exchanger.use_exchange = self.config.get("use_exchange", "Blockchain")
|
||||||
quote_balance = self.exchanger.exchange(btc_balance, quote_currency)
|
cur_rate = self.exchanger.exchange(Decimal(1.0), quote_currency)
|
||||||
if quote_balance is None:
|
if cur_rate is None:
|
||||||
quote_text = ""
|
quote_text = ""
|
||||||
else:
|
else:
|
||||||
|
quote_balance = btc_balance * Decimal(cur_rate)
|
||||||
|
self.btc_rate = cur_rate
|
||||||
quote_text = "%.2f %s" % (quote_balance, quote_currency)
|
quote_text = "%.2f %s" % (quote_balance, quote_currency)
|
||||||
return quote_text
|
return quote_text
|
||||||
|
|
||||||
|
@ -348,7 +369,10 @@ class Plugin(BasePlugin):
|
||||||
pass
|
pass
|
||||||
tx_time = int(tx_info['timestamp'])
|
tx_time = int(tx_info['timestamp'])
|
||||||
tx_time_str = datetime.datetime.fromtimestamp(tx_time).strftime('%Y-%m-%d')
|
tx_time_str = datetime.datetime.fromtimestamp(tx_time).strftime('%Y-%m-%d')
|
||||||
tx_USD_val = "%.2f %s" % (Decimal(tx_info['value']) / 100000000 * Decimal(resp_hist['bpi'][tx_time_str]), "USD")
|
try:
|
||||||
|
tx_USD_val = "%.2f %s" % (Decimal(tx_info['value']) / 100000000 * Decimal(resp_hist['bpi'][tx_time_str]), "USD")
|
||||||
|
except KeyError:
|
||||||
|
tx_USD_val = "%.2f %s" % (self.btc_rate * Decimal(tx_info['value'])/100000000 , "USD")
|
||||||
|
|
||||||
item.setText(5, tx_USD_val)
|
item.setText(5, tx_USD_val)
|
||||||
if Decimal(tx_info['value']) < 0:
|
if Decimal(tx_info['value']) < 0:
|
||||||
|
|
Loading…
Reference in New Issue