# HG changeset patch # User souliane # Date 1426865343 -3600 # Node ID da2ea16fabc65e183ac8544afeba49d06d98401d # Parent 3dae6964c0715e77df2b958878715afd009e88ba quick_frontend: display MUC games symbols diff -r 3dae6964c071 -r da2ea16fabc6 frontends/src/quick_frontend/quick_chat.py --- a/frontends/src/quick_frontend/quick_chat.py Fri Mar 20 16:28:19 2015 +0100 +++ b/frontends/src/quick_frontend/quick_chat.py Fri Mar 20 16:29:03 2015 +0100 @@ -48,7 +48,7 @@ self.type = type_ self.id = "" # FIXME: to be removed self.nick = None - self.games = {} + self.games = {} # key=game name (unicode), value=instance of quick_games.RoomGame def __str__(self): return u"Chat Widget [target: {}, type: {}, profile: {}]".format(self.target, self.type, self.profile) diff -r 3dae6964c071 -r da2ea16fabc6 frontends/src/quick_frontend/quick_games.py --- a/frontends/src/quick_frontend/quick_games.py Fri Mar 20 16:28:19 2015 +0100 +++ b/frontends/src/quick_frontend/quick_games.py Fri Mar 20 16:29:03 2015 +0100 @@ -23,6 +23,7 @@ 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 @@ 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: diff -r 3dae6964c071 -r da2ea16fabc6 frontends/src/tools/games.py --- a/frontends/src/tools/games.py Fri Mar 20 16:28:19 2015 +0100 +++ b/frontends/src/tools/games.py Fri Mar 20 16:29:03 2015 +0100 @@ -76,4 +76,4 @@ # These symbols are diplayed by Libervia next to the player's nicknames -SYMBOLS = {"radiocol": u"♬", "tarot": [u"♠", u"♣", u"♥", u"♦"]} +SYMBOLS = {"Radiocol": [u"♬"], "Tarot": [u"♠", u"♣", u"♥", u"♦"]}