changeset 721:102bab805ec1

browser side(xmlui): basic JidsList implementation (read-only) using ContactsPanel, to fix params display
author Goffi <goffi@goffi.org>
date Fri, 21 Aug 2015 15:38:20 +0200
parents bf0a7da558e8
children 242dde89e698
files src/browser/sat_browser/contact_panel.py src/browser/sat_browser/xmlui.py
diffstat 2 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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()
--- 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):