Mercurial > libervia-web
comparison src/browser/sat_browser/contact_panel.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 | 6d3142b782c3 |
children | 2201ff543a05 |
comparison
equal
deleted
inserted
replaced
659:8e7d4de56e75 | 660:267761bf7f08 |
---|---|
80 """ContactList graphic representation | 80 """ContactList graphic representation |
81 | 81 |
82 Special features like popup menu panel or changing the contact states must be done in a sub-class. | 82 Special features like popup menu panel or changing the contact states must be done in a sub-class. |
83 """ | 83 """ |
84 | 84 |
85 def __init__(self, parent, on_click=None, handle_menu=True): | 85 def __init__(self, parent, on_click=None, handle_menu=True, contacts_style=None, contacts_display=C.CONTACT_DEFAULT_DISPLAY): |
86 """ | 86 """ |
87 @param on_click (callable): click callback (used if ContactBox is created) | 87 @param on_click (callable): click callback (used if ContactBox is created) |
88 @param handle_menu (bool): if True, bind a popup menu to the avatar (used if ContactBox is created) | 88 @param handle_menu (bool): if True, bind a popup menu to the avatar (used if ContactBox is created) |
89 """ # FIXME | 89 """ # FIXME |
90 VerticalPanel.__init__(self) | 90 VerticalPanel.__init__(self) |
95 self.handle_menu = handle_menu | 95 self.handle_menu = handle_menu |
96 | 96 |
97 if on_click is not None: | 97 if on_click is not None: |
98 self.onClick = on_click | 98 self.onClick = on_click |
99 | 99 |
100 def display(self, jids): | 100 self.contacts_style=contacts_style |
101 """Display a contact in the list. | 101 self.contacts_display = contacts_display |
102 | |
103 def setList(self, jids): | |
104 """set all contacts in the list in one shot. | |
102 | 105 |
103 @param jids (list[jid.JID]): jids to display (the order is kept) | 106 @param jids (list[jid.JID]): jids to display (the order is kept) |
104 @param name (unicode): optional name of the contact | 107 @param name (unicode): optional name of the contact |
105 """ | 108 """ |
106 # FIXME: we do a full clear and add boxes after, we should only remove recently hidden boxes and add new ones, and re-order | 109 # FIXME: we do a full clear and add boxes after, we should only remove recently hidden boxes and add new ones, and re-order |
129 @return: ContactBox instance | 132 @return: ContactBox instance |
130 """ | 133 """ |
131 try: | 134 try: |
132 return self._contacts[contact_jid.bare] | 135 return self._contacts[contact_jid.bare] |
133 except KeyError: | 136 except KeyError: |
134 box = contact_widget.ContactBox(self, contact_jid) | 137 box = contact_widget.ContactBox(self, contact_jid, style_name=self.contacts_style, display=self.contacts_display) |
135 self._contacts[contact_jid.bare] = box | 138 self._contacts[contact_jid.bare] = box |
136 return box | 139 return box |
137 | 140 |
138 def updateAvatar(self, jid_, url): | 141 def updateAvatar(self, jid_, url): |
139 """Update the avatar of the given contact | 142 """Update the avatar of the given contact |