tfix: add wallet types only if available - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 395312e70f39bdbfccd637b66c947a10ab96487c DIR parent 513b92f1a5cd126805c5c66e7c50cf38a58b3bf7 HTML Author: ThomasV <thomasv@gitorious> Date: Sun, 1 Feb 2015 10:44:29 +0100 fix: add wallet types only if available Diffstat: M lib/plugins.py | 2 +- M lib/wallet.py | 1 - M plugins/btchipwallet.py | 6 +++--- M plugins/trezor.py | 3 ++- 4 files changed, 6 insertions(+), 6 deletions(-) --- DIR diff --git a/lib/plugins.py b/lib/plugins.py t@@ -40,7 +40,7 @@ def hook(func): def run_hook(name, *args): - SPECIAL_HOOKS = ['add_wallet_types', 'get_wizard_action'] + SPECIAL_HOOKS = ['get_wizard_action'] results = [] f_list = hooks.get(name,[]) for p, f in f_list: DIR diff --git a/lib/wallet.py b/lib/wallet.py t@@ -1637,7 +1637,6 @@ class Wallet(object): msg += "\nTo open this wallet, try 'git checkout seed_v%d'"%seed_version raise BaseException(msg) - run_hook('add_wallet_types', wallet_types) wallet_type = storage.get('wallet_type') if wallet_type: for cat, t, name, c in wallet_types: DIR diff --git a/plugins/btchipwallet.py b/plugins/btchipwallet.py t@@ -45,9 +45,9 @@ class Plugin(BasePlugin): def __init__(self, gui, name): BasePlugin.__init__(self, gui, name) self._is_available = self._init() - self.wallet = None - electrum.wallet.wallet_types.append(('hardware', 'btchip', _("BTChip wallet"), BTChipWallet)) - + self.wallet = None + if self._is_available: + electrum.wallet.wallet_types.append(('hardware', 'btchip', _("BTChip wallet"), BTChipWallet)) def _init(self): return BTCHIP DIR diff --git a/plugins/trezor.py b/plugins/trezor.py t@@ -49,7 +49,8 @@ class Plugin(BasePlugin): self._is_available = self._init() self._requires_settings = True self.wallet = None - electrum.wallet.wallet_types.append(('hardware', 'trezor', _("Trezor wallet"), TrezorWallet)) + if self._is_available: + electrum.wallet.wallet_types.append(('hardware', 'trezor', _("Trezor wallet"), TrezorWallet)) def _init(self): return TREZOR