|
@ -316,19 +316,17 @@ class Plugin(BasePlugin): |
|
|
|
|
|
|
|
|
def get_fiat_status_text(self, btc_balance, r2): |
|
|
def get_fiat_status_text(self, btc_balance, r2): |
|
|
# return status as: (1.23 USD) 1 BTC~123.45 USD |
|
|
# return status as: (1.23 USD) 1 BTC~123.45 USD |
|
|
# balance in fiat |
|
|
|
|
|
text = "" |
|
|
text = "" |
|
|
r = {} |
|
|
r = {} |
|
|
self.get_fiat_balance_text(btc_balance, r) |
|
|
|
|
|
quote = r.get(0) |
|
|
|
|
|
if quote: |
|
|
|
|
|
text += " (%s)"%quote |
|
|
|
|
|
# BTC price in fiat |
|
|
|
|
|
r = {} |
|
|
|
|
|
self.get_fiat_price_text(r) |
|
|
self.get_fiat_price_text(r) |
|
|
quote = r.get(0) |
|
|
quote = r.get(0) |
|
|
if quote: |
|
|
if quote: |
|
|
text += " 1 BTC~%s "%quote |
|
|
price_text = "1 BTC~%s"%quote |
|
|
|
|
|
fiat_currency = quote[-3:] |
|
|
|
|
|
btc_price = quote[:-4] |
|
|
|
|
|
fiat_balance = Decimal(btc_price) * (Decimal(btc_balance)/100000000) |
|
|
|
|
|
balance_text = "(%.2f %s)" % (fiat_balance,fiat_currency) |
|
|
|
|
|
text = " " + balance_text + " " + price_text + " " |
|
|
r2[0] = text |
|
|
r2[0] = text |
|
|
|
|
|
|
|
|
def create_fiat_balance_text(self, btc_balance): |
|
|
def create_fiat_balance_text(self, btc_balance): |
|
@ -577,6 +575,9 @@ class Plugin(BasePlugin): |
|
|
if quote: |
|
|
if quote: |
|
|
text = "1 BTC~%s"%quote |
|
|
text = "1 BTC~%s"%quote |
|
|
grid.addWidget(QLabel(_(text)), 4, 0, 3, 0) |
|
|
grid.addWidget(QLabel(_(text)), 4, 0, 3, 0) |
|
|
|
|
|
else: |
|
|
|
|
|
self.gui.main_window.show_message(_("Exchange rate not available. Please check your network connection.")) |
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
vbox.addLayout(grid) |
|
|
vbox.addLayout(grid) |
|
|
vbox.addLayout(ok_cancel_buttons(d)) |
|
|
vbox.addLayout(ok_cancel_buttons(d)) |
|
@ -589,13 +590,6 @@ class Plugin(BasePlugin): |
|
|
if str(fiat) == "" or str(fiat) == ".": |
|
|
if str(fiat) == "" or str(fiat) == ".": |
|
|
fiat = "0" |
|
|
fiat = "0" |
|
|
|
|
|
|
|
|
r = {} |
|
|
|
|
|
self.get_fiat_price_text(r) |
|
|
|
|
|
quote = r.get(0) |
|
|
|
|
|
if not quote: |
|
|
|
|
|
self.gui.main_window.show_message(_("Exchange rate not available. Please check your network connection.")) |
|
|
|
|
|
return |
|
|
|
|
|
else: |
|
|
|
|
|
quote = quote[:-4] |
|
|
quote = quote[:-4] |
|
|
btcamount = Decimal(fiat) / Decimal(quote) |
|
|
btcamount = Decimal(fiat) / Decimal(quote) |
|
|
if str(self.gui.main_window.base_unit()) == "mBTC": |
|
|
if str(self.gui.main_window.base_unit()) == "mBTC": |
|
|