changeset 658:476d8d9973d3 frontends_multi_profiles

browser_side: the contact list's height needs a window resize after it's been added or when the tab bar display is changed
author souliane <souliane@mailoo.org>
date Fri, 27 Feb 2015 02:42:44 +0100
parents 0b7e4226378d
children 8e7d4de56e75
files src/browser/libervia_main.py src/browser/sat_browser/contact_list.py src/browser/sat_browser/libervia_widget.py
diffstat 3 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/libervia_main.py	Fri Feb 27 13:12:28 2015 +0100
+++ b/src/browser/libervia_main.py	Fri Feb 27 02:42:44 2015 +0100
@@ -362,6 +362,10 @@
     def addContactList(self, dummy):
         contact_list = ContactList(self)
         self.panel.addContactList(contact_list)
+
+        # FIXME: the contact list height has to be set manually the first time
+        self.resize()
+
         return contact_list
 
     def newWidget(self, wid):
--- a/src/browser/sat_browser/contact_list.py	Fri Feb 27 13:12:28 2015 +0100
+++ b/src/browser/sat_browser/contact_list.py	Fri Feb 27 02:42:44 2015 +0100
@@ -236,10 +236,10 @@
             self._contacts_panel.setState(jid_, "messageWaiting", True)
 
     def onWindowResized(self, width, height):
-        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())
+        tab_panel = self.host.panel.tab_panel
+        if tab_panel.getWidgetCount() > 1:
+            ideal_height -= tab_panel.getTabBar().getOffsetHeight()
         self.scroll_panel.setHeight("%s%s" % (ideal_height, "px"))
 
     # def updateContact(self, jid_s, attributes, groups):
--- a/src/browser/sat_browser/libervia_widget.py	Fri Feb 27 13:12:28 2015 +0100
+++ b/src/browser/sat_browser/libervia_widget.py	Fri Feb 27 02:42:44 2015 +0100
@@ -43,7 +43,6 @@
 from pyjamas.ui.DropWidget import DropWidget
 from pyjamas import DOM
 from pyjamas import Window
-from __pyjamas__ import doc
 
 import dialog
 import base_menu
@@ -785,6 +784,7 @@
         TabPanel.add(self, widget, DropTab(self, label), False)
         if self.getWidgetCount() > 1:
             self.tabBar.removeStyleDependentName('oneTab')
+            self.host.resize()
         if select:
             self.selectTab(self.getWidgetCount() - 1)
 
@@ -809,4 +809,5 @@
         widgets_count = self.getWidgetCount()
         if widgets_count == 1:
             self.tabBar.addStyleDependentName('oneTab')
+            self.host.resize()
         self.selectTab(widget_index if widget_index < widgets_count else widgets_count - 1)