[add] traceback for error in Thread
This commit is contained in:
parent
b3b3dca41a
commit
3c8ed2e44e
@ -67,9 +67,10 @@ class Thread(QThread):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._executed = False
|
self._executed = False
|
||||||
self._executedError = e
|
self._executedError = e
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
traceback.print_exc()
|
||||||
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
|
exctype, value = sys.exc_info ()[:2]
|
||||||
print('Exception: {}, file: {}, line: {}'.format(exc_type, fname, exc_tb.tb_lineno))
|
self._executedErrorInfo = '{} {} {}'.\
|
||||||
|
format(exctype, value, traceback.format_exc())
|
||||||
sys.stdout = sys.__stdout__
|
sys.stdout = sys.__stdout__
|
||||||
|
|
||||||
def showProgressbar(self):
|
def showProgressbar(self):
|
||||||
@ -107,7 +108,7 @@ class Thread(QThread):
|
|||||||
|
|
||||||
class Worker(QRunnable):
|
class Worker(QRunnable):
|
||||||
'''
|
'''
|
||||||
|
Worker class to be run by MultiThread(QThread).
|
||||||
'''
|
'''
|
||||||
def __init__(self, fun, args,
|
def __init__(self, fun, args,
|
||||||
progressText=None,
|
progressText=None,
|
||||||
@ -130,7 +131,7 @@ class Worker(QRunnable):
|
|||||||
try:
|
try:
|
||||||
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 ()))
|
||||||
@ -148,6 +149,7 @@ class Worker(QRunnable):
|
|||||||
|
|
||||||
class WorkerSignals(QObject):
|
class WorkerSignals(QObject):
|
||||||
'''
|
'''
|
||||||
|
Class to provide signals for Worker Class
|
||||||
'''
|
'''
|
||||||
finished = Signal(str)
|
finished = Signal(str)
|
||||||
message = Signal(str)
|
message = Signal(str)
|
||||||
|
@ -2342,8 +2342,10 @@ class TuneAutopicker(QWidget):
|
|||||||
def finish_picker(self):
|
def finish_picker(self):
|
||||||
self.enable(True)
|
self.enable(True)
|
||||||
if not self.ap_thread._executed:
|
if not self.ap_thread._executed:
|
||||||
self._warn('Could not execute picker:\n{}'.format(
|
msg = 'Could not execute picker:\n{}'.format(
|
||||||
self.ap_thread._executedError))
|
self.ap_thread._executedError)
|
||||||
|
info = self.ap_thread._executedErrorInfo
|
||||||
|
self._warn(msg, info)
|
||||||
return
|
return
|
||||||
self.pylot_picks = self.ap_thread.data
|
self.pylot_picks = self.ap_thread.data
|
||||||
if not self.pylot_picks:
|
if not self.pylot_picks:
|
||||||
@ -2396,9 +2398,10 @@ class TuneAutopicker(QWidget):
|
|||||||
self.figure_tabs.setTabEnabled(2, bool)
|
self.figure_tabs.setTabEnabled(2, bool)
|
||||||
self.figure_tabs.setTabEnabled(3, bool)
|
self.figure_tabs.setTabEnabled(3, bool)
|
||||||
|
|
||||||
def _warn(self, message):
|
def _warn(self, message, info=None):
|
||||||
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Warning,
|
self.qmb = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Warning,
|
||||||
'Warning', message)
|
'Warning', message)
|
||||||
|
self.qmb.setDetailedText(str(info))
|
||||||
self.qmb.show()
|
self.qmb.show()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user