commit 9e71ef2d680fe98422c2ea9e8e37fae41cea66d4
parent 8b7a8b13379612eef6a8e142c69006491811523e
Author: ThomasV <electrumdev@gmail.com>
Date: Sun, 30 Aug 2015 19:01:56 +0200
Merge pull request #1430 from keepkey/master
Added a "Cancel" button to transaction dialog
Diffstat:
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/plugins/keepkey.py b/plugins/keepkey.py
@@ -235,11 +235,12 @@ class Plugin(BasePlugin):
client = self.get_client()
inputs = self.tx_inputs(tx, True)
outputs = self.tx_outputs(tx)
- #try:
- signed_tx = client.sign_tx('Bitcoin', inputs, outputs)[1]
- #except Exception, e:
- # give_error(e)
- #finally:
+ try:
+ signed_tx = client.sign_tx('Bitcoin', inputs, outputs)[1]
+ except Exception, e:
+ self.handler.stop()
+ give_error(e)
+
self.handler.stop()
raw = signed_tx.encode('hex')
@@ -526,7 +527,7 @@ class KeepKeyGuiMixin(object):
message = "Confirm address on KeepKey device to continue"
else:
message = "Check KeepKey device to continue"
- self.handler.show_message(message)
+ self.handler.show_message(msg.code, message, self)
return proto.ButtonAck()
def callback_PinMatrixRequest(self, msg):
@@ -591,8 +592,10 @@ class KeepKeyQtHandler:
def stop(self):
self.win.emit(SIGNAL('keepkey_done'))
- def show_message(self, msg):
+ def show_message(self, msg_code, msg, client):
+ self.messsage_code = msg_code
self.message = msg
+ self.client = client
self.win.emit(SIGNAL('message_dialog'))
def get_pin(self, msg):
@@ -651,6 +654,11 @@ class KeepKeyQtHandler:
l = QLabel(self.message)
vbox = QVBoxLayout(self.d)
vbox.addWidget(l)
+
+ if self.messsage_code in (3, 8):
+ vbox.addLayout(Buttons(CancelButton(self.d)))
+ self.d.connect(self.d, SIGNAL('rejected()'), self.client.cancel)
+
self.d.show()
def dialog_stop(self):