quick_frontend: display MUC games symbols
This commit is contained in:
parent
14f4b4b8ec
commit
d24eb9976d
3 changed files with 15 additions and 3 deletions
|
|
@ -48,7 +48,7 @@ class QuickChat(quick_widgets.QuickWidget):
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -76,4 +76,4 @@ class TarotCard(object):
|
|||
|
||||
|
||||
# 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"♦"]}
|
||||
|
|
|
|||
Loading…
Reference in a new issue