do not show plugins that register a custom wallet type in the plugins toggle dialog
This commit is contained in:
parent
aadffa0c8f
commit
e18ddd0096
|
@ -2835,6 +2835,8 @@ class ElectrumWindow(QMainWindow):
|
||||||
for i, descr in enumerate(descriptions):
|
for i, descr in enumerate(descriptions):
|
||||||
name = descr['name']
|
name = descr['name']
|
||||||
p = plugins.get(name)
|
p = plugins.get(name)
|
||||||
|
if descr.get('registers_wallet_type'):
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
cb = QCheckBox(descr['fullname'])
|
cb = QCheckBox(descr['fullname'])
|
||||||
cb.setEnabled(is_available(name, self.wallet))
|
cb.setEnabled(is_available(name, self.wallet))
|
||||||
|
|
|
@ -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.wallet import pw_decode, bip32_private_derivation, bip32_root
|
||||||
|
|
||||||
from electrum_gui.qt.util import *
|
from electrum_gui.qt.util import *
|
||||||
|
from electrum_gui.qt.main_window import StatusBarButton
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from trezorlib.client import types
|
from trezorlib.client import types
|
||||||
|
@ -49,7 +50,6 @@ class Plugin(BasePlugin):
|
||||||
def __init__(self, config, name):
|
def __init__(self, config, name):
|
||||||
BasePlugin.__init__(self, config, name)
|
BasePlugin.__init__(self, config, name)
|
||||||
self._is_available = self._init()
|
self._is_available = self._init()
|
||||||
self._requires_settings = True
|
|
||||||
self.wallet = None
|
self.wallet = None
|
||||||
self.handler = None
|
self.handler = None
|
||||||
self.client = None
|
self.client = None
|
||||||
|
@ -70,9 +70,6 @@ class Plugin(BasePlugin):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def requires_settings(self):
|
|
||||||
return self._requires_settings
|
|
||||||
|
|
||||||
def set_enabled(self, enabled):
|
def set_enabled(self, enabled):
|
||||||
self.wallet.storage.put('use_' + self.name, enabled)
|
self.wallet.storage.put('use_' + self.name, enabled)
|
||||||
|
|
||||||
|
@ -132,21 +129,24 @@ class Plugin(BasePlugin):
|
||||||
self.wallet = wallet
|
self.wallet = wallet
|
||||||
self.window = window
|
self.window = window
|
||||||
self.wallet.plugin = self
|
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:
|
if self.handler is None:
|
||||||
self.handler = TrezorQtHandler(self.window.app)
|
self.handler = TrezorQtHandler(self.window.app)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.get_client().ping('t')
|
self.get_client().ping('t')
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
QMessageBox.information(self.window, _('Error'), _("Trezor device not detected.\nContinuing in watching-only mode." + '\n\nReason:\n' + str(e)), _('OK'))
|
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
|
self.wallet.force_watching_only = True
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.wallet.addresses() and not self.wallet.check_proper_device():
|
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'))
|
QMessageBox.information(self.window, _('Error'), _("This wallet does not match your Trezor device"), _('OK'))
|
||||||
self.wallet.force_watching_only = True
|
self.wallet.force_watching_only = True
|
||||||
|
|
||||||
|
@hook
|
||||||
|
def close_wallet(self):
|
||||||
|
self.window.statusBar().removeWidget(self.trezor_button)
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
def installwizard_load_wallet(self, wallet, window):
|
def installwizard_load_wallet(self, wallet, window):
|
||||||
self.load_wallet(wallet, window)
|
self.load_wallet(wallet, window)
|
||||||
|
@ -192,8 +192,6 @@ class Plugin(BasePlugin):
|
||||||
finally:
|
finally:
|
||||||
self.handler.stop()
|
self.handler.stop()
|
||||||
|
|
||||||
def settings_widget(self, window):
|
|
||||||
return EnterButton(_('Settings'), self.settings_dialog)
|
|
||||||
|
|
||||||
def settings_dialog(self):
|
def settings_dialog(self):
|
||||||
get_label = lambda: self.get_client().features.label
|
get_label = lambda: self.get_client().features.label
|
||||||
|
|
|
@ -228,9 +228,6 @@ class Plugin(BasePlugin):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def requires_settings(self):
|
|
||||||
return True
|
|
||||||
|
|
||||||
def set_enabled(self, enabled):
|
def set_enabled(self, enabled):
|
||||||
self.wallet.storage.put('use_' + self.name, enabled)
|
self.wallet.storage.put('use_' + self.name, enabled)
|
||||||
|
|
||||||
|
@ -538,9 +535,6 @@ class Plugin(BasePlugin):
|
||||||
return
|
return
|
||||||
return pw.get_amount()
|
return pw.get_amount()
|
||||||
|
|
||||||
def settings_widget(self, window):
|
|
||||||
return EnterButton(_('Settings'), self.settings_dialog)
|
|
||||||
|
|
||||||
def settings_dialog(self):
|
def settings_dialog(self):
|
||||||
self.waiting_dialog = WaitingDialog(self.window, 'please wait...', self.request_billing_info, self.show_settings_dialog)
|
self.waiting_dialog = WaitingDialog(self.window, 'please wait...', self.request_billing_info, self.show_settings_dialog)
|
||||||
self.waiting_dialog.start()
|
self.waiting_dialog.start()
|
||||||
|
|
Loading…
Reference in New Issue