Browse Source

define special hooks for install wizard

master
ThomasV 11 years ago
parent
commit
94c9bf3655
  1. 3
      lib/plugins.py
  2. 16
      plugins/trustedcoin.py

3
lib/plugins.py

@ -40,12 +40,13 @@ def hook(func):
def run_hook(name, *args): def run_hook(name, *args):
SPECIAL_HOOKS = ['add_wallet_types', 'get_wizard_action']
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': if name == 'load_wallet':
p.wallet = args[0] p.wallet = args[0]
if p.is_enabled(): if name in SPECIAL_HOOKS or p.is_enabled():
try: try:
r = f(*args) r = f(*args)
except Exception: except Exception:

16
plugins/trustedcoin.py

@ -344,15 +344,13 @@ class Plugin(BasePlugin):
@hook @hook
def load_wallet(self, wallet): def load_wallet(self, wallet):
self.wallet = wallet self.trustedcoin_button = StatusBarButton( QIcon(":icons/trustedcoin.png"), _("Network"), self.settings_dialog)
if self.is_enabled(): self.window.statusBar().addPermanentWidget(self.trustedcoin_button)
self.trustedcoin_button = StatusBarButton( QIcon(":icons/trustedcoin.png"), _("Network"), self.settings_dialog) self.xpub = self.wallet.master_public_keys.get('x1/')
self.window.statusBar().addPermanentWidget(self.trustedcoin_button) self.user_id = self.get_user_id()[1]
self.xpub = self.wallet.master_public_keys.get('x1/') t = threading.Thread(target=self.request_billing_info)
self.user_id = self.get_user_id()[1] t.setDaemon(True)
t = threading.Thread(target=self.request_billing_info) t.start()
t.setDaemon(True)
t.start()
@hook @hook
def close_wallet(self): def close_wallet(self):

Loading…
Cancel
Save