From ed7a323c5065ba7b92ea5dc0e0fbf402f9102f94 Mon Sep 17 00:00:00 2001 From: Sebastian Wehling-Benatelli Date: Tue, 1 Dec 2015 05:03:55 +0100 Subject: [PATCH] [new] reverting stdout redirection after auto picking is done; added method finalizeAutoPick for purposes to be done after the auto picking thread has finished --- QtPyLoT.py | 5 +++++ pylot/core/util/thread.py | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/QtPyLoT.py b/QtPyLoT.py index 441446d5..10984721 100755 --- a/QtPyLoT.py +++ b/QtPyLoT.py @@ -680,6 +680,11 @@ class MainWindow(QMainWindow): param=autopick_parameter) self.thread.message.connect(self.addListItem) self.thread.start() + self.thread.finished.connect(self.finalizeAutoPick) + + def finalizeAutoPick(self): + self.drawPicks(picktype='auto') + self.thread.quit() def addPicks(self, station, picks, type='manual'): stat_picks = self.getPicksOnStation(station, type) diff --git a/pylot/core/util/thread.py b/pylot/core/util/thread.py index a131e8fe..a4a47715 100644 --- a/pylot/core/util/thread.py +++ b/pylot/core/util/thread.py @@ -4,6 +4,7 @@ from PySide.QtCore import QThread, Signal class AutoPickThread(QThread): message = Signal(str) + finished = Signal() def __init__(self, parent, func, data, param): super(AutoPickThread, self).__init__() @@ -24,8 +25,8 @@ class AutoPickThread(QThread): self.parent().addPicks(station, picks[station], type='auto') except AttributeError: print(picks) - # plot picks to section - self.parent().drawPicks(picktype='auto') + sys.stdout = sys.__stdout__ + self.finished.emit() def write(self, text):