|
|
@ -1,4 +1,6 @@ |
|
|
|
from binascii import hexlify, unhexlify |
|
|
|
import traceback |
|
|
|
import sys |
|
|
|
|
|
|
|
from electrum.util import bfh, bh2u, versiontuple |
|
|
|
from electrum.bitcoin import (b58_address_to_hash160, xpub_from_pubkey, |
|
|
@ -196,12 +198,21 @@ class TrezorPlugin(HW_PluginBase): |
|
|
|
def f(method): |
|
|
|
import threading |
|
|
|
settings = self.request_trezor_init_settings(wizard, method, self.device) |
|
|
|
t = threading.Thread(target = self._initialize_device, args=(settings, method, device_id, wizard, handler)) |
|
|
|
t = threading.Thread(target=self._initialize_device_safe, args=(settings, method, device_id, wizard, handler)) |
|
|
|
t.setDaemon(True) |
|
|
|
t.start() |
|
|
|
wizard.loop.exec_() |
|
|
|
wizard.choice_dialog(title=_('Initialize Device'), message=msg, choices=choices, run_next=f) |
|
|
|
|
|
|
|
def _initialize_device_safe(self, settings, method, device_id, wizard, handler): |
|
|
|
try: |
|
|
|
self._initialize_device(settings, method, device_id, wizard, handler) |
|
|
|
except BaseException as e: |
|
|
|
traceback.print_exc(file=sys.stderr) |
|
|
|
handler.show_error(str(e)) |
|
|
|
finally: |
|
|
|
wizard.loop.exit(0) |
|
|
|
|
|
|
|
def _initialize_device(self, settings, method, device_id, wizard, handler): |
|
|
|
item, label, pin_protection, passphrase_protection = settings |
|
|
|
|
|
|
@ -240,7 +251,6 @@ class TrezorPlugin(HW_PluginBase): |
|
|
|
pin = pin_protection # It's the pin, not a boolean |
|
|
|
client.load_device_by_xprv(item, pin, passphrase_protection, |
|
|
|
label, language) |
|
|
|
wizard.loop.exit(0) |
|
|
|
|
|
|
|
def setup_device(self, device_info, wizard, purpose): |
|
|
|
devmgr = self.device_manager() |
|
|
|