Added ErrorPopup window
This commit is contained in:
		
							parent
							
								
									5897f874b5
								
							
						
					
					
						commit
						7bb86e2607
					
				
							
								
								
									
										32
									
								
								utils/gui/pyqt/error_popup/ErrorPopup.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								utils/gui/pyqt/error_popup/ErrorPopup.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,32 @@ | |||||||
|  | from PyQt5 import QtCore, QtGui, QtWidgets | ||||||
|  | from PyQt5.QtWidgets import QMessageBox | ||||||
|  | 
 | ||||||
|  | class ErrorPopup(object): | ||||||
|  | 
 | ||||||
|  |     def __init__(self,error_text,details = None,button_label = None,button_callback=None): | ||||||
|  |         self.error_text = error_text | ||||||
|  |         self.button_label = button_label | ||||||
|  |         self.button_callback = button_callback | ||||||
|  |         self.details = details | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     def show_popup(self): | ||||||
|  |         msg = QMessageBox() | ||||||
|  |         msg.setWindowTitle("Erreur") | ||||||
|  |         msg.setText("Erreur: " + self.error_text) | ||||||
|  |         msg.setIcon(QMessageBox.Critical) | ||||||
|  | 
 | ||||||
|  |         if self.button_label is not None and self.button_callback is not None: | ||||||
|  |             msg.setStandardButtons(QMessageBox.Cancel|QMessageBox.Retry) | ||||||
|  |             msg.setDefaultButton(QMessageBox.Cancel) | ||||||
|  |             msg.button(QMessageBox.Cancel).clicked.connect(msg.close) | ||||||
|  |             msg.button(QMessageBox.Retry).setText(self.button_label) | ||||||
|  |             msg.button(QMessageBox.Retry).clicked.connect(self.button_callback) | ||||||
|  |         else: | ||||||
|  |             msg.setStandardButtons(QMessageBox.Ok) | ||||||
|  |             msg.setDefaultButton(QMessageBox.Ok) | ||||||
|  |             msg.button(QMessageBox.Ok).clicked.connect(msg.close) | ||||||
|  |         msg.setInformativeText(self.error_text) | ||||||
|  |         if self.details is not None: | ||||||
|  |             msg.setDetailedText(self.details) | ||||||
|  |         msg.exec_() | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user