simplify exchange_rate hooks
This commit is contained in:
parent
46249f74d3
commit
302ce7c15b
|
@ -7,13 +7,11 @@
|
||||||
* The network layer uses select(), so all server communication is
|
* The network layer uses select(), so all server communication is
|
||||||
handled by a single thread. Moreover, the synchronizer, verifier,
|
handled by a single thread. Moreover, the synchronizer, verifier,
|
||||||
and exchange rate plugin now run as separate jobs within the
|
and exchange rate plugin now run as separate jobs within the
|
||||||
networking thread instead of as their own threads. The elimination
|
networking thread instead of as their own threads.
|
||||||
of so many threads should lead to reduced lock contention and CPU
|
|
||||||
usage.
|
|
||||||
* Plugins are revamped, particularly the exchange rate plugin.
|
* Plugins are revamped, particularly the exchange rate plugin.
|
||||||
|
|
||||||
# Release 2.4.4
|
# Release 2.4.4
|
||||||
* fix bug with trustedcoin plugin
|
* Fix bug with TrustedCoin plugin
|
||||||
|
|
||||||
# Release 2.4.3
|
# Release 2.4.3
|
||||||
* Support for KeepKey hardware wallet
|
* Support for KeepKey hardware wallet
|
||||||
|
|
|
@ -492,7 +492,7 @@ class ElectrumWindow(QMainWindow, PrintError):
|
||||||
text = self.format_amount(amount) + ' '+ self.base_unit()
|
text = self.format_amount(amount) + ' '+ self.base_unit()
|
||||||
x = run_hook('format_amount_and_units', amount)
|
x = run_hook('format_amount_and_units', amount)
|
||||||
if x:
|
if x:
|
||||||
text += ''.join(x)
|
text += x
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def get_decimal_point(self):
|
def get_decimal_point(self):
|
||||||
|
@ -536,9 +536,9 @@ class ElectrumWindow(QMainWindow, PrintError):
|
||||||
if x:
|
if x:
|
||||||
text += " [%s unmatured]"%(self.format_amount(x, True).strip())
|
text += " [%s unmatured]"%(self.format_amount(x, True).strip())
|
||||||
# append fiat balance and price from exchange rate plugin
|
# append fiat balance and price from exchange rate plugin
|
||||||
r = {'text': ''}
|
rate = run_hook('get_fiat_status_text', c + u + x)
|
||||||
run_hook('get_fiat_status_text', c + u + x, r)
|
if rate:
|
||||||
text += r['text']
|
text += "1 BTC~%s" % rate
|
||||||
icon = QIcon(":icons/status_connected.png")
|
icon = QIcon(":icons/status_connected.png")
|
||||||
else:
|
else:
|
||||||
text = _("Not connected")
|
text = _("Not connected")
|
||||||
|
|
|
@ -423,14 +423,9 @@ class Plugin(BasePlugin, ThreadJob):
|
||||||
return '' if rate is None else " (%s %s)" % (self.value_str(btc_balance, rate), self.ccy)
|
return '' if rate is None else " (%s %s)" % (self.value_str(btc_balance, rate), self.ccy)
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
def get_fiat_status_text(self, btc_balance, result):
|
def get_fiat_status_text(self, btc_balance):
|
||||||
# return status as: (1.23 USD) 1 BTC~123.45 USD
|
|
||||||
rate = self.exchange_rate()
|
rate = self.exchange_rate()
|
||||||
if rate is None:
|
return _(" (No FX rate available)") if rate is None else "%s %s" % (self.value_str(COIN, rate), self.ccy)
|
||||||
text = _(" (No FX rate available)")
|
|
||||||
else:
|
|
||||||
text = "1 BTC~%s %s" % (self.value_str(COIN, rate), self.ccy)
|
|
||||||
result['text'] = text
|
|
||||||
|
|
||||||
def get_historical_rates(self):
|
def get_historical_rates(self):
|
||||||
if self.show_history():
|
if self.show_history():
|
||||||
|
|
Loading…
Reference in New Issue