@hook decorator for plugins
This commit is contained in:
@@ -26,7 +26,7 @@ from PyQt4.QtCore import *
|
||||
|
||||
from electrum import bitcoin, util
|
||||
from electrum import transaction
|
||||
from electrum.plugins import BasePlugin
|
||||
from electrum.plugins import BasePlugin, hook
|
||||
from electrum.i18n import _
|
||||
|
||||
import sys
|
||||
@@ -89,6 +89,7 @@ class Plugin(BasePlugin):
|
||||
def description(self):
|
||||
return description
|
||||
|
||||
@hook
|
||||
def init(self):
|
||||
self.win = self.gui.main_window
|
||||
self.win.connect(self.win, SIGNAL('cosigner:receive'), self.on_receive)
|
||||
@@ -108,6 +109,7 @@ class Plugin(BasePlugin):
|
||||
return True
|
||||
return self.wallet.wallet_type in ['2of2', '2of3']
|
||||
|
||||
@hook
|
||||
def load_wallet(self, wallet):
|
||||
self.wallet = wallet
|
||||
if not self.is_available():
|
||||
@@ -123,12 +125,14 @@ class Plugin(BasePlugin):
|
||||
else:
|
||||
self.cosigner_list.append((xpub, K, _hash))
|
||||
|
||||
@hook
|
||||
def transaction_dialog(self, d):
|
||||
self.send_button = b = QPushButton(_("Send to cosigner"))
|
||||
b.clicked.connect(lambda: self.do_send(d.tx))
|
||||
d.buttons.insertWidget(2, b)
|
||||
self.transaction_dialog_update(d)
|
||||
|
||||
@hook
|
||||
def transaction_dialog_update(self, d):
|
||||
if d.tx.is_complete():
|
||||
self.send_button.hide()
|
||||
|
||||
Reference in New Issue
Block a user