tadd preprocessing to ThreadedButton - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit acf4ad5ec856e20256ed99f0377304ce22cdce99 DIR parent f50e56d229964eb4cd4b11f0eb7b5c4300fafe2e HTML Author: ThomasV <thomasv@gitorious> Date: Tue, 21 Apr 2015 11:00:40 +0200 add preprocessing to ThreadedButton Diffstat: M gui/qt/util.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- DIR diff --git a/gui/qt/util.py b/gui/qt/util.py t@@ -73,8 +73,9 @@ class EnterButton(QPushButton): class ThreadedButton(QPushButton): - def __init__(self, text, func, on_success=None): + def __init__(self, text, func, on_success=None, before=None): QPushButton.__init__(self, text) + self.before = before self.run_task = func self.on_success = on_success self.clicked.connect(self.do_exec) t@@ -95,12 +96,15 @@ class ThreadedButton(QPushButton): try: self.result = self.run_task() except BaseException as e: + traceback.print_exc(file=sys.stdout) self.error = str(e.message) self.emit(SIGNAL('error')) return self.emit(SIGNAL('done')) def do_exec(self): + if self.before: + self.before() t = threading.Thread(target=self.do_func) t.setDaemon(True) t.start()