def _thread_fun(self, queue, device, show_q): self.queue = queue self.show_q = show_q if self.use_buffer: self.input_buffer = {} try: self.setup_connections() self.start(device) if DEBUG: print(f"{self.name} starting...") try: while True: try: FPS.update(self.name) if self.use_buffer: self.consume_queue_data() self.run() except StopNodeException: break finally: self.end(device) except Exception as e: traceback.print_exc() instance = self.getWrapper().canvasRef().pyFlowInstance threading.Thread(target=stop_pipeline, args=(instance, )).start() msg = QMessageBox() msg.setIcon(QMessageBox.Critical) msg.setText("Error occured during node execution!") msg.setInformativeText(str(e)) msg.setDetailedText(traceback.format_exc()) msg.setWindowTitle("Node execution error!") msg.setStandardButtons(QMessageBox.Ok) msg.exec()
def show_warning_dialog(self, msg, detail=None): """ Shows a warning dialog :param msg: str, message to show with the dialog :param detail: str, detail information to show (optional) """ dialog = QMessageBox() dialog.setIcon(QMessageBox.Warning) dialog.setWindowTitle('Warning') dialog.setText(msg) if detail: dialog.setDetailedText(detail) dialog.exec_()
def _fun(self, device): try: self.setup_connections() self.run(device) except Exception as e: traceback.print_exc() self._terminate() msg = QMessageBox() msg.setIcon(QMessageBox.Critical) msg.setText("Error occured during node execution!") msg.setInformativeText(str(e)) msg.setDetailedText(traceback.format_exc()) msg.setWindowTitle("Node execution error!") msg.setStandardButtons(QMessageBox.Ok) msg.exec()
def msgbox(message, detail=None): msgbox = QMessageBox() msgbox.setText(message) if detail: msgbox.setDetailedText(detail) return msgbox.exec_()