electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 17ff5d162d78b724a0d24bd1df6642f38270b7dd
parent 40b3b47d5b0f694424236b551333c5c25d0827c6
Author: ThomasV <thomasv@gitorious>
Date:   Mon, 26 May 2014 05:40:04 +0200

close method

Diffstat:
Mgui/qt/main_window.py | 3++-
Mgui/qt/util.py | 14++++++++++----
2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -855,7 +855,8 @@ class ElectrumWindow(QMainWindow): self.broadcast_transaction(tx) - WaitingDialog(self, 'Signing..', sign_thread, sign_done).start() + self.waiting_dialog = WaitingDialog(self, 'Signing..', sign_thread, sign_done) + self.waiting_dialog.start() diff --git a/gui/qt/util.py b/gui/qt/util.py @@ -9,21 +9,26 @@ import threading class WaitingDialog(QThread): def __init__(self, parent, message, run_task, on_complete=None): QThread.__init__(self) + self.parent = parent self.d = QDialog(parent) self.d.setWindowTitle('Please wait') l = QLabel(message) vbox = QVBoxLayout(self.d) vbox.addWidget(l) self.run_task = run_task - if on_complete: - self.d.connect(self.d, SIGNAL('done'), lambda: on_complete(*self.result)) + self.on_complete = on_complete + self.d.connect(self.d, SIGNAL('done'), self.close) self.d.show() def run(self): self.result = self.run_task() self.d.emit(SIGNAL('done')) + + def close(self): self.d.accept() - + if self.on_complete: + self.on_complete(*self.result) + class Timer(QThread): @@ -184,5 +189,6 @@ class MyTreeWidget(QTreeWidget): if __name__ == "__main__": app = QApplication([]) - WaitingDialog(None, 'testing ...', lambda: [time.sleep(1)], lambda x: QMessageBox.information(None, 'done', "done", _('OK'))).start() + t = WaitingDialog(None, 'testing ...', lambda: [time.sleep(1)], lambda x: QMessageBox.information(None, 'done', "done", _('OK'))) + t.start() app.exec_()