changeset 290:3216c8d5432b

browser_side: set the ideal height for the contact panel size when displayed in the unibox panel
author souliane <souliane@mailoo.org>
date Tue, 10 Dec 2013 10:27:58 +0100
parents 20a9aedc60b5
children 89818bca1a33
files browser_side/contact.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/browser_side/contact.py	Tue Dec 10 09:56:28 2013 +0100
+++ b/browser_side/contact.py	Tue Dec 10 10:27:58 2013 +0100
@@ -30,7 +30,7 @@
 from pyjamas import Window
 from pyjamas import DOM
 
-from browser_side.panels import ChatPanel, MicroblogPanel, PopupMenuPanel, WebPanel
+from browser_side.panels import ChatPanel, MicroblogPanel, PopupMenuPanel, WebPanel, UniBoxPanel
 from browser_side.tools import DragLabel, html_sanitize, setPresenceStyle
 from __pyjamas__ import doc
 
@@ -243,15 +243,16 @@
 
     def onWindowResized(self, width, height):
         contact_panel_elt = self.getElement()
-        _elts = doc().getElementsByClassName('gwt-TabBar')
+        classname = 'widgetsPanel' if isinstance(self.getParent().getParent(), UniBoxPanel) else'gwt-TabBar'
+        _elts = doc().getElementsByClassName(classname)
         if not _elts.length:
-            print ("ERROR: no TabBar found, it should exist !")
+            print ("ERROR: no element of class %s found, it should exist !" % classname)
             tab_bar_h = height
         else:
             tab_bar_h = DOM.getAbsoluteTop(_elts.item(0)) or height  # getAbsoluteTop can be 0 if tabBar is hidden
 
         ideal_height = tab_bar_h - DOM.getAbsoluteTop(contact_panel_elt) - 5
-        self.scroll_panel.setHeight("%s%s" % (ideal_height, "px"));
+        self.scroll_panel.setHeight("%s%s" % (ideal_height, "px"))
 
     def updateContact(self, jid, attributes, groups):
         """Add a contact to the panel if it doesn't exist, update it else