mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-13 22:19:50 +00:00
fixed issue when exchange rate not available (eg, no connection)
This commit is contained in:
parent
284bcc1e5b
commit
dea58fcb49
1 changed files with 13 additions and 6 deletions
|
@ -538,6 +538,10 @@ class Plugin(BasePlugin):
|
||||||
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")
|
||||||
|
|
||||||
d = QDialog(self.gui.main_window)
|
d = QDialog(self.gui.main_window)
|
||||||
|
@ -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)
|
||||||
|
if not quote:
|
||||||
|
self.gui.main_window.show_message("Exchange rate not available. Please check your 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":
|
||||||
btcamount = btcamount * 1000
|
btcamount = btcamount * 1000
|
||||||
quote = "%.8f"%btcamount
|
quote = "%.8f"%btcamount
|
||||||
if quote:
|
|
||||||
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):
|
||||||
|
|
Loading…
Add table
Reference in a new issue