Remove some unused hook infrastructure
This commit is contained in:
parent
2f58d419dc
commit
d63e754c67
4
electrum
4
electrum
|
@ -79,7 +79,7 @@ if is_bundle or is_local or is_android:
|
|||
from electrum import util
|
||||
from electrum import SimpleConfig, Network, Wallet, WalletStorage
|
||||
from electrum.util import print_msg, print_error, print_stderr, json_encode, json_decode, set_verbosity, InvalidPassword
|
||||
from electrum.plugins import Plugins, run_hook, always_hook
|
||||
from electrum.plugins import Plugins, run_hook
|
||||
from electrum.commands import get_parser, known_commands, Commands, config_variables
|
||||
from electrum.daemon import Daemon, get_daemon
|
||||
|
||||
|
@ -242,8 +242,6 @@ def run_offline_command(config, config_options):
|
|||
sys.exit(1)
|
||||
if cmd.requires_network:
|
||||
print_stderr("Warning: running command offline")
|
||||
# notify plugins
|
||||
always_hook('cmdline_load_wallet', wallet)
|
||||
# arguments passed to function
|
||||
args = map(lambda x: config.get(x), cmd.params)
|
||||
# decode json arguments
|
||||
|
|
|
@ -145,16 +145,10 @@ def hook(func):
|
|||
return func
|
||||
|
||||
def run_hook(name, *args):
|
||||
return _run_hook(name, False, *args)
|
||||
|
||||
def always_hook(name, *args):
|
||||
return _run_hook(name, True, *args)
|
||||
|
||||
def _run_hook(name, always, *args):
|
||||
results = []
|
||||
f_list = hooks.get(name, [])
|
||||
for p, f in f_list:
|
||||
if always or p.is_enabled():
|
||||
if p.is_enabled():
|
||||
try:
|
||||
r = f(*args)
|
||||
except Exception:
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from legder import LedgerPlugin
|
||||
from electrum.util import print_msg
|
||||
from electrum.plugins import hook
|
||||
|
||||
class BTChipCmdLineHandler:
|
||||
def stop(self):
|
||||
|
@ -18,8 +17,4 @@ class BTChipCmdLineHandler:
|
|||
return response
|
||||
|
||||
class Plugin(LedgerPlugin):
|
||||
@hook
|
||||
def cmdline_load_wallet(self, wallet):
|
||||
wallet.plugin = self
|
||||
if self.handler is None:
|
||||
self.handler = BTChipCmdLineHandler()
|
||||
handler = BTChipCmdLineHandler()
|
||||
|
|
Loading…
Reference in New Issue