quick_frontend: display MUC games symbols
This commit is contained in:
parent
14f4b4b8ec
commit
d24eb9976d
1 changed files with 15 additions and 3 deletions
|
|
@ -23,6 +23,7 @@ log = getLogger(__name__)
|
|||
from sat.core.i18n import _
|
||||
|
||||
from sat_frontends.tools import jid
|
||||
from sat_frontends.tools import games
|
||||
from sat_frontends.quick_frontend.constants import Const as C
|
||||
|
||||
import quick_chat
|
||||
|
|
@ -53,7 +54,18 @@ class RoomGame(object):
|
|||
referee, players, args = args[0], args[1], args[2:]
|
||||
chat_widget = host.widgets.getOrCreateWidget(quick_chat.QuickChat, room_jid, type_=C.CHAT_GROUP, profile=profile)
|
||||
|
||||
# self.occupants_panel.updateSpecials(players, SYMBOLS[self._game_name.lower()]) # FIXME
|
||||
# update symbols
|
||||
if cls._game_name not in chat_widget.visible_states:
|
||||
chat_widget.visible_states.append(cls._game_name)
|
||||
symbols = games.SYMBOLS[cls._game_name]
|
||||
index = 0
|
||||
for occupant in chat_widget.occupants:
|
||||
occupant_jid = jid.newResource(room_jid, occupant)
|
||||
if occupant in players:
|
||||
chat_widget.updateEntityState(occupant_jid, cls._game_name, symbols[index % len(symbols)])
|
||||
else:
|
||||
chat_widget.updateEntityState(occupant_jid, cls._game_name, None)
|
||||
|
||||
if suffix == "Players" or chat_widget.nick not in players:
|
||||
return # waiting for other players to join, or not playing
|
||||
if cls._game_name in chat_widget.games:
|
||||
|
|
|
|||
Loading…
Reference in a new issue