# HG changeset patch # User Goffi # Date 1440164300 -7200 # Node ID 102bab805ec1c63461df07a2471fc5baa6c6cc1c # Parent bf0a7da558e8af781d061dc43c86dfff2af31949 browser side(xmlui): basic JidsList implementation (read-only) using ContactsPanel, to fix params display diff -r bf0a7da558e8 -r 102bab805ec1 src/browser/sat_browser/contact_panel.py --- a/src/browser/sat_browser/contact_panel.py Fri Aug 21 15:37:21 2015 +0200 +++ b/src/browser/sat_browser/contact_panel.py Fri Aug 21 15:38:20 2015 +0200 @@ -26,7 +26,6 @@ from pyjamas.ui.VerticalPanel import VerticalPanel -import html_tools import contact_widget from constants import Const as C @@ -73,6 +72,14 @@ """ return contact_jid.bare if self.merge_resources else contact_jid + def getJids(self): + """Return jids present in the panel + + @return (list[jid.JID]): full jids or bare jids if self.merge_resources is True + """ + return self.contacts.keys() + + def clear(self): """Clear all contacts.""" self._contacts.clear() diff -r bf0a7da558e8 -r 102bab805ec1 src/browser/sat_browser/xmlui.py --- a/src/browser/sat_browser/xmlui.py Fri Aug 21 15:37:21 2015 +0200 +++ b/src/browser/sat_browser/xmlui.py Fri Aug 21 15:38:20 2015 +0200 @@ -21,9 +21,11 @@ log = getLogger(__name__) from sat_frontends.tools import xmlui from sat_frontends.tools import strings +from sat_frontends.tools import jid from sat_browser.constants import Const as C from sat_browser import dialog from sat_browser import html_tools +from sat_browser import contact_panel from pyjamas.ui.VerticalPanel import VerticalPanel from pyjamas.ui.HorizontalPanel import HorizontalPanel @@ -228,6 +230,18 @@ self._xmluiSelectValues(selected) +class JidsListWidget(contact_panel.ContactsPanel, xmlui.JidsListWidget): + + def __init__(self, xmlui_main, xmlui_parent, jids, styles): + contact_panel.ContactsPanel.__init__(self, xmlui_main.host, merge_resources=False) + self.setList([jid.JID(jid_) for jid_ in jids]) + + def _xmluiGetSelectedValues(self): + # XXX: there is not selection in this list, so we return all non empty values + return self.getJids() + + + class LiberviaContainer(object): def _xmluiAppend(self, widget):