diff src/browser/sat_browser/chat.py @ 779:fc941d0d97f8

browser_side: fixed ContactsPanel scrolling
author souliane <souliane@mailoo.org>
date Mon, 30 Nov 2015 21:52:41 +0100
parents 78e4a79fbb5e
children f3cd261ea12f
line wrap: on
line diff
--- a/src/browser/sat_browser/chat.py	Mon Nov 30 16:26:31 2015 +0100
+++ b/src/browser/sat_browser/chat.py	Mon Nov 30 21:52:41 2015 +0100
@@ -35,6 +35,7 @@
 from pyjamas.ui.KeyboardListener import KEY_ENTER, KeyboardHandler
 from pyjamas.ui.HTMLPanel import HTMLPanel
 from pyjamas import DOM
+from pyjamas import Window
 
 from datetime import datetime
 from time import time
@@ -107,7 +108,8 @@
             self.host.addListener('presence', self.presenceListener, [C.PROF_KEY_NONE])
             self.avatarListener = self.onAvatarUpdate
             host.addListener('avatar', self.avatarListener, [C.PROF_KEY_NONE])
-
+            Window.addWindowResizeListener(self)
+        
         self._body.add(chat_area)
         self.content = AbsolutePanel()
         self.content.setStyleName('chatContent')
@@ -128,6 +130,10 @@
         if type_ == C.CHAT_ONE2ONE:
             self.historyPrint(profile=self.profile)
 
+    def onWindowResized(self, width=None, height=None):
+        ideal_height = self.content_scroll.getOffsetHeight()
+        self.occupants_panel.setHeight("%s%s" % (ideal_height, "px"))
+
     @property
     def target(self):
         # FIXME: for unknow reason, pyjamas doesn't use the method inherited from QuickChat
@@ -285,6 +291,8 @@
         if 'chat_state' in states.keys():  # start/stop sending "composing" state from now
             self.chat_state_machine.started = not not states['chat_state']
 
+        self.onWindowResized()  # be sure to set the good height
+
     def addGamePanel(self, widget):
         """Insert a game panel to this Chat dialog.