electrum

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

commit e18ddd0096250d6ebcda2bc16a9ea49335d0e7c7
parent aadffa0c8f438ace747489e77978c247c9cb2602
Author: ThomasV <thomasv@gitorious>
Date:   Thu,  6 Aug 2015 11:12:15 +0200

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

Diffstat:
Mgui/qt/main_window.py | 2++
Mplugins/trezor.py | 16+++++++---------
Mplugins/trustedcoin.py | 6------
3 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -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)) diff --git a/plugins/trezor.py b/plugins/trezor.py @@ -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,22 +129,25 @@ 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 diff --git a/plugins/trustedcoin.py b/plugins/trustedcoin.py @@ -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()