Browse Source

hardware cmdline handler: print messages to stderr (take 2)

follow-up 5613f9b903

button_request should not call show_error as error dialogs in Qt block
the GUI thread.
sqlite_db
SomberNight 6 years ago
parent
commit
27299092df
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 16
      electrum/plugins/hw_wallet/cmdline.py
  2. 2
      electrum/plugins/trezor/clientbase.py

16
electrum/plugins/hw_wallet/cmdline.py

@ -1,17 +1,17 @@
from electrum.util import print_msg, print_error, raw_input
from electrum.util import print_error, print_stderr, raw_input
class CmdLineHandler:
def get_passphrase(self, msg, confirm):
import getpass
print_msg(msg)
print_stderr(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-----")
print_stderr(msg)
print_stderr("a b c\nd e f\ng h i\n-----")
o = raw_input()
try:
return ''.join(map(lambda x: t[x], o))
@ -20,24 +20,24 @@ class CmdLineHandler:
def prompt_auth(self, msg):
import getpass
print_msg(msg)
print_stderr(msg)
response = getpass.getpass('')
if len(response) == 0:
return None
return response
def yes_no_question(self, msg):
print_msg(msg)
print_stderr(msg)
return raw_input() in 'yY'
def stop(self):
pass
def show_message(self, msg, on_cancel=None):
print_msg(msg)
print_stderr(msg)
def show_error(self, msg, blocking=False):
print_error(msg)
print_stderr(msg)
def update_status(self, b):
print_error('hw device status', b)

2
electrum/plugins/trezor/clientbase.py

@ -224,7 +224,7 @@ class TrezorClientBase(PrintError):
def button_request(self, code):
message = self.msg or MESSAGES.get(code) or MESSAGES['default']
self.handler.show_error(message.format(self.device), self.client.cancel)
self.handler.show_message(message.format(self.device), self.client.cancel)
def get_pin(self, code=None):
if code == 2:

Loading…
Cancel
Save