Browse Source

config: force 'history_rates' config var to bool

fixes https://github.com/spesmilo/electrum/issues/8367

probably regression from 503776c0de
(note that before that commit, we were casting to bool)
master
SomberNight 3 years ago
parent
commit
3bdda3a861
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
  1. 4
      electrum/exchange_rate.py
  2. 2
      electrum/gui/qml/qefx.py
  3. 2
      electrum/gui/qt/history_list.py
  4. 2
      electrum/gui/qt/my_treeview.py
  5. 6
      electrum/gui/qt/settings_dialog.py

4
electrum/exchange_rate.py

@ -592,8 +592,8 @@ class FxThread(ThreadJob, EventListener):
def can_have_history(self):
return self.is_enabled() and self.ccy in self.exchange.history_ccys()
def has_history(self):
return self.can_have_history() and self.config.get('history_rates', False)
def has_history(self) -> bool:
return self.can_have_history() and bool(self.config.get('history_rates', False))
def get_currency(self) -> str:
'''Use when dynamic fetching is needed'''

2
electrum/gui/qml/qefx.py

@ -63,7 +63,7 @@ class QEFX(QObject, QtEventListener):
historicRatesChanged = pyqtSignal()
@pyqtProperty(bool, notify=historicRatesChanged)
def historicRates(self):
return self.fx.config.get('history_rates', True)
return bool(self.fx.config.get('history_rates', True))
@historicRates.setter
def historicRates(self, checked):

2
electrum/gui/qt/history_list.py

@ -252,7 +252,7 @@ class HistoryModel(CustomModel, Logger):
return True
def should_show_fiat(self):
if not self.window.config.get('history_rates', False):
if not bool(self.window.config.get('history_rates', False)):
return False
fx = self.window.fx
if not fx or not fx.is_enabled():

2
electrum/gui/qt/my_treeview.py

@ -83,7 +83,7 @@ class MyMenu(QMenu):
b = self.config.get(name, default)
m = self.addAction(text, lambda: self._do_toggle_config(name, default, callback))
m.setCheckable(True)
m.setChecked(b)
m.setChecked(bool(b))
m.setToolTip(tooltip)
return m

6
electrum/gui/qt/settings_dialog.py

@ -307,7 +307,7 @@ class SettingsDialog(QDialog, QtEventListener):
def update_currencies():
if not self.fx:
return
h = self.config.get('history_rates', False)
h = bool(self.config.get('history_rates', False))
currencies = sorted(self.fx.get_currencies(h))
ccy_combo.clear()
ccy_combo.addItems([_('None')] + currencies)
@ -319,7 +319,7 @@ class SettingsDialog(QDialog, QtEventListener):
b = self.fx.is_enabled()
ex_combo.setEnabled(b)
if b:
h = self.config.get('history_rates', False)
h = bool(self.config.get('history_rates', False))
c = self.fx.get_currency()
exchanges = self.fx.get_exchanges_by_ccy(c, h)
else:
@ -356,7 +356,7 @@ class SettingsDialog(QDialog, QtEventListener):
update_currencies()
update_exchanges()
ccy_combo.currentIndexChanged.connect(on_currency)
self.history_rates_cb.setChecked(self.config.get('history_rates', False))
self.history_rates_cb.setChecked(bool(self.config.get('history_rates', False)))
self.history_rates_cb.stateChanged.connect(on_history_rates)
ex_combo.currentIndexChanged.connect(on_exchange)

Loading…
Cancel
Save