def changeTeamName(self): if(not self.objectView): self.viewTeam() else: # Find out which indices are good if(not self.creationBoo): if(self.currentWidgets[9].get() == ""): self.creationBoo = False self.viewTeam() else: dat.removeTeam(self.currentObject.name) self.currentObject.name = self.currentWidgets[9].get() dat.saveTeam(self.currentObject) self.creationBoo = True self.viewTeam() # Exact same with adjusted indices else: if(self.currentWidgets[8].get() == ""): self.creationBoo = False self.viewTeam() else: dat.removeTeam(self.currentObject.name) self.currentObject.name = self.currentWidgets[8].get() dat.saveTeam(self.currentObject) self.creationBoo = True self.viewTeam()
def makeTeam(self): fieldsFilled = False # Check to see if all the fields were filled out. # Correct indices for incorrect label if(not self.creationBoo): if(not self.currentWidgets[6].get() == ""): if(not self.currentWidgets[8].get() == ""): if(not self.currentWidgets[10].get() == ""): if(not self.currentWidgets[12].get() == ""): if(not self.currentWidgets [14].get() == ""): if(not self.currentWidgets[16].get() == ""): if(not self.currentWidgets[18].get() == ""): fieldsFilled = True if(fieldsFilled): # Create the team, save it, and send the user to viewTeam page. And set creationBoo to True self.creationBoo = True team = Team(self.currentWidgets[6].get(), self.currentWidgets[8].get(), self.currentWidgets[10].get(), self.currentWidgets[12].get(), self.currentWidgets[14].get(), self.currentWidgets[16].get(), self.currentWidgets[18].get()) dat.saveTeam(team) self.currentObject = team self.creationBoo = True self.objectView = True self.viewTeam() else: # Deny the user, and send them back to createTeam with error message self.creationBoo = False self.createTeam() else: if(not self.currentWidgets[5].get() == ""): if(not self.currentWidgets[7].get() == ""): if(not self.currentWidgets[9].get() == ""): if(not self.currentWidgets[11].get() == ""): if(not self.currentWidgets [13].get() == ""): if(not self.currentWidgets[15].get() == ""): if(not self.currentWidgets[17].get() == ""): fieldsFilled = True if(fieldsFilled): # Create the team, save it, and send the user to viewTeam page. And set creationBoo to True self.creationBoo = True team = Team(self.currentWidgets[5].get(), self.currentWidgets[7].get(), self.currentWidgets[9].get(), self.currentWidgets[11].get(), self.currentWidgets[13].get(), self.currentWidgets[15].get(), self.currentWidgets[17].get()) dat.saveTeam(team) self.currentObject = team self.creationBoo = True self.objectView = True self.viewTeam() else: # Deny the user, and send them back to createTeam with error message self.creationBoo = False self.createTeam()
def changeWins(self): if(not self.objectView): self.viewTeam() else: if(not self.creationBoo): if(self.currentWidgets[12].get() == ""): self.creationBoo = False self.viewTeam() try: self.currentObject.wins = int(self.currentWidgets[12].get()) dat.removeTeam(self.currentObject.name) dat.saveTeam(self.currentObject) self.creationBoo = True self.viewTeam() except: self.creationBoo = False self.viewTeam() else: if(self.currentWidgets[11].get() == ""): self.creationBoo = False self.viewTeam() try: self.currentObject.wins = int(self.currentWidgets[11].get()) dat.removeTeam(self.currentObject.name) dat.saveTeam(self.currentObject) self.creationBoo = True self.viewTeam() except: self.creationBoo = False self.viewTeam()
def changeRosterCount(self): if(not self.objectView): self.viewTeam() else: if(not self.creationBoo): if(self.currentWidgets[21].get() == ""): self.creationBoo = False self.viewTeam() try: self.currentObject.rosterCount = int(self.currentWidgets[21].get()) dat.removeTeam(self.currentObject.name) dat.saveTeam(self.currentObject) self.creationBoo = True self.viewTeam() except: self.creationBoo = False self.viewTeam() else: if(self.currentWidgets[20].get() == ""): self.creationBoo = False self.viewTeam() try: self.currentObject.rosterCount = int(self.currentWidgets[20].get()) dat.removeTeam(self.currentObject.name) dat.saveTeam(self.currentObject) self.creationBoo = True self.viewTeam() except: self.creationBoo = False self.viewTeam()