1
0

Wallet: encapsulate wallet_types

Previously plugins would append lines to it and wizard.py would
hack into it too.
This commit is contained in:
Neil Booth
2016-02-08 22:32:49 +09:00
parent 151ac099a9
commit b54ba556bc
3 changed files with 30 additions and 19 deletions

View File

@@ -27,7 +27,7 @@ import time
from util import *
from i18n import _
from util import profiler, PrintError, DaemonThread, UserCancelled
import wallet
class Plugins(DaemonThread):
@@ -140,13 +140,16 @@ class Plugins(DaemonThread):
return wallet_types, descs
def register_plugin_wallet(self, name, gui_good, details):
from wallet import Wallet
def dynamic_constructor(storage):
return self.wallet_plugin_loader(name).wallet_class(storage)
if details[0] == 'hardware':
self.hw_wallets[name] = (gui_good, details)
self.print_error("registering wallet %s: %s" %(name, details))
wallet.wallet_types.append(details + (dynamic_constructor,))
Wallet.register_plugin_wallet(details[0], details[1],
dynamic_constructor)
def wallet_plugin_loader(self, name):
if not name in self.plugins: