Mercurial > libervia-web
diff src/browser/sat_browser/contact_panel.py @ 779:fc941d0d97f8
browser_side: fixed ContactsPanel scrolling
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 30 Nov 2015 21:52:41 +0100 |
parents | 76a9c074327b |
children | b2a75a103aac |
line wrap: on
line diff
--- a/src/browser/sat_browser/contact_panel.py Mon Nov 30 16:26:31 2015 +0100 +++ b/src/browser/sat_browser/contact_panel.py Mon Nov 30 21:52:41 2015 +0100 @@ -24,13 +24,14 @@ log = getLogger(__name__) from sat_frontends.tools import jid +from pyjamas.ui.ScrollPanel import ScrollPanel from pyjamas.ui.VerticalPanel import VerticalPanel import contact_widget from constants import Const as C -class ContactsPanel(VerticalPanel): +class ContactsPanel(ScrollPanel): """ContactList graphic representation Special features like popup menu panel or changing the contact states must be done in a sub-class. @@ -51,14 +52,17 @@ @param contacts_display (tuple): prioritize the display methods of the contact's label with values in ("jid", "nick", "bare", "resource") """ - VerticalPanel.__init__(self) + self.panel = VerticalPanel() + ScrollPanel.__init__(self, self.panel) + self.addStyleName("gwt-ScrollPanel") # XXX: no class is set by Pyjamas + self.host = host self.merge_resources = merge_resources self._contacts = {} # entity jid to ContactBox map - self.click_listener = None + self.panel.click_listener = None if contacts_click is not None: - self.onClick = contacts_click + self.panel.onClick = contacts_click self.contacts_style = contacts_style self.contacts_menus = contacts_menus @@ -83,7 +87,7 @@ def clear(self): """Clear all contacts.""" self._contacts.clear() - VerticalPanel.clear(self) + VerticalPanel.clear(self.panel) def setList(self, jids): """set all contacts in the list in one shot. @@ -91,7 +95,7 @@ @param jids (list[jid.JID]): jids to display (the order is kept) @param name (unicode): optional name of the contact """ - current_jids = [box.jid for box in self.children if isinstance(box, contact_widget.ContactBox)] + current_jids = [box.jid for box in self.panel.children if isinstance(box, contact_widget.ContactBox)] if current_jids == jids: # the display doesn't change return @@ -132,9 +136,9 @@ plugin_menu_context=self.contacts_menus) self._contacts[self._key(contact_jid)] = box if index: - VerticalPanel.insert(self, box, index) + VerticalPanel.insert(self.panel, box, index) else: - VerticalPanel.append(self, box) + VerticalPanel.append(self.panel, box) return box def removeContactBox(self, contact_jid): @@ -144,4 +148,4 @@ """ box = self._contacts.pop(self._key(contact_jid), None) if box: - VerticalPanel.remove(self, box) + VerticalPanel.remove(self.panel, box)