diff src/browser/sat_browser/contact_list.py @ 654:40c72f3b7638 frontends_multi_profiles

browser_side: MainPanel is now based on a DockPanel, which allows to use less tables and also to remove some "window resized" listeners
author souliane <souliane@mailoo.org>
date Fri, 27 Feb 2015 02:39:43 +0100
parents 2df91d0308ac
children 476d8d9973d3
line wrap: on
line diff
--- a/src/browser/sat_browser/contact_list.py	Fri Feb 27 01:45:34 2015 +0100
+++ b/src/browser/sat_browser/contact_list.py	Fri Feb 27 02:39:43 2015 +0100
@@ -236,18 +236,10 @@
             self._contacts_panel.setState(jid_, "messageWaiting", True)
 
     def onWindowResized(self, width, height):
-        contact_panel_elt = self.getElement()
-        # FIXME: still needed ?
-        # classname = 'widgetsPanel' if isinstance(self.getParent().getParent(), panels.UniBoxPanel) else 'gwt-TabBar'
-        classname = 'gwt-TabBar'
-        _elts = doc().getElementsByClassName(classname)
-        if not _elts.length:
-            log.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
+        tab_bar = self.host.panel.tab_panel.getTabBar()
+        ideal_height = height - DOM.getAbsoluteTop(self.getElement()) - 5
+        if tab_bar.getVisible():
+            ideal_height -= DOM.getOffsetHeight(tab_bar.getElement())
         self.scroll_panel.setHeight("%s%s" % (ideal_height, "px"))
 
     # def updateContact(self, jid_s, attributes, groups):