tMade the send_tx call for the lite gui asynchrone - electrum - Electrum Bitcoin wallet (HTM) git clone https://git.parazyd.org/electrum (DIR) Log (DIR) Files (DIR) Refs (DIR) Submodules --- (DIR) commit be9a64fef351f36f82121dd57903d5d810fee292 (DIR) parent d68fcf988444213606dee736fd60520793715f5e (HTM) Author: Maran <maran.hidskes@gmail.com> Date: Thu, 22 Nov 2012 19:33:13 +0100 Made the send_tx call for the lite gui asynchrone Diffstat: M lib/gui_lite.py | 32 ++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) --- (DIR) diff --git a/lib/gui_lite.py b/lib/gui_lite.py t@@ -4,6 +4,8 @@ import sys try: from PyQt4.QtCore import * from PyQt4.QtGui import * + import PyQt4.QtCore as QtCore + except ImportError: print "You need to have PyQT installed to run Electrum in graphical mode." print "If you have pip installed try 'sudo pip install pyqt' if you are on Debian/Ubuntu try 'sudo apt-get install python-qt4'." t@@ -711,6 +713,25 @@ class MiniActuator: receive_popup.setup(copied_address) receive_popup.popup() + def waiting_dialog(self, f): + s = Timer() + s.start() + w = QDialog() + w.resize(200, 70) + w.setWindowTitle('Electrum') + l = QLabel('Sending transaction, please wait.') + vbox = QVBoxLayout() + vbox.addWidget(l) + w.setLayout(vbox) + w.show() + def ff(): + s = f() + if s: l.setText(s) + else: w.close() + w.connect(s, QtCore.SIGNAL('timersignal'), ff) + w.exec_() + w.destroy() + def send(self, address, amount, parent_window): """Send bitcoins to the target address.""" dest_address = self.fetch_destination(address) t@@ -743,8 +764,13 @@ class MiniActuator: except BaseException as error: QMessageBox.warning(parent_window, _('Error'), str(error), _('OK')) return False - - status, message = self.wallet.sendtx(tx) + + h = self.wallet.send_tx(tx) + + self.waiting_dialog(lambda: False if self.wallet.tx_event.isSet() else _("Sending transaction, please wait...")) + + status, message = self.wallet.receive_tx(h) + if not status: import tempfile dumpf = tempfile.NamedTemporaryFile(delete=False) t@@ -755,7 +781,7 @@ class MiniActuator: return False QMessageBox.information(parent_window, '', - _('Payment sent.') + '\n' + message, _('OK')) + _('Your transaction has been sent.') + '\n' + message, _('OK')) return True def fetch_destination(self, address):