1
0

format_amount_and_units: general method to display amounts and fiat values. fixes #1078

This commit is contained in:
ThomasV
2015-09-11 16:46:37 +02:00
parent 7c4b749340
commit 483cf2286f
2 changed files with 21 additions and 10 deletions

View File

@@ -393,6 +393,11 @@ class Plugin(BasePlugin, ThreadJob):
if rate:
return Decimal(rate)
@hook
def format_amount_and_units(self, btc_balance):
rate = self.exchange_rate()
return '' if rate is None else " (%s %s)" % (self.value_str(btc_balance, rate), self.ccy)
@hook
def get_fiat_status_text(self, btc_balance, result):
# return status as: (1.23 USD) 1 BTC~123.45 USD
@@ -400,8 +405,7 @@ class Plugin(BasePlugin, ThreadJob):
if rate is None:
text = _(" (No FX rate available)")
else:
text = " (%s %s) 1 BTC~%s %s" % (self.value_str(btc_balance, rate), self.ccy,
self.value_str(COIN, rate), self.ccy)
text = "1 BTC~%s %s" % (self.value_str(COIN, rate), self.ccy)
result['text'] = text
def get_historical_rates(self):