trezor: more user friendly when cannot connect
Tell the user and ask if they want to try again. If they say no, raise a silent exception. Apply this more friendly behaviour to the install wizard too (see issue #1668).
This commit is contained in:
@@ -34,6 +34,7 @@ class QtHandlerBase(QObject, PrintError):
|
||||
logic for handling I/O.'''
|
||||
|
||||
qcSig = pyqtSignal(object, object)
|
||||
ynSig = pyqtSignal(object)
|
||||
|
||||
def __init__(self, win, device):
|
||||
super(QtHandlerBase, self).__init__()
|
||||
@@ -43,6 +44,7 @@ class QtHandlerBase(QObject, PrintError):
|
||||
win.connect(win, SIGNAL('passphrase_dialog'), self.passphrase_dialog)
|
||||
win.connect(win, SIGNAL('word_dialog'), self.word_dialog)
|
||||
self.qcSig.connect(self.win_query_choice)
|
||||
self.ynSig.connect(self.win_yes_no_question)
|
||||
self.win = win
|
||||
self.device = device
|
||||
self.dialog = None
|
||||
@@ -60,6 +62,12 @@ class QtHandlerBase(QObject, PrintError):
|
||||
self.done.wait()
|
||||
return self.choice
|
||||
|
||||
def yes_no_question(self, msg):
|
||||
self.done.clear()
|
||||
self.ynSig.emit(msg)
|
||||
self.done.wait()
|
||||
return self.ok
|
||||
|
||||
def show_message(self, msg, on_cancel=None):
|
||||
self.win.emit(SIGNAL('message_dialog'), msg, on_cancel)
|
||||
|
||||
@@ -126,3 +134,7 @@ class QtHandlerBase(QObject, PrintError):
|
||||
def win_query_choice(self, msg, labels):
|
||||
self.choice = self.win.query_choice(msg, labels)
|
||||
self.done.set()
|
||||
|
||||
def win_yes_no_question(self, msg):
|
||||
self.ok = self.top_level_window().question(msg)
|
||||
self.done.set()
|
||||
|
||||
Reference in New Issue
Block a user