Browse Source

Introduced BasePlugin.can_user_disable(). TrustedCoin plugin can't be disabled by user.

seed_v14
SomberNight 7 years ago
parent
commit
523de69b5e
  1. 7
      gui/qt/main_window.py
  2. 3
      lib/plugins.py
  3. 3
      plugins/trustedcoin/trustedcoin.py

7
gui/qt/main_window.py

@ -2853,8 +2853,11 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
continue continue
try: try:
cb = QCheckBox(descr['fullname']) cb = QCheckBox(descr['fullname'])
cb.setEnabled(plugins.is_available(name, self.wallet)) plugin_is_loaded = p is not None
cb.setChecked(p is not None and p.is_enabled()) 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) grid.addWidget(cb, i, 0)
enable_settings_widget(p, name, i) enable_settings_widget(p, name, i)
cb.clicked.connect(partial(do_toggle, cb, name, i)) cb.clicked.connect(partial(do_toggle, cb, name, i))

3
lib/plugins.py

@ -253,6 +253,9 @@ class BasePlugin(PrintError):
def is_available(self): def is_available(self):
return True return True
def can_user_disable(self):
return True
def settings_dialog(self): def settings_dialog(self):
pass pass

3
plugins/trustedcoin/trustedcoin.py

@ -332,6 +332,9 @@ class TrustedCoinPlugin(BasePlugin):
def is_enabled(self): def is_enabled(self):
return True return True
def can_user_disable(self):
return False
@hook @hook
def get_tx_extra_fee(self, wallet, tx): def get_tx_extra_fee(self, wallet, tx):
if type(wallet) != Wallet_2fa: if type(wallet) != Wallet_2fa:

Loading…
Cancel
Save