From 27299092dfddc484b942fc661fc815d12741583a Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 29 Jan 2019 17:25:02 +0100 Subject: [PATCH] hardware cmdline handler: print messages to stderr (take 2) follow-up 5613f9b903c6da799ec461d3a06b25ea0d0ee577 button_request should not call show_error as error dialogs in Qt block the GUI thread. --- electrum/plugins/hw_wallet/cmdline.py | 16 ++++++++-------- electrum/plugins/trezor/clientbase.py | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/electrum/plugins/hw_wallet/cmdline.py b/electrum/plugins/hw_wallet/cmdline.py index 1f69b55c6..fc4aaadf4 100644 --- a/electrum/plugins/hw_wallet/cmdline.py +++ b/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) diff --git a/electrum/plugins/trezor/clientbase.py b/electrum/plugins/trezor/clientbase.py index e30d4bc80..ed0d7b14c 100644 --- a/electrum/plugins/trezor/clientbase.py +++ b/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: