kivy fx dialog: fix #5329

This commit is contained in:
SomberNight 2019-05-13 20:05:01 +02:00
parent fd58a0cb20
commit d2a80f15a1
No known key found for this signature in database
GPG key ID: B33B5F232C6271E9

View file

@ -95,15 +95,20 @@ class FxDialog(Factory.Popup):
self.add_currencies() self.add_currencies()
def add_exchanges(self): def add_exchanges(self):
ex = self.ids.exchanges
if self.fx.is_enabled(): if self.fx.is_enabled():
exchanges = sorted(self.fx.get_exchanges_by_ccy(self.fx.get_currency(), self.has_history_rates)) exchanges = sorted(self.fx.get_exchanges_by_ccy(self.fx.get_currency(), self.has_history_rates))
mx = self.fx.exchange.name() mx = self.fx.exchange.name()
if mx in exchanges:
ex.text = mx
elif exchanges:
ex.text = exchanges[0]
else:
ex.text = ''
else: else:
exchanges = [] exchanges = []
mx = '' ex.text = ''
ex = self.ids.exchanges
ex.values = exchanges ex.values = exchanges
ex.text = (mx if mx in exchanges else exchanges[0]) if self.fx.is_enabled() else ''
def on_exchange(self, text): def on_exchange(self, text):
if not text: if not text: