def benchPlayers():
    if not fbTool.leagueLists:
        print 'Error: no leagues registered.'
        return -1
    loop1='y'
    loop2='y'
    while loop1.lower() in ['yes','y']:
        ln = getLeagueName(0)
        league=fbTool.leagueLists[0]
        roster=fbTool.leagueLists[0].rosters[0]
        for i in fbTool.leagueLists:
            if i.leagueName==ln:
                league = i
                break
            if i.leagueName!=ln and i==fbTool.leagueLists[-1]:
                print 'league %s does not exist' %ln
                return -1
        if not i.rosters:
            print 'error: no rosters registered in %s' %ln
            return -2
        printTeams(ln)
        rn = getTeamName(0)
        roster=league.rosters[0]
        for i in league.rosters:
            if i.rosterName==rn:
                roster=i.players
                break
            if i.rosterName!=rn and i==league.rosters[-1]:
                print 'roster %s does not exist in league %s' %(rn,ln)
                return -2
        
        while loop2.lower() in ['yes','y']:
            printPlayers(ln,rn)
            player = raw_input('Enter name of player to bench/unbench: ').strip()
            for i in roster:
                if player == (i.firstName + ' ' + i.lastName):
                    fbTool.setPlayerActiveFlag(i)
                    break
                elif i == roster[-1]:
                    print 'Player not found...'
            loop2 = raw_input('Would you like to bench/unbench another member of the same roster? (y/n) ').strip()
            while loop2.lower() not in ['y','yes','n','no']:
                print 'Invalid input, please try again...'
                loop2 = raw_input('Would you like to bench/unbench another member of the same roster? (y/n) ').strip()
        loop1 = raw_input('Would you like to bench/unbench members of another team? (y/n) ').strip()
        while loop1.lower() not in ['y','yes','n','no']:
            print 'Invalid input, please try again...'
            loop2 = raw_input('Would you like to bench/unbench members of another team? (y/n) ').strip()
 def but3():
     if not list3.currentItem():
         QMessageBox.critical(window,'error','No player selected')
     else:
         ln=str(list1.currentItem().text())
         rn=str(list2.currentItem().text())
         pn=str(list3.currentItem().text())
         if pn[-1]==')':
             pn=pn[:-3]
         for i in fbTool.leagueLists:
             if i.leagueName == ln:
                 for j in i.rosters:
                     if j.rosterName == rn:
                         for k in j.players:
                             if pn==(k.firstName + ' ' + k.lastName):
                                 fbTool.setPlayerActiveFlag(k)
     poplist3(list2.currentItem())
     mainMenu.updateTree()