class ConfirmDialog(QtWidgets.QDialog): def __init__(self, parent=None): super().__init__(parent) self.ui = Ui_Confirm() self.ui.setupUi(self) self.setFixedSize(270, 89) print("ConfirmBox loaded") def exec_(self, title=None, message=None): if title: self.setWindowTitle(title) if message: self.ui.message.setText(message) return super().exec_() def setTitle(self, text): self.setWindowTitle(text) def setTextMsg(self, text): self.ui.message.setText(text) def boxType(self, type): if type is 'confirm': self.setFixedSize(270, 89) self.ui.buttonBox.setGeometry(QtCore.QRect(10, 60, 251, 23)) self.ui.message.setGeometry(QtCore.QRect(10, 0, 251, 61)) self.ui.message.setAlignment(Qt.AlignLeft|Qt.AlignVCenter) self.ui.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.No|QtWidgets.QDialogButtonBox.Yes) if type is 'confirmXL': self.setFixedSize(270, 149) self.ui.buttonBox.setGeometry(QtCore.QRect(10, 120, 251, 23)) self.ui.message.setGeometry(QtCore.QRect(10, 0, 251, 121)) self.ui.message.setAlignment(Qt.AlignLeft|Qt.AlignVCenter) self.ui.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.No|QtWidgets.QDialogButtonBox.Yes) elif type is 'error': self.setFixedSize(270, 199) self.ui.buttonBox.setGeometry(QtCore.QRect(10, 170, 251, 23)) self.ui.message.setGeometry(QtCore.QRect(10, 0, 251, 161)) self.ui.message.setAlignment(Qt.AlignLeft|Qt.AlignVCenter) self.ui.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok) elif type is 'about': self.setFixedSize(270, 189) self.ui.buttonBox.setGeometry(QtCore.QRect(10, 160, 251, 23)) self.ui.message.setGeometry(QtCore.QRect(10, 0, 251, 141)) self.ui.message.setAlignment(Qt.AlignHCenter|Qt.AlignVCenter) self.ui.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Ok)
def __init__(self, parent=None): super().__init__(parent) self.ui = Ui_Confirm() self.ui.setupUi(self) self.setFixedSize(270, 89) print("ConfirmBox loaded")