Mercurial > libervia-web
diff src/browser/sat_browser/chat.py @ 660:267761bf7f08 frontends_multi_profiles
browser side (contact list): ContactPanels is used instead of OccupantsList in MUC:
- ContactPanels become the generic class for all lists of contacts
- OccupantsList will be removed
- need to implements specials icons (e.g. for games) in ContactBox
- ContactBox now manage a display arguments to set which data we want to display
- ContactsPanel.display renamed to setList
- ContactBox style can be changed when instaciating parent ContactsPanel
- muc_contact CSS class is used for list of MUC occupants
Not fully functionnal yet
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 27 Feb 2015 22:53:27 +0100 |
parents | 0262fee86375 |
children | ebb602d8b3f2 |
line wrap: on
line diff
--- a/src/browser/sat_browser/chat.py Fri Feb 27 16:05:28 2015 +0100 +++ b/src/browser/sat_browser/chat.py Fri Feb 27 22:53:27 2015 +0100 @@ -98,9 +98,9 @@ chat_area = HorizontalPanel() chat_area.setStyleName('chatArea') if type_ == C.CHAT_GROUP: - self.occupants_list = contact_panel.OccupantsList() - self.occupants_initialised = False - chat_area.add(self.occupants_list) + self.occupants_panel = contact_panel.ContactsPanel(self, contacts_style="muc_contact", contacts_display=('resource',)) + self.occupants_panel.setStyleName("occupantsPanel") + chat_area.add(self.occupants_panel) self._body.add(chat_area) self.content = AbsolutePanel() self.content.setStyleName('chatContent') @@ -205,25 +205,24 @@ def setPresents(self, nicks): """Set the users presents in this room @param occupants: list of nicks (string)""" - for nick in nicks: - self.occupants_list.addOccupant(nick) - self.occupants_initialised = True + self.occupants_panel.setList([jid.JID(u"%s/%s" % (self.target,nick)) for nick in nicks]) # def userJoined(self, nick, data): - # if self.occupants_list.getOccupantBox(nick): + # if self.occupants_panel.getOccupantBox(nick): # return # user is already displayed - # self.occupants_list.addOccupant(nick) + # self.occupants_panel.addOccupant(nick) # if self.occupants_initialised: # self.printInfo("=> %s has joined the room" % nick) # def userLeft(self, nick, data): - # self.occupants_list.removeOccupant(nick) + # self.occupants_panel.removeOccupant(nick) # self.printInfo("<= %s has left the room" % nick) def changeUserNick(self, old_nick, new_nick): - assert(self.type == C.CHAT_GROUP) - self.occupants_list.removeOccupant(old_nick) - self.occupants_list.addOccupant(new_nick) + assert self.type == C.CHAT_GROUP + # FIXME + # self.occupants_panel.removeOccupant(old_nick) + # self.occupants_panel.addOccupant(new_nick) self.printInfo(_("%(old_nick)s is now known as %(new_nick)s") % {'old_nick': old_nick, 'new_nick': new_nick}) # def historyPrint(self, size=C.HISTORY_LIMIT_DEFAULT): @@ -286,7 +285,7 @@ if game_type not in classes.keys(): return # unknown game attr = game_type.lower() - self.occupants_list.updateSpecials(players, SYMBOLS[attr]) + # self.occupants_panel.updateSpecials(players, SYMBOLS[attr]) # FIXME if waiting or not self.nick in players: return # waiting for player or not playing attr = "%s_panel" % attr @@ -313,14 +312,15 @@ @param state: the new chat state @param nick: ignored for one2one, otherwise the MUC user nick or C.ALL_OCCUPANTS """ + return # FIXME if self.type == C.CHAT_GROUP: assert(nick) if nick == C.ALL_OCCUPANTS: - occupants = self.occupants_list.occupants_list.keys() + occupants = self.occupants_panel.occupants_panel.keys() else: - occupants = [nick] if nick in self.occupants_list.occupants_list else [] + occupants = [nick] if nick in self.occupants_panel.occupants_panel else [] for occupant in occupants: - self.occupants_list.occupants_list[occupant].setState(state) + self.occupants_panel.occupants_panel[occupant].setState(state) else: self._state = state self.refreshTitle() @@ -337,10 +337,11 @@ """Set connection status @param jid_s (str): JID userhost as unicode """ + raise Exception("should not be there") # FIXME assert(jid_s == self.target.bare) if self.type != C.CHAT_GROUP: return - box = self.occupants_list.getOccupantBox(resource) + box = self.occupants_panel.getOccupantBox(resource) if box: contact_list.setPresenceStyle(box, availability)