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.
This commit is contained in:
parent
0429fe5960
commit
27299092df
@ -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)
|
||||
|
||||
@ -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…
Reference in New Issue
Block a user