electrum-bitcoinprivate/plugins/ledger/qt.py

38 lines
1.2 KiB
Python
Raw Normal View History

import threading
from PyQt4.Qt import (QDialog, QInputDialog, QLineEdit,
QVBoxLayout, QLabel, SIGNAL)
import PyQt4.QtCore as QtCore
2015-12-01 01:00:39 -08:00
from electrum.i18n import _
from electrum.plugins import hook
from .ledger import LedgerPlugin, BTChipWallet
2016-01-29 22:46:19 -08:00
from ..hw_wallet import QtHandlerBase
class Plugin(LedgerPlugin):
@hook
def load_wallet(self, wallet, window):
if type(wallet) != BTChipWallet:
return
wallet.handler = BTChipQTHandler(window)
if self.btchip_is_connected(wallet):
if not wallet.check_proper_device():
2015-12-23 03:42:30 -08:00
window.show_error(_("This wallet does not match your Ledger device"))
wallet.force_watching_only = True
else:
2015-12-23 03:42:30 -08:00
window.show_error(_("Ledger device not detected.\nContinuing in watching-only mode."))
wallet.force_watching_only = True
def on_create_wallet(self, wallet, wizard):
assert type(wallet) == self.wallet_class
wallet.handler = BTChipQTHandler(wizard)
# self.select_device(wallet)
wallet.create_hd_account(None)
2016-01-29 22:46:19 -08:00
class BTChipQTHandler(QtHandlerBase):
def __init__(self, win):
2016-01-29 22:46:19 -08:00
super(BTChipQTHandler, self).__init__(win, 'Ledger')