[new] reverting stdout redirection after auto picking is done; added method finalizeAutoPick for purposes to be done after the auto picking thread has finished

This commit is contained in:
Sebastian Wehling-Benatelli 2015-12-01 05:03:55 +01:00
parent 41a495371d
commit ed7a323c50
2 changed files with 8 additions and 2 deletions

View File

@ -680,6 +680,11 @@ class MainWindow(QMainWindow):
param=autopick_parameter) param=autopick_parameter)
self.thread.message.connect(self.addListItem) self.thread.message.connect(self.addListItem)
self.thread.start() 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'): def addPicks(self, station, picks, type='manual'):
stat_picks = self.getPicksOnStation(station, type) stat_picks = self.getPicksOnStation(station, type)

View File

@ -4,6 +4,7 @@ from PySide.QtCore import QThread, Signal
class AutoPickThread(QThread): class AutoPickThread(QThread):
message = Signal(str) message = Signal(str)
finished = Signal()
def __init__(self, parent, func, data, param): def __init__(self, parent, func, data, param):
super(AutoPickThread, self).__init__() super(AutoPickThread, self).__init__()
@ -24,8 +25,8 @@ class AutoPickThread(QThread):
self.parent().addPicks(station, picks[station], type='auto') self.parent().addPicks(station, picks[station], type='auto')
except AttributeError: except AttributeError:
print(picks) print(picks)
# plot picks to section sys.stdout = sys.__stdout__
self.parent().drawPicks(picktype='auto') self.finished.emit()
def write(self, text): def write(self, text):