def accepting(self): """ Process the event when the user clicks "ok" in the dialog box. """ # Make sure the patient weight is a number if self.patient_weight_entry.text() != '': try: num = float(self.patient_weight_entry.text()) if num < 0: raise ValueError self.accept() except ValueError: button_reply = \ QMessageBox(QMessageBox.Icon.Warning, "Invalid Patient Weight", "Please enter a valid number.", QMessageBox.StandardButton.Ok, self) button_reply.button( QMessageBox.StandardButton.Ok).setStyleSheet( self.stylesheet) button_reply.exec_() # Make sure the patient weight is not blank else: button_reply = \ QMessageBox(QMessageBox.Icon.Warning, "Invalid Patient Weight", "Please enter a valid number.", QMessageBox.StandardButton.Ok, self) button_reply.button(QMessageBox.StandardButton.Ok).setStyleSheet( self.stylesheet) button_reply.exec_()
def rejecting(self): """ Process the event when the user clicks "cancel" in the dialog box. """ button_reply = \ QMessageBox(QMessageBox.Icon.Warning, "Cannot Proceed with SUV2ROI", "SUV2ROI cannot proceed without patient weight!", QMessageBox.StandardButton.Ok, self) button_reply.button(QMessageBox.StandardButton.Ok).setStyleSheet( self.stylesheet) reply = button_reply.exec_() if reply == QMessageBox.Ok: self.close()