tcatch exception within sign thread, to re-enable send button - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
DIR commit 2da9a02fb382684fb130399f6e634d2e19d66692
DIR parent 55770a93bff3ea914133d7591080a75060a44418
HTML Author: ThomasV <thomasv@gitorious>
Date: Tue, 24 Jun 2014 19:09:41 +0200
catch exception within sign thread, to re-enable send button
Diffstat:
M gui/qt/main_window.py | 13 ++++++++-----
M gui/qt/util.py | 5 ++++-
2 files changed, 12 insertions(+), 6 deletions(-)
---
DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
t@@ -1021,13 +1021,15 @@ class ElectrumWindow(QMainWindow):
# sign the tx
def sign_thread():
- time.sleep(0.1)
keypairs = {}
- self.wallet.add_keypairs(tx, keypairs, password)
- self.wallet.sign_transaction(tx, keypairs, password)
- return tx, fee, label
+ try:
+ self.wallet.add_keypairs(tx, keypairs, password)
+ self.wallet.sign_transaction(tx, keypairs, password)
+ except Exception as e:
+ tx.error = str(e)
+ return tx
- def sign_done(tx, fee, label):
+ def sign_done(tx):
if tx.error:
self.show_message(tx.error)
self.send_button.setDisabled(False)
t@@ -1047,6 +1049,7 @@ class ElectrumWindow(QMainWindow):
self.broadcast_transaction(tx)
+ # keep a reference to WaitingDialog or the gui might crash
self.waiting_dialog = WaitingDialog(self, 'Signing..', sign_thread, sign_done)
self.waiting_dialog.start()
DIR diff --git a/gui/qt/util.py b/gui/qt/util.py
t@@ -37,7 +37,10 @@ class WaitingDialog(QThread):
return
if self.on_complete:
- self.on_complete(*self.result)
+ if type(self.result) is tuple:
+ self.on_complete(*self.result)
+ else:
+ self.on_complete(self.result)