fixed issue when exchange rate not available (eg, no connection)
This commit is contained in:
@@ -537,6 +537,10 @@ class Plugin(BasePlugin):
|
|||||||
if not self.config.get('use_exchange_rate'):
|
if not self.config.get('use_exchange_rate'):
|
||||||
self.gui.main_window.show_message("To use this feature, first enable the exchange rate plugin.")
|
self.gui.main_window.show_message("To use this feature, first enable the exchange rate plugin.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if not self.gui.main_window.network.is_connected():
|
||||||
|
self.gui.main_window.show_message("To use this feature, you must have a connection.")
|
||||||
|
return
|
||||||
|
|
||||||
quote_currency = self.config.get("currency", "EUR")
|
quote_currency = self.config.get("currency", "EUR")
|
||||||
|
|
||||||
@@ -571,12 +575,15 @@ class Plugin(BasePlugin):
|
|||||||
r = {}
|
r = {}
|
||||||
self.set_quote_text(100000000, r)
|
self.set_quote_text(100000000, r)
|
||||||
quote = r.get(0)
|
quote = r.get(0)
|
||||||
quote = quote[:-4]
|
if not quote:
|
||||||
btcamount = Decimal(fiat) / Decimal(quote)
|
self.gui.main_window.show_message("Exchange rate not available. Please check your connection.")
|
||||||
if str(self.gui.main_window.base_unit()) == "mBTC":
|
return
|
||||||
btcamount = btcamount * 1000
|
else:
|
||||||
quote = "%.8f"%btcamount
|
quote = quote[:-4]
|
||||||
if quote:
|
btcamount = Decimal(fiat) / Decimal(quote)
|
||||||
|
if str(self.gui.main_window.base_unit()) == "mBTC":
|
||||||
|
btcamount = btcamount * 1000
|
||||||
|
quote = "%.8f"%btcamount
|
||||||
self.gui.main_window.amount_e.setText( quote )
|
self.gui.main_window.amount_e.setText( quote )
|
||||||
|
|
||||||
def exchange_rate_button(self, grid):
|
def exchange_rate_button(self, grid):
|
||||||
|
|||||||
Reference in New Issue
Block a user