texchange_rate: (fix) rm need to restart app to disable FX rates - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 1fb0c28d0ab316bc07ced9f531787b54db3d57e0 DIR parent 1a629d88e79c44539d865e60a898ae5df32019aa HTML Author: SomberNight <somber.night@protonmail.com> Date: Fri, 29 Jan 2021 19:53:04 +0100 exchange_rate: (fix) rm need to restart app to disable FX rates Previously if the user disabled FX rates in the settings, the UI would keep showing the fiat amounts everywhere until the next time tthe program was started. (and the rates would not even refresh anymore) Diffstat: M electrum/exchange_rate.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- DIR diff --git a/electrum/exchange_rate.py b/electrum/exchange_rate.py t@@ -577,7 +577,7 @@ class FxThread(ThreadJob): def show_history(self): return self.is_enabled() and self.get_history_config() and self.ccy in self.exchange.history_ccys() - def set_currency(self, ccy): + def set_currency(self, ccy: str): self.ccy = ccy self.config.set_key('currency', ccy, True) self.trigger_update() t@@ -607,6 +607,8 @@ class FxThread(ThreadJob): def exchange_rate(self) -> Decimal: """Returns the exchange rate as a Decimal""" + if not self.is_enabled(): + return Decimal('NaN') rate = self.exchange.quotes.get(self.ccy) if rate is None: return Decimal('NaN')