def searchCard(self): """ searches for a card in the DB by key input: none output: none """ result = self.db.searchCard(self.SCkeyField.text()) if result == -1 or result == None: # query failed or the card does not exist display = messageBox("could not find this card in the database") display.exec() # display a pop up with your application info else: display = messageBox(result) display.exec() self.clearSearchCardForm()
def deleteCard(self): """Sends a key to the DB for that card to be deleted input: none output: none """ returnStatus = self.db.removeCard(self.DCkeyField.text()) if returnStatus == 'success': display = messageBox("card deleted from the database") display.exec() # display a pop up self.updateCardCount() # get the new number of cards in the DB else: display = messageBox("the card could not be deleted") display.exec() # display a pop up with your application info self.clearDeleteCardForm()
def aboutInfo(self): """Gives pop up message with info regarding the dashboard and oobat input: none output: none """ display = messageBox( "This dashboard is a companion to the web game 'Oobat'\nChristian Fin\nLASP\nSummer 2020\noobat.herokuapp.com" ) display.exec()
def addCard(self): """Sends card data to the DB to be added to the cards table input: none output: none modifies class data members """ returnStatus = self.db.addCard(self.ACkeyField.text(), self.hint1Field.text(), self.hint2Field.text(), self.hint3Field.text(), self.hint4Field.text(), self.hint5Field.text()) if returnStatus == 'failure': display = messageBox("could not add the card to the database") display.exec() # display a pop up with your application info else: display = messageBox("Card added") display.exec() self.clearAddCardForm() self.updateCardCount() # get new number of cards in DB
def resetScores(self): """ instructs database to reset the scores table to its default input: none output: none """ self.db.clearHighScores() # reset the scores to default self.getScores( ) # update the dashboard to reflect the changes in the DB display = messageBox("High scores reset to default") # alert the user display.exec()
def submitInfo(self): """ Pulls inputs from the form fields in to the class data members, Input: None Output: None """ self.firstName = self.firstNameField.text() self.lastName = self.lastNameField.text() self.email = self.emailField.text() self.bio = self.bioField.toPlainText() self.major = self.majorCB.currentText() display = messageBox(self.firstName, self.lastName, self.email, self.bio, self.major) display.exec() # display a pop up with your application info self.clearForm() # empty the form