do not show plugins that register a custom wallet type in the plugins toggle dialog

This commit is contained in:
ThomasV 2015-08-06 11:12:15 +02:00
parent aadffa0c8f
commit e18ddd0096
3 changed files with 9 additions and 15 deletions

View File

@ -2835,6 +2835,8 @@ class ElectrumWindow(QMainWindow):
for i, descr in enumerate(descriptions):
name = descr['name']
p = plugins.get(name)
if descr.get('registers_wallet_type'):
continue
try:
cb = QCheckBox(descr['fullname'])
cb.setEnabled(is_available(name, self.wallet))

View File

@ -22,6 +22,7 @@ from electrum.util import print_error, print_msg
from electrum.wallet import pw_decode, bip32_private_derivation, bip32_root
from electrum_gui.qt.util import *
from electrum_gui.qt.main_window import StatusBarButton
try:
from trezorlib.client import types
@ -49,7 +50,6 @@ class Plugin(BasePlugin):
def __init__(self, config, name):
BasePlugin.__init__(self, config, name)
self._is_available = self._init()
self._requires_settings = True
self.wallet = None
self.handler = None
self.client = None
@ -70,9 +70,6 @@ class Plugin(BasePlugin):
return False
return True
def requires_settings(self):
return self._requires_settings
def set_enabled(self, enabled):
self.wallet.storage.put('use_' + self.name, enabled)
@ -132,21 +129,24 @@ class Plugin(BasePlugin):
self.wallet = wallet
self.window = window
self.wallet.plugin = self
self.trezor_button = StatusBarButton( QIcon(":icons/trustedcoin.png"), _("Network"), self.settings_dialog)
self.window.statusBar().addPermanentWidget(self.trezor_button)
if self.handler is None:
self.handler = TrezorQtHandler(self.window.app)
try:
self.get_client().ping('t')
except BaseException as e:
QMessageBox.information(self.window, _('Error'), _("Trezor device not detected.\nContinuing in watching-only mode." + '\n\nReason:\n' + str(e)), _('OK'))
self.wallet.force_watching_only = True
return
if self.wallet.addresses() and not self.wallet.check_proper_device():
QMessageBox.information(self.window, _('Error'), _("This wallet does not match your Trezor device"), _('OK'))
self.wallet.force_watching_only = True
@hook
def close_wallet(self):
self.window.statusBar().removeWidget(self.trezor_button)
@hook
def installwizard_load_wallet(self, wallet, window):
self.load_wallet(wallet, window)
@ -192,8 +192,6 @@ class Plugin(BasePlugin):
finally:
self.handler.stop()
def settings_widget(self, window):
return EnterButton(_('Settings'), self.settings_dialog)
def settings_dialog(self):
get_label = lambda: self.get_client().features.label

View File

@ -228,9 +228,6 @@ class Plugin(BasePlugin):
return True
return False
def requires_settings(self):
return True
def set_enabled(self, enabled):
self.wallet.storage.put('use_' + self.name, enabled)
@ -538,9 +535,6 @@ class Plugin(BasePlugin):
return
return pw.get_amount()
def settings_widget(self, window):
return EnterButton(_('Settings'), self.settings_dialog)
def settings_dialog(self):
self.waiting_dialog = WaitingDialog(self.window, 'please wait...', self.request_billing_info, self.show_settings_dialog)
self.waiting_dialog.start()