1
0

Better support for USB devices

Benefits of this rewrite include:

- support of disconnecting / reconnecting a device without having
  to close the wallet, even in a different USB socket
- support of multiple keepkey / trezor devices, both during wallet
  creation and general use
- wallet is watching-only dynamically according to whether the
  associated device is currently plugged in or not
This commit is contained in:
Neil Booth
2016-01-02 09:43:56 +09:00
parent 187b4dc9c1
commit 21bf5a8a84
11 changed files with 345 additions and 225 deletions

View File

@@ -76,11 +76,9 @@ class WizardBase(PrintError):
string like "2of3". Action is 'create' or 'restore'."""
raise NotImplementedError
def query_hardware(self, choices, action):
"""Asks the user what kind of hardware wallet they want from the given
choices. choices is a list of (wallet_type, translated
description) tuples. Action is 'create' or 'restore'. Return
the wallet type chosen."""
def query_choice(self, msg, choices):
"""Asks the user which of several choices they would like.
Return the index of the choice."""
raise NotImplementedError
def show_and_verify_seed(self, seed):
@@ -205,8 +203,13 @@ class WizardBase(PrintError):
if kind == 'multisig':
wallet_type = self.query_multisig(action)
elif kind == 'hardware':
choices = self.plugins.hardware_wallets(action)
wallet_type = self.query_hardware(choices, action)
wallet_types, choices = self.plugins.hardware_wallets(action)
if action == 'create':
msg = _('Select the hardware wallet to create')
else:
msg = _('Select the hardware wallet to restore')
choice = self.query_choice(msg, choices)
wallet_type = wallet_types[choice]
elif kind == 'twofactor':
wallet_type = '2fa'
else: