exchange rates: enforce https APIs. store exchanges list in json file.
This commit is contained in:
@@ -94,7 +94,7 @@ class FxDialog(Factory.Popup):
|
||||
Clock.schedule_once(lambda dt: self.add_currencies())
|
||||
|
||||
def add_exchanges(self):
|
||||
exchanges = sorted(self.fx.exchanges_by_ccy.get(self.fx.get_currency())) if self.fx.is_enabled() else []
|
||||
exchanges = sorted(self.fx.get_exchanges_by_ccy(self.fx.get_currency(), True)) if self.fx.is_enabled() else []
|
||||
mx = self.fx.exchange.name() if self.fx.is_enabled() else ''
|
||||
ex = self.ids.exchanges
|
||||
ex.values = exchanges
|
||||
@@ -107,7 +107,7 @@ class FxDialog(Factory.Popup):
|
||||
self.fx.set_exchange(text)
|
||||
|
||||
def add_currencies(self):
|
||||
currencies = sorted(self.fx.exchanges_by_ccy.keys()) if self.fx else []
|
||||
currencies = sorted(self.fx.get_currencies()) if self.fx else []
|
||||
my_ccy = self.fx.get_currency() if self.fx.is_enabled() else ''
|
||||
self.ids.ccy.values = currencies
|
||||
self.ids.ccy.text = my_ccy
|
||||
|
||||
@@ -2578,7 +2578,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||
ex_combo = QComboBox()
|
||||
|
||||
def update_currencies():
|
||||
currencies = sorted(self.fx.exchanges_by_ccy.keys())
|
||||
currencies = sorted(self.fx.get_currencies())
|
||||
ccy_combo.clear()
|
||||
ccy_combo.addItems([_('None')] + currencies)
|
||||
if self.fx.is_enabled():
|
||||
@@ -2596,7 +2596,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||
c = self.fx.get_currency()
|
||||
exchanges = self.fx.get_exchanges_by_ccy(c, h)
|
||||
else:
|
||||
exchanges = self.fx.exchanges.keys()
|
||||
exchanges = self.fx.get_exchanges_by_ccy('USD', False)
|
||||
ex_combo.clear()
|
||||
ex_combo.addItems(sorted(exchanges))
|
||||
ex_combo.setCurrentIndex(ex_combo.findText(self.fx.config_exchange()))
|
||||
@@ -2613,11 +2613,12 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||
|
||||
def on_exchange(idx):
|
||||
exchange = str(ex_combo.currentText())
|
||||
if self.fx.is_enabled() and exchange != self.fx.exchange.name():
|
||||
if self.fx.is_enabled() and exchange and exchange != self.fx.exchange.name():
|
||||
self.fx.set_exchange(exchange)
|
||||
|
||||
def on_history(checked):
|
||||
self.fx.set_history_config(checked)
|
||||
update_exchanges()
|
||||
self.history_list.refresh_headers()
|
||||
if self.fx.is_enabled() and checked:
|
||||
# reset timeout to get historical rates
|
||||
|
||||
Reference in New Issue
Block a user