feature/port-to-py3 #11
							
								
								
									
										14
									
								
								PyLoT.py
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								PyLoT.py
									
									
									
									
									
								
							| @ -254,7 +254,7 @@ class MainWindow(QMainWindow): | ||||
|             self._inputs.export2File(infile) | ||||
|         self.infile = infile | ||||
| 
 | ||||
|     def setupUi(self): | ||||
|     def setupUi(self, use_logwidget=True): | ||||
|         try: | ||||
|             self.startTime = min( | ||||
|                 [tr.stats.starttime for tr in self.data.wfdata]) | ||||
| @ -731,10 +731,14 @@ class MainWindow(QMainWindow): | ||||
|         _widget.setLayout(self._main_layout) | ||||
|         _widget.showFullScreen() | ||||
| 
 | ||||
|         self.logwidget = LogWidget(parent=None) | ||||
|         self.logwidget.show() | ||||
|         sys.stdout = self.logwidget.stdout | ||||
|         sys.stderr = self.logwidget.stderr | ||||
|         if use_logwidget: | ||||
|             self.logwidget = LogWidget(parent=None) | ||||
|             self.logwidget.show() | ||||
|             self.stdout = self.logwidget.stdout | ||||
|             self.stderr = self.logwidget.stderr | ||||
| 
 | ||||
|             sys.stdout = self.stdout | ||||
|             sys.stderr = self.stderr | ||||
| 
 | ||||
|         self.setCentralWidget(_widget) | ||||
| 
 | ||||
|  | ||||
| @ -22,9 +22,11 @@ class Thread(QThread): | ||||
|         self.abortButton = abortButton | ||||
|         self.finished.connect(self.hideProgressbar) | ||||
|         self.showProgressbar() | ||||
|         self.old_stdout = None | ||||
| 
 | ||||
|     def run(self): | ||||
|         if self.redirect_stdout: | ||||
|             self.old_stdout = sys.stdout | ||||
|             sys.stdout = self | ||||
|         try: | ||||
|             if self.arg is not None: | ||||
| @ -39,7 +41,7 @@ class Thread(QThread): | ||||
|             exctype, value = sys.exc_info()[:2] | ||||
|             self._executedErrorInfo = '{} {} {}'. \ | ||||
|                 format(exctype, value, traceback.format_exc()) | ||||
|         sys.stdout = sys.__stdout__ | ||||
|         sys.stdout = self.old_stdout | ||||
| 
 | ||||
|     def showProgressbar(self): | ||||
|         if self.progressText: | ||||
| @ -96,10 +98,12 @@ class Worker(QRunnable): | ||||
|         self.progressText = progressText | ||||
|         self.pb_widget = pb_widget | ||||
|         self.redirect_stdout = redirect_stdout | ||||
|         self.old_stdout = None | ||||
| 
 | ||||
|     @Slot() | ||||
|     def run(self): | ||||
|         if self.redirect_stdout: | ||||
|             self.old_stdout = sys.stdout | ||||
|             sys.stdout = self | ||||
| 
 | ||||
|         try: | ||||
| @ -112,7 +116,7 @@ class Worker(QRunnable): | ||||
|             self.signals.result.emit(result) | ||||
|         finally: | ||||
|             self.signals.finished.emit('Done') | ||||
|         sys.stdout = sys.__stdout__ | ||||
|         sys.stdout = self.old_stdout | ||||
| 
 | ||||
|     def write(self, text): | ||||
|         self.signals.message.emit(text) | ||||
| @ -144,11 +148,13 @@ class MultiThread(QThread): | ||||
|         self.progressText = progressText | ||||
|         self.pb_widget = pb_widget | ||||
|         self.redirect_stdout = redirect_stdout | ||||
|         self.old_stdout = None | ||||
|         self.finished.connect(self.hideProgressbar) | ||||
|         self.showProgressbar() | ||||
| 
 | ||||
|     def run(self): | ||||
|         if self.redirect_stdout: | ||||
|             self.old_stdout = sys.stdout | ||||
|             sys.stdout = self | ||||
|         try: | ||||
|             if not self.ncores: | ||||
| @ -164,7 +170,7 @@ class MultiThread(QThread): | ||||
|             exc_type, exc_obj, exc_tb = sys.exc_info() | ||||
|             fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] | ||||
|             print('Exception: {}, file: {}, line: {}'.format(exc_type, fname, exc_tb.tb_lineno)) | ||||
|         sys.stdout = sys.__stdout__ | ||||
|         sys.stdout = self.old_stdout | ||||
| 
 | ||||
|     def showProgressbar(self): | ||||
|         if self.progressText: | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user