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