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)
This commit is contained in:
@@ -592,8 +592,8 @@ class FxThread(ThreadJob, EventListener):
|
|||||||
def can_have_history(self):
|
def can_have_history(self):
|
||||||
return self.is_enabled() and self.ccy in self.exchange.history_ccys()
|
return self.is_enabled() and self.ccy in self.exchange.history_ccys()
|
||||||
|
|
||||||
def has_history(self):
|
def has_history(self) -> bool:
|
||||||
return self.can_have_history() and self.config.get('history_rates', False)
|
return self.can_have_history() and bool(self.config.get('history_rates', False))
|
||||||
|
|
||||||
def get_currency(self) -> str:
|
def get_currency(self) -> str:
|
||||||
'''Use when dynamic fetching is needed'''
|
'''Use when dynamic fetching is needed'''
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class QEFX(QObject, QtEventListener):
|
|||||||
historicRatesChanged = pyqtSignal()
|
historicRatesChanged = pyqtSignal()
|
||||||
@pyqtProperty(bool, notify=historicRatesChanged)
|
@pyqtProperty(bool, notify=historicRatesChanged)
|
||||||
def historicRates(self):
|
def historicRates(self):
|
||||||
return self.fx.config.get('history_rates', True)
|
return bool(self.fx.config.get('history_rates', True))
|
||||||
|
|
||||||
@historicRates.setter
|
@historicRates.setter
|
||||||
def historicRates(self, checked):
|
def historicRates(self, checked):
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ class HistoryModel(CustomModel, Logger):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def should_show_fiat(self):
|
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
|
return False
|
||||||
fx = self.window.fx
|
fx = self.window.fx
|
||||||
if not fx or not fx.is_enabled():
|
if not fx or not fx.is_enabled():
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class MyMenu(QMenu):
|
|||||||
b = self.config.get(name, default)
|
b = self.config.get(name, default)
|
||||||
m = self.addAction(text, lambda: self._do_toggle_config(name, default, callback))
|
m = self.addAction(text, lambda: self._do_toggle_config(name, default, callback))
|
||||||
m.setCheckable(True)
|
m.setCheckable(True)
|
||||||
m.setChecked(b)
|
m.setChecked(bool(b))
|
||||||
m.setToolTip(tooltip)
|
m.setToolTip(tooltip)
|
||||||
return m
|
return m
|
||||||
|
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ class SettingsDialog(QDialog, QtEventListener):
|
|||||||
def update_currencies():
|
def update_currencies():
|
||||||
if not self.fx:
|
if not self.fx:
|
||||||
return
|
return
|
||||||
h = self.config.get('history_rates', False)
|
h = bool(self.config.get('history_rates', False))
|
||||||
currencies = sorted(self.fx.get_currencies(h))
|
currencies = sorted(self.fx.get_currencies(h))
|
||||||
ccy_combo.clear()
|
ccy_combo.clear()
|
||||||
ccy_combo.addItems([_('None')] + currencies)
|
ccy_combo.addItems([_('None')] + currencies)
|
||||||
@@ -319,7 +319,7 @@ class SettingsDialog(QDialog, QtEventListener):
|
|||||||
b = self.fx.is_enabled()
|
b = self.fx.is_enabled()
|
||||||
ex_combo.setEnabled(b)
|
ex_combo.setEnabled(b)
|
||||||
if b:
|
if b:
|
||||||
h = self.config.get('history_rates', False)
|
h = bool(self.config.get('history_rates', False))
|
||||||
c = self.fx.get_currency()
|
c = self.fx.get_currency()
|
||||||
exchanges = self.fx.get_exchanges_by_ccy(c, h)
|
exchanges = self.fx.get_exchanges_by_ccy(c, h)
|
||||||
else:
|
else:
|
||||||
@@ -356,7 +356,7 @@ class SettingsDialog(QDialog, QtEventListener):
|
|||||||
update_currencies()
|
update_currencies()
|
||||||
update_exchanges()
|
update_exchanges()
|
||||||
ccy_combo.currentIndexChanged.connect(on_currency)
|
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)
|
self.history_rates_cb.stateChanged.connect(on_history_rates)
|
||||||
ex_combo.currentIndexChanged.connect(on_exchange)
|
ex_combo.currentIndexChanged.connect(on_exchange)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user