[change] removed __del__ method reimplementation from thread objects

causing problems (no idea why it is there at all)
This commit is contained in:
Marcel Paffrath 2017-08-03 11:09:50 +02:00
parent 85a01fb0f1
commit e8a0a87dad

View File

@ -1,9 +1,6 @@
# -*- coding: utf-8 -*-
import sys, os, traceback
import multiprocessing
import os
import sys
import traceback
from PySide.QtCore import QThread, Signal, Qt, Slot, QRunnable, QObject
from PySide.QtGui import QDialog, QProgressBar, QLabel, QHBoxLayout, QPushButton
@ -73,9 +70,6 @@ class Thread(QThread):
print('Exception: {}, file: {}, line: {}'.format(exc_type, fname, exc_tb.tb_lineno))
sys.stdout = sys.__stdout__
def __del__(self):
self.wait()
def showProgressbar(self):
if self.progressText:
@ -112,7 +106,6 @@ class Worker(QRunnable):
'''
'''
def __init__(self, fun, args,
progressText=None,
pb_widget=None,
@ -120,7 +113,7 @@ class Worker(QRunnable):
super(Worker, self).__init__()
self.fun = fun
self.args = args
# self.kwargs = kwargs
#self.kwargs = kwargs
self.signals = WorkerSignals()
self.progressText = progressText
self.pb_widget = pb_widget
@ -135,9 +128,9 @@ class Worker(QRunnable):
result = self.fun(self.args)
except:
traceback.print_exc()
exctype, value = sys.exc_info()[:2]
exctype, value = sys.exc_info ()[:2]
print(exctype, value, traceback.format_exc())
# self.signals.error.emit ((exctype, value, traceback.format_exc ()))
#self.signals.error.emit ((exctype, value, traceback.format_exc ()))
else:
self.signals.result.emit(result)
finally:
@ -177,13 +170,13 @@ class MultiThread(QThread):
def run(self):
if self.redirect_stdout:
sys.stdout = self
sys.stdout = self
try:
if not self.ncores:
self.ncores = multiprocessing.cpu_count()
pool = multiprocessing.Pool(self.ncores)
self.data = pool.map_async(self.func, self.args, callback=self.emitDone)
# self.data = pool.apply_async(self.func, self.shotlist, callback=self.emitDone) #emit each time returned
#self.data = pool.apply_async(self.func, self.shotlist, callback=self.emitDone) #emit each time returned
pool.close()
self._executed = True
except Exception as e:
@ -194,9 +187,6 @@ class MultiThread(QThread):
print('Exception: {}, file: {}, line: {}'.format(exc_type, fname, exc_tb.tb_lineno))
sys.stdout = sys.__stdout__
def __del__(self):
self.wait()
def showProgressbar(self):
if self.progressText:
if not self.pb_widget: