# coding: utf8 from PySide6 import QtWidgets def accept_warning(widget: QtWidgets.QWidget, condition: bool, caption: str = "Warning", text: str = "Are you sure to continue?") -> bool: if condition: b = QtWidgets.QMessageBox.question(widget, caption, text) if b == QtWidgets.QMessageBox.StandardButton.No: return True return False