def coin_toss(self): from DVA import match_events_dispatch, frontend_references as gui from py.match.events import CoinTossResultsConfirmed match_events_dispatch.run(CoinTossResultsConfirmed, [ gui.get('MatchWindowRefereeCoinTossTabTeamAButtonA').state, gui.get('MatchWindowRefereeCoinTossTabTeamBButtonA').state, gui.get('MatchWindowRefereeCoinTossTabTeamAButtonServe').state, gui.get('MatchWindowRefereeCoinTossTabTeamBButtonServe').state ], 'NEW')
def set_range_to_sliders(): from DVA import match, frontend_references as gui RANGE = [ (len(match.team_A.players) - len(match.team_A.disqualified_players) - len(match.team_A.expulsed_players)), (len(match.team_B.players) - len(match.team_B.disqualified_players) - len(match.team_B.expulsed_players)), (len(match.team_A.staff) - len(match.team_A.disqualified_staff)), (len(match.team_B.staff) - len(match.team_B.disqualified_staff)), (len(match.team_A.players) - len(match.team_A.disqualified_players) - len(match.team_A.expulsed_players)) / 2, (len(match.team_B.players) - len(match.team_B.disqualified_players) - len(match.team_B.expulsed_players)) / 2, (len(match.team_A.players) - len(match.team_A.disqualified_players) + len(match.team_A.staff) + (1 if match.team_A.head_coach != '' else 0)), (len(match.team_B.players) - len(match.team_B.disqualified_players) + len(match.team_B.staff) + (1 if match.team_B.head_coach != '' else 0)), ] # according to the order in dictionary SCROLLBARS = [gui.get('MatchWindowRefereeTeamSetUpTeamAPLAYERSSLIDER'), gui.get('MatchWindowRefereeTeamSetUpTeamBPLAYERSSLIDER'), gui.get('MatchWindowRefereeTeamSetUpTeamASTAFFSLIDER'), gui.get('MatchWindowRefereeTeamSetUpTeamBSTAFFSLIDER'), gui.get('MatchWindowRefereeSubstitutionsTabTeamASLIDER'), gui.get('MatchWindowRefereeSubstitutionsTabTeamBSLIDER'), gui.get('MatchWindowRefereeSanctionsTabTeamASLIDER'), gui.get('MatchWindowRefereeSanctionsTabTeamBSLIDER')] for i in range(len(SCROLLBARS)): SCROLLBARS[i].range = (0, RANGE[i] - 1) SCROLLBARS[i].value_normalized = 1
def start_match_as_referee(self, match_data): from DVA import sm, match_events_dispatch, frontend_references as gui sm.current = gui.get('MatchWindowReferee').name self.status = 'Awaiting' self.load_match_data(match_data) for tab in gui.get('MatchWindowRefereeTabPanel').tab_list: tab.disabled = True gui.get('MatchWindowRefereeTabPanelCoinToss').disabled = False gui.get('MatchWindowRefereeCoinTossTabContent').on_load()
def write_protest(self, team): from DVA import match_events_dispatch, match, frontend_references as gui from py.match.events import ProtestWritten match_events_dispatch.run(ProtestWritten, [ team, gui.get('MatchWindowRefereeProtestsTabTeam' + ('A' if team == match.left_team else 'B') + 'TextInput').text ], 'NEW')
def rotate_backwards(self, *args): from DVA import match, frontend_references as gui if rotation_enabled: if self.elements[0] == gui.get( 'MatchWindowRefereeMatchTabTeamACourtPlayers'): team = match.left_team else: team = match.right_team players_on_court = team.players[:players_in_team] team.players = team.players[players_in_team:] if rotation_direction == 'Clockwise': players_on_court = players_on_court[-1:] + players_on_court[:-1] else: players_on_court = players_on_court[1:] + players_on_court[:1] team.players = players_on_court + team.players self.load()
def load(self): from DVA import match, frontend_references as gui liberos = [] if self.elements[0] == gui.get( 'MatchWindowRefereeMatchTabTeamACourtPlayers'): for i in range(2): for j in range( max(len(self.elements[0]), len(self.elements[1]))): if j < len(self.elements[i]): self.elements[i][j].underline = False self.elements[i][j].color = [1, 1, 1, 1] self.elements[i][j].opacity = 0 self.elements[i][j].text = '' for i in range(players_in_team): match.left_team.players[i].Number = PlayerNumber( self.elements[0][i]) match.left_team.players[i].Number.load( match.left_team.players[i].number, match.left_team.players[i].name_string, any((match.left_team.players[i].captain, match.left_team.players[i].temp_captain))) for i in range(len(match.left_team.players)): if match.left_team.players[ i].libero and match.left_team.players[i].present: liberos.append(match.left_team.players[i]) for i in range(len(liberos)): liberos[i].Number = PlayerNumber(self.elements[1][i]) liberos[i].Number.load( liberos[i].number, liberos[i].name_string, any((liberos[i].captain, liberos[i].temp_captain))) else: for i in range(2): for j in range( max(len(self.elements[0]), len(self.elements[1]))): if j < len(self.elements[i]): self.elements[i][j].underline = False self.elements[i][j].color = [1, 1, 1, 1] self.elements[i][j].opacity = 0 self.elements[i][j].text = '' for i in range(players_in_team): match.right_team.players[i].Number = PlayerNumber( self.elements[0][i]) match.right_team.players[i].Number.load( match.right_team.players[i].number, match.right_team.players[i].name_string, any((match.right_team.players[i].captain, match.right_team.players[i].temp_captain))) for i in range(len(match.right_team.players)): if match.right_team.players[ i].libero and match.right_team.players[i].present: liberos.append(match.right_team.players[i]) for i in range(len(liberos)): liberos[i].Number = PlayerNumber(self.elements[1][i]) liberos[i].Number.load( liberos[i].number, liberos[i].name_string, any((liberos[i].captain, liberos[i].temp_captain)))