comparison frontends/src/quick_frontend/quick_games.py @ 1388:a025242bebe7

quick_frontend, primitivus: remove QuickChat.updateEntityState and QuickChat.setContactStates, use more general QuickChat.update (also called when joining the room to initialise the occupants list)
author souliane <souliane@mailoo.org>
date Tue, 24 Mar 2015 17:31:08 +0100
parents da2ea16fabc6
children 069ad98b360d
comparison
equal deleted inserted replaced
1387:3511ff4b40a0 1388:a025242bebe7
57 # update symbols 57 # update symbols
58 if cls._game_name not in chat_widget.visible_states: 58 if cls._game_name not in chat_widget.visible_states:
59 chat_widget.visible_states.append(cls._game_name) 59 chat_widget.visible_states.append(cls._game_name)
60 symbols = games.SYMBOLS[cls._game_name] 60 symbols = games.SYMBOLS[cls._game_name]
61 index = 0 61 index = 0
62 contact_list = host.contact_lists[profile]
62 for occupant in chat_widget.occupants: 63 for occupant in chat_widget.occupants:
63 occupant_jid = jid.newResource(room_jid, occupant) 64 occupant_jid = jid.newResource(room_jid, occupant)
64 if occupant in players: 65 contact_list.setCache(occupant_jid, cls._game_name, symbols[index % len(symbols)] if occupant in players else None)
65 chat_widget.updateEntityState(occupant_jid, cls._game_name, symbols[index % len(symbols)]) 66 chat_widget.update(occupant_jid)
66 else:
67 chat_widget.updateEntityState(occupant_jid, cls._game_name, None)
68 67
69 if suffix == "Players" or chat_widget.nick not in players: 68 if suffix == "Players" or chat_widget.nick not in players:
70 return # waiting for other players to join, or not playing 69 return # waiting for other players to join, or not playing
71 if cls._game_name in chat_widget.games: 70 if cls._game_name in chat_widget.games:
72 return # game panel is already there 71 return # game panel is already there