init plugins before gui. register wallet types in plugin constructor
This commit is contained in:
@@ -7,6 +7,7 @@ from sys import stderr
|
||||
from time import sleep
|
||||
from base64 import b64encode, b64decode
|
||||
|
||||
import electrum
|
||||
from electrum_gui.qt.password_dialog import make_password_dialog, run_password_dialog
|
||||
from electrum_gui.qt.util import ok_cancel_buttons
|
||||
from electrum.account import BIP32_Account
|
||||
@@ -41,14 +42,18 @@ def give_error(message):
|
||||
|
||||
class Plugin(BasePlugin):
|
||||
|
||||
def fullname(self): return 'BTChip Wallet'
|
||||
def fullname(self):
|
||||
return 'BTChip Wallet'
|
||||
|
||||
def description(self): return 'Provides support for BTChip hardware wallet\n\nRequires github.com/btchip/btchip-python'
|
||||
def description(self):
|
||||
return 'Provides support for BTChip hardware wallet\n\nRequires github.com/btchip/btchip-python'
|
||||
|
||||
def __init__(self, gui, name):
|
||||
BasePlugin.__init__(self, gui, name)
|
||||
self._is_available = self._init()
|
||||
self.wallet = None
|
||||
electrum.wallet.wallet_types.append(('btchip', _("BTChip wallet"), BTChipWallet))
|
||||
|
||||
|
||||
def _init(self):
|
||||
return BTCHIP
|
||||
@@ -76,12 +81,12 @@ class Plugin(BasePlugin):
|
||||
return BasePlugin.enable(self)
|
||||
|
||||
@hook
|
||||
def load_wallet(self, wallet):
|
||||
self.wallet = wallet
|
||||
def init_qt(self, gui):
|
||||
self.gui = gui
|
||||
|
||||
@hook
|
||||
def add_wallet_types(self, wallet_types):
|
||||
wallet_types.append(('btchip', _("BTChip wallet"), BTChipWallet))
|
||||
def load_wallet(self, wallet):
|
||||
self.wallet = wallet
|
||||
|
||||
@hook
|
||||
def installwizard_restore(self, wizard, storage):
|
||||
|
||||
@@ -52,6 +52,10 @@ class Plugin(BasePlugin):
|
||||
def _init(self):
|
||||
return loaded_qweb
|
||||
|
||||
@hook
|
||||
def init_qt(self, gui):
|
||||
self.gui = gui
|
||||
|
||||
def is_available(self):
|
||||
return self._is_available
|
||||
|
||||
|
||||
@@ -90,8 +90,8 @@ class Plugin(BasePlugin):
|
||||
return description
|
||||
|
||||
@hook
|
||||
def init(self):
|
||||
self.win = self.gui.main_window
|
||||
def init_qt(self, gui):
|
||||
self.win = gui.main_window
|
||||
self.win.connect(self.win, SIGNAL('cosigner:receive'), self.on_receive)
|
||||
if self.listener is None:
|
||||
self.listener = Listener(self)
|
||||
|
||||
@@ -339,7 +339,8 @@ class Plugin(BasePlugin):
|
||||
self.exchanges = [self.config.get('use_exchange', "Blockchain")]
|
||||
|
||||
@hook
|
||||
def init(self):
|
||||
def init_qt(self, gui):
|
||||
self.gui = gui
|
||||
self.win = self.gui.main_window
|
||||
self.win.connect(self.win, SIGNAL("refresh_currencies()"), self.win.update_status)
|
||||
self.btc_rate = Decimal("0.0")
|
||||
|
||||
@@ -44,9 +44,9 @@ class Plugin(BasePlugin):
|
||||
return decoded_message
|
||||
|
||||
@hook
|
||||
def init(self):
|
||||
def init_qt(self, gui):
|
||||
self.target_host = 'labelectrum.herokuapp.com'
|
||||
self.window = self.gui.main_window
|
||||
self.window = gui.main_window
|
||||
|
||||
@hook
|
||||
def load_wallet(self, wallet):
|
||||
@@ -154,7 +154,7 @@ class Plugin(BasePlugin):
|
||||
def enable(self):
|
||||
if not self.auth_token(): # First run, throw plugin settings in your face
|
||||
self.init()
|
||||
self.load_wallet(self.gui.main_window.wallet)
|
||||
self.load_wallet(self.window.wallet)
|
||||
if self.settings_dialog():
|
||||
self.set_enabled(True)
|
||||
return True
|
||||
|
||||
@@ -6,6 +6,7 @@ from sys import stderr
|
||||
from time import sleep
|
||||
from base64 import b64encode, b64decode
|
||||
|
||||
import electrum
|
||||
from electrum_gui.qt.password_dialog import make_password_dialog, run_password_dialog
|
||||
from electrum_gui.qt.util import ok_cancel_buttons, EnterButton
|
||||
from electrum.account import BIP32_Account
|
||||
@@ -36,15 +37,18 @@ def give_error(message):
|
||||
|
||||
class Plugin(BasePlugin):
|
||||
|
||||
def fullname(self): return 'Trezor Wallet'
|
||||
def fullname(self):
|
||||
return 'Trezor Wallet'
|
||||
|
||||
def description(self): return 'Provides support for Trezor hardware wallet\n\nRequires github.com/trezor/python-trezor'
|
||||
def description(self):
|
||||
return 'Provides support for Trezor hardware wallet\n\nRequires github.com/trezor/python-trezor'
|
||||
|
||||
def __init__(self, gui, name):
|
||||
BasePlugin.__init__(self, gui, name)
|
||||
def __init__(self, config, name):
|
||||
BasePlugin.__init__(self, config, name)
|
||||
self._is_available = self._init()
|
||||
self._requires_settings = True
|
||||
self.wallet = None
|
||||
electrum.wallet.wallet_types.append(('trezor', _("Trezor wallet"), TrezorWallet))
|
||||
|
||||
def _init(self):
|
||||
return TREZOR
|
||||
@@ -78,10 +82,6 @@ class Plugin(BasePlugin):
|
||||
def load_wallet(self, wallet):
|
||||
self.wallet = wallet
|
||||
|
||||
@hook
|
||||
def add_wallet_types(self, wallet_types):
|
||||
wallet_types.append(('trezor', _("Trezor wallet"), TrezorWallet))
|
||||
|
||||
@hook
|
||||
def installwizard_restore(self, wizard, storage):
|
||||
if storage.get('wallet_type') != 'trezor':
|
||||
|
||||
@@ -11,7 +11,9 @@ class Plugin(BasePlugin):
|
||||
def description(self):
|
||||
return '%s\n%s' % (_("Add an optional virtual keyboard to the password dialog."), _("Warning: do not use this if it makes you pick a weaker password."))
|
||||
|
||||
def init(self):
|
||||
@hook
|
||||
def init_qt(self, gui):
|
||||
self.gui = gui
|
||||
self.vkb = None
|
||||
self.vkb_index = 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user