1
0

fix command line interface for hardware wallets. fixes #3056

This commit is contained in:
ThomasV
2017-10-19 11:59:36 +02:00
parent 3c281c4056
commit 24442de8df
8 changed files with 71 additions and 76 deletions

View File

@@ -1,26 +1,11 @@
from electrum.util import print_msg, raw_input
from electrum.plugins import hook
from .trezor import TrezorPlugin
class TrezorCmdLineHandler:
def get_passphrase(self, msg, confirm):
import getpass
print_msg(msg)
return getpass.getpass('')
def get_pin(self, msg):
t = { 'a':'7', 'b':'8', 'c':'9', 'd':'4', 'e':'5', 'f':'6', 'g':'1', 'h':'2', 'i':'3'}
print_msg(msg)
print_msg("a b c\nd e f\ng h i\n-----")
o = raw_input()
return ''.join(map(lambda x: t[x], o))
def stop(self):
pass
def show_message(self, msg):
print_msg(msg)
from ..hw_wallet import CmdLineHandler
class Plugin(TrezorPlugin):
handler = TrezorCmdLineHandler()
handler = CmdLineHandler()
@hook
def init_keystore(self, keystore):
if not isinstance(keystore, self.keystore_class):
return
keystore.handler = self.handler

View File

@@ -132,8 +132,6 @@ class TrezorCompatiblePlugin(HW_PluginBase):
return client
def get_client(self, keystore, force_pair=True):
# All client interaction should not be in the main GUI thread
assert self.main_thread != threading.current_thread()
devmgr = self.device_manager()
handler = keystore.handler
with devmgr.hid_lock: