comparison src/browser/sat_browser/base_panels.py @ 573:12823bcbd05b

browser_side: display MUC occupants presences
author souliane <souliane@mailoo.org>
date Fri, 17 Oct 2014 13:26:33 +0200
parents c97fe4059f71
children e1a773a64fb6
comparison
equal deleted inserted replaced
572:7a823c6568e2 573:12823bcbd05b
69 """ 69 """
70 @param nick: the user nickname 70 @param nick: the user nickname
71 @param state: the user chate state (XEP-0085) 71 @param state: the user chate state (XEP-0085)
72 @param special: a string of symbols (e.g: for activities) 72 @param special: a string of symbols (e.g: for activities)
73 """ 73 """
74 HTML.__init__(self) 74 HTML.__init__(self, StyleName="occupant")
75 self.nick = nick 75 self.nick = nick
76 self._state = state 76 self._state = state
77 self.special = special 77 self.special = special
78 self._refresh() 78 self._refresh()
79 79
99 self._refresh() 99 self._refresh()
100 100
101 def _refresh(self): 101 def _refresh(self):
102 state = (' %s' % C.MUC_USER_STATES[self._state]) if self._state else '' 102 state = (' %s' % C.MUC_USER_STATES[self._state]) if self._state else ''
103 special = "" if len(self.special) == 0 else " %s" % self.special 103 special = "" if len(self.special) == 0 else " %s" % self.special
104 self.setHTML("<div class='occupant'>%s%s%s</div>" % (html_tools.html_sanitize(self.nick), special, state)) 104 self.setHTML("%s%s%s" % (html_tools.html_sanitize(self.nick), special, state))
105 105
106 106
107 class OccupantsList(AbsolutePanel): 107 class OccupantsList(AbsolutePanel):
108 """Panel user to show occupants of a room""" 108 """Panel user to show occupants of a room"""
109 109
120 def removeOccupant(self, nick): 120 def removeOccupant(self, nick):
121 try: 121 try:
122 self.remove(self.occupants_list[nick]) 122 self.remove(self.occupants_list[nick])
123 except KeyError: 123 except KeyError:
124 log.error("trying to remove an unexisting nick") 124 log.error("trying to remove an unexisting nick")
125
126 def getOccupantBox(self, nick):
127 """Get the widget element of the given nick.
128
129 @return: Occupant
130 """
131 return self.occupants_list[nick]
125 132
126 def clear(self): 133 def clear(self):
127 self.occupants_list.clear() 134 self.occupants_list.clear()
128 AbsolutePanel.clear(self) 135 AbsolutePanel.clear(self)
129 136