def actionClicked(self): self._userID = self.txtUserID.toPlainText() self._username = self.txtUsername.toPlainText() self._password = self.txtPassword.toPlainText() self._role = self.cbRole.currentIndex() if self._username != '' and self._password != '': if self._ACTION == "ADD": msg = self.msgBox() if dbUser.getUserByUsername(self._username) is None: dbUser.newUser(self._username, self._password, self._role) msg.setText(f"New user '{self._username}' Added!") self.clearForm() else: msg.setText(f"USER ALREADY EXIST!") msg.setIcon(QMessageBox.Warning) else: dbUser.updateUser(self._userID, self._username, self._password, self._role) msg = self.msgBox() msg.setText( f"Update successful!\nUser with userID={self._userID} ") self.clearForm() msg.exec_() else: msg = self.msgBox() msg.setIcon(QMessageBox.Warning) msg.setText("Please fill up the form!") msg.exec_()