electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 55e6c247bc79e2a13625e1d0c40a68af7625657c
parent 020f0637d7d8ec412df3762cfa9485a36574d274
Author: ThomasV <thomasv@electrum.org>
Date:   Tue, 24 Oct 2017 07:11:20 +0200

Merge pull request #3102 from SomberNight/2fa_plugin_cant_be_disabled

Disallow disabling TrustedCoin for 2FA wallets
Diffstat:
Mgui/qt/main_window.py | 7+++++--
Mlib/plugins.py | 3+++
Mplugins/trustedcoin/trustedcoin.py | 3+++
3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -2853,8 +2853,11 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError): continue try: cb = QCheckBox(descr['fullname']) - cb.setEnabled(plugins.is_available(name, self.wallet)) - cb.setChecked(p is not None and p.is_enabled()) + plugin_is_loaded = p is not None + cb_enabled = (not plugin_is_loaded and plugins.is_available(name, self.wallet) + or plugin_is_loaded and p.can_user_disable()) + cb.setEnabled(cb_enabled) + cb.setChecked(plugin_is_loaded and p.is_enabled()) grid.addWidget(cb, i, 0) enable_settings_widget(p, name, i) cb.clicked.connect(partial(do_toggle, cb, name, i)) diff --git a/lib/plugins.py b/lib/plugins.py @@ -253,6 +253,9 @@ class BasePlugin(PrintError): def is_available(self): return True + def can_user_disable(self): + return True + def settings_dialog(self): pass diff --git a/plugins/trustedcoin/trustedcoin.py b/plugins/trustedcoin/trustedcoin.py @@ -332,6 +332,9 @@ class TrustedCoinPlugin(BasePlugin): def is_enabled(self): return True + def can_user_disable(self): + return False + @hook def get_tx_extra_fee(self, wallet, tx): if type(wallet) != Wallet_2fa: