URI: 
       tfix #4698 - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit f9a5f2e1835e8326d1d030a6e79bd148455ee6be
   DIR parent 8caab35d90087f413ec330c29ffa7a61d6c378a2
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Wed, 19 Sep 2018 20:02:03 +0200
       
       fix #4698
       
       Diffstat:
         M electrum/plugins/coldcard/qt.py     |       3 +++
         M electrum/plugins/digitalbitbox/qt.… |       8 +++++---
         M electrum/plugins/hw_wallet/plugin.… |       7 +++++++
         M electrum/plugins/keepkey/qt.py      |       2 ++
         M electrum/plugins/ledger/qt.py       |       2 ++
         M electrum/plugins/safe_t/qt.py       |       2 ++
         M electrum/plugins/trezor/qt.py       |       2 ++
       
       7 files changed, 23 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/electrum/plugins/coldcard/qt.py b/electrum/plugins/coldcard/qt.py
       t@@ -7,6 +7,7 @@ from electrum.gui.qt.util import *
        
        from .coldcard import ColdcardPlugin
        from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
       +from ..hw_wallet.plugin import only_hook_if_libraries_available
        
        
        class Plugin(ColdcardPlugin, QtPluginBase):
       t@@ -17,6 +18,7 @@ class Plugin(ColdcardPlugin, QtPluginBase):
                return Coldcard_Handler(window)
        
            @hook
       +    @only_hook_if_libraries_available
            def receive_menu(self, menu, addrs, wallet):
                if type(wallet) is not Standard_Wallet:
                    return
       t@@ -27,6 +29,7 @@ class Plugin(ColdcardPlugin, QtPluginBase):
                    menu.addAction(_("Show on Coldcard"), show_address)
        
            @hook
       +    @only_hook_if_libraries_available
            def transaction_dialog(self, dia):
                # see gui/qt/transaction_dialog.py
        
   DIR diff --git a/electrum/plugins/digitalbitbox/qt.py b/electrum/plugins/digitalbitbox/qt.py
       t@@ -1,12 +1,13 @@
        from functools import partial
        
       -from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
       -from .digitalbitbox import DigitalBitboxPlugin
       -
        from electrum.i18n import _
        from electrum.plugin import hook
        from electrum.wallet import Standard_Wallet
        
       +from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
       +from ..hw_wallet.plugin import only_hook_if_libraries_available
       +from .digitalbitbox import DigitalBitboxPlugin
       +
        
        class Plugin(DigitalBitboxPlugin, QtPluginBase):
            icon_unpaired = ":icons/digitalbitbox_unpaired.png"
       t@@ -16,6 +17,7 @@ class Plugin(DigitalBitboxPlugin, QtPluginBase):
                return DigitalBitbox_Handler(window)
        
            @hook
       +    @only_hook_if_libraries_available
            def receive_menu(self, menu, addrs, wallet):
                if type(wallet) is not Standard_Wallet:
                    return
   DIR diff --git a/electrum/plugins/hw_wallet/plugin.py b/electrum/plugins/hw_wallet/plugin.py
       t@@ -135,3 +135,10 @@ def trezor_validate_op_return_output_and_get_data(output: TxOutput) -> bytes:
            if output.value != 0:
                raise Exception(_("Amount for OP_RETURN output must be zero."))
            return script[2:]
       +
       +
       +def only_hook_if_libraries_available(func):
       +    def wrapper(self, *args, **kwargs):
       +        if not self.libraries_available: return None
       +        return func(self, *args, **kwargs)
       +    return wrapper
   DIR diff --git a/electrum/plugins/keepkey/qt.py b/electrum/plugins/keepkey/qt.py
       t@@ -12,6 +12,7 @@ from electrum.util import PrintError, UserCancelled, bh2u
        from electrum.wallet import Wallet, Standard_Wallet
        
        from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
       +from ..hw_wallet.plugin import only_hook_if_libraries_available
        from .keepkey import KeepKeyPlugin, TIM_NEW, TIM_RECOVER, TIM_MNEMONIC
        
        
       t@@ -195,6 +196,7 @@ class QtPlugin(QtPluginBase):
                return QtHandler(window, self.pin_matrix_widget_class(), self.device)
        
            @hook
       +    @only_hook_if_libraries_available
            def receive_menu(self, menu, addrs, wallet):
                if type(wallet) is not Standard_Wallet:
                    return
   DIR diff --git a/electrum/plugins/ledger/qt.py b/electrum/plugins/ledger/qt.py
       t@@ -7,6 +7,7 @@ from electrum.gui.qt.util import *
        
        from .ledger import LedgerPlugin
        from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
       +from ..hw_wallet.plugin import only_hook_if_libraries_available
        
        
        class Plugin(LedgerPlugin, QtPluginBase):
       t@@ -17,6 +18,7 @@ class Plugin(LedgerPlugin, QtPluginBase):
                return Ledger_Handler(window)
        
            @hook
       +    @only_hook_if_libraries_available
            def receive_menu(self, menu, addrs, wallet):
                if type(wallet) is not Standard_Wallet:
                    return
   DIR diff --git a/electrum/plugins/safe_t/qt.py b/electrum/plugins/safe_t/qt.py
       t@@ -12,6 +12,7 @@ from electrum.util import PrintError, UserCancelled, bh2u
        from electrum.wallet import Wallet, Standard_Wallet
        
        from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
       +from ..hw_wallet.plugin import only_hook_if_libraries_available
        from .safe_t import SafeTPlugin, TIM_NEW, TIM_RECOVER, TIM_MNEMONIC
        
        
       t@@ -71,6 +72,7 @@ class QtPlugin(QtPluginBase):
                return QtHandler(window, self.pin_matrix_widget_class(), self.device)
        
            @hook
       +    @only_hook_if_libraries_available
            def receive_menu(self, menu, addrs, wallet):
                if len(addrs) != 1:
                    return
   DIR diff --git a/electrum/plugins/trezor/qt.py b/electrum/plugins/trezor/qt.py
       t@@ -12,6 +12,7 @@ from electrum.util import PrintError, UserCancelled, bh2u
        from electrum.wallet import Wallet, Standard_Wallet
        
        from ..hw_wallet.qt import QtHandlerBase, QtPluginBase
       +from ..hw_wallet.plugin import only_hook_if_libraries_available
        from .trezor import (TrezorPlugin, TIM_NEW, TIM_RECOVER, TIM_MNEMONIC,
                             RECOVERY_TYPE_SCRAMBLED_WORDS, RECOVERY_TYPE_MATRIX)
        
       t@@ -166,6 +167,7 @@ class QtPlugin(QtPluginBase):
                return QtHandler(window, self.pin_matrix_widget_class(), self.device)
        
            @hook
       +    @only_hook_if_libraries_available
            def receive_menu(self, menu, addrs, wallet):
                if len(addrs) != 1:
                    return