Add the keepkey cancellation feature

to the generic implementation.  Not currently used by the trezor
libraries.
This commit is contained in:
Neil Booth 2015-12-26 18:00:38 +09:00
parent 7b5f3884fa
commit cb4947d705
2 changed files with 11 additions and 7 deletions

View File

@ -268,7 +268,8 @@ class KeepKeyGuiMixin(object):
message = "Confirm address on KeepKey device to continue"
else:
message = "Check KeepKey device to continue"
self.handler.show_message(msg.code, message, self)
cancel_callback=self.cancel if msg.code in [3, 8] else None
self.handler.show_message(message, cancel_callback)
return proto.ButtonAck()
def callback_PinMatrixRequest(self, msg):

View File

@ -31,8 +31,8 @@ class QtHandler:
def stop(self):
self.win.emit(SIGNAL('message_done'))
def show_message(self, msg):
self.win.emit(SIGNAL('message_dialog'), msg)
def show_message(self, msg, cancel_callback=None):
self.win.emit(SIGNAL('message_dialog'), msg, cancel_callback)
def get_pin(self, msg):
self.done.clear()
@ -75,15 +75,18 @@ class QtHandler:
self.passphrase = passphrase
self.done.set()
def message_dialog(self, msg):
def message_dialog(self, msg, cancel_callback):
# Called more than once during signing, to confirm output and fee
self.dialog_stop()
msg = _('Please check your %s Device') % self.device
self.dialog = WindowModalDialog(self.win, msg)
dialog = self.dialog = WindowModalDialog(self.win, msg)
l = QLabel(msg)
vbox = QVBoxLayout(self.dialog)
vbox = QVBoxLayout(dialog)
if cancel_callback:
vbox.addLayout(Buttons(CancelButton(dialog)))
dialog.connect(dialog, SIGNAL('rejected()'), cancel_callback)
vbox.addWidget(l)
self.dialog.show()
dialog.show()
def dialog_stop(self):
if self.dialog: