Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
4b22844137
|
@ -757,8 +757,9 @@ class ElectrumWindow(QMainWindow):
|
||||||
if self.amount_e.is_shortcut:
|
if self.amount_e.is_shortcut:
|
||||||
self.amount_e.is_shortcut = False
|
self.amount_e.is_shortcut = False
|
||||||
sendable = self.get_sendable_balance()
|
sendable = self.get_sendable_balance()
|
||||||
inputs, total, fee = self.wallet.choose_tx_inputs( sendable, 0, self.get_payment_sources())
|
# there is only one output because we are completely spending inputs
|
||||||
fee = self.wallet.estimated_fee(inputs)
|
inputs, total, fee = self.wallet.choose_tx_inputs( sendable, 0, 1, self.get_payment_sources())
|
||||||
|
fee = self.wallet.estimated_fee(inputs, 1)
|
||||||
amount = total - fee
|
amount = total - fee
|
||||||
self.amount_e.setText( self.format_amount(amount) )
|
self.amount_e.setText( self.format_amount(amount) )
|
||||||
self.fee_e.setText( self.format_amount( fee ) )
|
self.fee_e.setText( self.format_amount( fee ) )
|
||||||
|
@ -770,7 +771,8 @@ class ElectrumWindow(QMainWindow):
|
||||||
if not is_fee: fee = None
|
if not is_fee: fee = None
|
||||||
if amount is None:
|
if amount is None:
|
||||||
return
|
return
|
||||||
inputs, total, fee = self.wallet.choose_tx_inputs(amount, fee, self.get_payment_sources())
|
# assume that there will be 2 outputs (one for change)
|
||||||
|
inputs, total, fee = self.wallet.choose_tx_inputs(amount, fee, 2, self.get_payment_sources())
|
||||||
if not is_fee:
|
if not is_fee:
|
||||||
self.fee_e.setText( self.format_amount( fee ) )
|
self.fee_e.setText( self.format_amount( fee ) )
|
||||||
if inputs:
|
if inputs:
|
||||||
|
|
|
@ -32,6 +32,7 @@ class Exchanger(threading.Thread):
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.quote_currencies = None
|
self.quote_currencies = None
|
||||||
self.lock = threading.Lock()
|
self.lock = threading.Lock()
|
||||||
|
self.query_rates = threading.Event()
|
||||||
self.use_exchange = self.parent.config.get('use_exchange', "Blockchain")
|
self.use_exchange = self.parent.config.get('use_exchange', "Blockchain")
|
||||||
self.parent.exchanges = EXCHANGES
|
self.parent.exchanges = EXCHANGES
|
||||||
self.parent.currencies = ["EUR","GBP","USD"]
|
self.parent.currencies = ["EUR","GBP","USD"]
|
||||||
|
@ -94,8 +95,9 @@ class Exchanger(threading.Thread):
|
||||||
def run(self):
|
def run(self):
|
||||||
self.is_running = True
|
self.is_running = True
|
||||||
while self.is_running:
|
while self.is_running:
|
||||||
|
self.query_rates.clear()
|
||||||
self.update_rate()
|
self.update_rate()
|
||||||
time.sleep(150)
|
self.query_rates.wait(150)
|
||||||
|
|
||||||
|
|
||||||
def update_cd(self):
|
def update_cd(self):
|
||||||
|
@ -379,7 +381,10 @@ class Plugin(BasePlugin):
|
||||||
ok_button = QPushButton(_("OK"))
|
ok_button = QPushButton(_("OK"))
|
||||||
|
|
||||||
def on_change(x):
|
def on_change(x):
|
||||||
|
try:
|
||||||
cur_request = str(self.currencies[x])
|
cur_request = str(self.currencies[x])
|
||||||
|
except Exception:
|
||||||
|
return
|
||||||
if cur_request != self.config.get('currency', "EUR"):
|
if cur_request != self.config.get('currency', "EUR"):
|
||||||
self.config.set_key('currency', cur_request, True)
|
self.config.set_key('currency', cur_request, True)
|
||||||
if cur_request == "USD" and self.config.get('use_exchange', "Blockchain") == "CoinDesk":
|
if cur_request == "USD" and self.config.get('use_exchange', "Blockchain") == "CoinDesk":
|
||||||
|
@ -397,7 +402,9 @@ class Plugin(BasePlugin):
|
||||||
cur_request = str(self.exchanges[x])
|
cur_request = str(self.exchanges[x])
|
||||||
if cur_request != self.config.get('use_exchange', "Blockchain"):
|
if cur_request != self.config.get('use_exchange', "Blockchain"):
|
||||||
self.config.set_key('use_exchange', cur_request, True)
|
self.config.set_key('use_exchange', cur_request, True)
|
||||||
self.exchanger.update_rate()
|
self.currencies = []
|
||||||
|
combo.clear()
|
||||||
|
self.exchanger.query_rates.set()
|
||||||
if cur_request == "CoinDesk":
|
if cur_request == "CoinDesk":
|
||||||
if self.config.get('currency', "EUR") == "USD":
|
if self.config.get('currency', "EUR") == "USD":
|
||||||
hist_checkbox.setEnabled(True)
|
hist_checkbox.setEnabled(True)
|
||||||
|
@ -459,7 +466,7 @@ class Plugin(BasePlugin):
|
||||||
combo.currentIndexChanged.connect(on_change)
|
combo.currentIndexChanged.connect(on_change)
|
||||||
combo_ex.currentIndexChanged.connect(on_change_ex)
|
combo_ex.currentIndexChanged.connect(on_change_ex)
|
||||||
hist_checkbox.stateChanged.connect(on_change_hist)
|
hist_checkbox.stateChanged.connect(on_change_hist)
|
||||||
combo.connect(d, SIGNAL('refresh_currencies_combo()'), lambda: set_currencies(combo))
|
combo.connect(self.win, SIGNAL('refresh_currencies_combo()'), lambda: set_currencies(combo))
|
||||||
combo_ex.connect(d, SIGNAL('refresh_exchanges_combo()'), lambda: set_exchanges(combo_ex))
|
combo_ex.connect(d, SIGNAL('refresh_exchanges_combo()'), lambda: set_exchanges(combo_ex))
|
||||||
ok_button.clicked.connect(lambda: ok_clicked())
|
ok_button.clicked.connect(lambda: ok_clicked())
|
||||||
layout.addWidget(combo,1,1)
|
layout.addWidget(combo,1,1)
|
||||||
|
|
Loading…
Reference in New Issue