Plugins manage their own wallet tracking
This commit is contained in:
parent
53f6fb9876
commit
e9384f15ed
@ -162,8 +162,6 @@ def _run_hook(name, always, *args):
|
|||||||
results = []
|
results = []
|
||||||
f_list = hooks.get(name, [])
|
f_list = hooks.get(name, [])
|
||||||
for p, f in f_list:
|
for p, f in f_list:
|
||||||
if name == 'load_wallet':
|
|
||||||
p.wallet = args[0]
|
|
||||||
if always or p.is_enabled():
|
if always or p.is_enabled():
|
||||||
try:
|
try:
|
||||||
r = f(*args)
|
r = f(*args)
|
||||||
@ -173,8 +171,6 @@ def _run_hook(name, always, *args):
|
|||||||
r = False
|
r = False
|
||||||
if r:
|
if r:
|
||||||
results.append(r)
|
results.append(r)
|
||||||
if name == 'close_wallet':
|
|
||||||
p.wallet = None
|
|
||||||
|
|
||||||
if results:
|
if results:
|
||||||
assert len(results) == 1, results
|
assert len(results) == 1, results
|
||||||
|
|||||||
@ -93,6 +93,10 @@ class Plugin(BasePlugin):
|
|||||||
QMessageBox.information(window, _('Error'), _("Ledger device not detected.\nContinuing in watching-only mode."), _('OK'))
|
QMessageBox.information(window, _('Error'), _("Ledger device not detected.\nContinuing in watching-only mode."), _('OK'))
|
||||||
self.wallet.force_watching_only = True
|
self.wallet.force_watching_only = True
|
||||||
|
|
||||||
|
@hook
|
||||||
|
def close_wallet(self):
|
||||||
|
self.wallet = None
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
def installwizard_load_wallet(self, wallet, window):
|
def installwizard_load_wallet(self, wallet, window):
|
||||||
if type(wallet) != BTChipWallet:
|
if type(wallet) != BTChipWallet:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user