tAdd the keepkey cancellation feature - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit cb4947d7056ee228e210c0facec88136cc228663 DIR parent 7b5f3884fadcf1938bec8f60049b1f4101cb8b14 HTML Author: Neil Booth <kyuupichan@gmail.com> Date: Sat, 26 Dec 2015 18:00:38 +0900 Add the keepkey cancellation feature tto the generic implementation. Not currently used by the trezor libraries. Diffstat: M plugins/keepkey/keepkey.py | 3 ++- M plugins/trezor/qt_generic.py | 15 +++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) --- DIR diff --git a/plugins/keepkey/keepkey.py b/plugins/keepkey/keepkey.py t@@ -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): DIR diff --git a/plugins/trezor/qt_generic.py b/plugins/trezor/qt_generic.py t@@ -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() t@@ -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: