def but1(): if list2.currentItem(): ln = list1.currentItem().text() rn = list2.currentItem().text() te = QMessageBox.question(window,'???','Are you sure you want to delete this roster?',QMessageBox.Yes|QMessageBox.No,QMessageBox.No) if te == QMessageBox.Yes: fbTool.removeRoster(str(ln),str(rn)) for i in fbTool.leagueLists: if i.leagueName == str(ln): list2.clear() for j in i.rosters: list2.addItem(j.rosterName) mainMenu.updateTree() else: QMessageBox.critical(window,'error','No roster selected')
def remRosterUI(): if printLeagues(): return 1 ln = raw_input('Please enter the name of the league the team is in: ').strip() if printTeams(ln): return 1 rn = raw_input('Please enter the name of the team to remove: ').strip() invar=' ' while invar.lower() not in ['y','yes','n','no']: invar=raw_input('Are you sure you want to do this? \nYou will lose all of teami\'s roster information! (y/n): ').strip() if invar.lower() in ['y','yes']: invar = raw_input('Would you like to save before doing so?(y/n): ') if invar.lower() in ['y','yes']: saveFileUI() if invar.lower() in ['n','no']: print 'IF YOU SAY SO.....' invar = 'y' if invar.lower() not in ['y','yes','n','no']: print 'Invalid input. Please try again...' else: testVar = fbTool.removeRoster(ln,rn) if testVar == 1: print 'LEAGUE DOESN\'T EXIST!' elif testVar == 2: print 'ROSTER DOESN\'T EXIST!' elif not testVar: print 'Team %s was deleted.' %rn if invar.lower() in ['n','no']: print 'I DIDN\'T THINK SO!' if invar.lower() not in ['y','yes','n','no']: print 'Invalid input. Please try again...'