diff browser_side/panels.py @ 292:1a5dc08c2749

browser_side: set the ideal width for the rich text dialog when displayed in the unibox panel
author souliane <souliane@mailoo.org>
date Tue, 10 Dec 2013 14:03:47 +0100
parents 89818bca1a33
children 7c79d4d66161
line wrap: on
line diff
--- a/browser_side/panels.py	Tue Dec 10 13:04:51 2013 +0100
+++ b/browser_side/panels.py	Tue Dec 10 14:03:47 2013 +0100
@@ -90,6 +90,7 @@
         self.host.panel._contactsMove(self)
 
         def onCloseCallback():
+            Window.removeWindowResizeListener(self)
             self.host.panel._contactsMove(self.host.panel._hpanel)
             self.setCellWidth(self.unibox, '100%')
             self.button.setVisible(True)
@@ -97,8 +98,15 @@
             self.host.resize()
 
         richtext.RichTextEditor.getOrCreate(self.host, self, onCloseCallback)
+        Window.addWindowResizeListener(self)
         self.host.resize()
 
+    def onWindowResized(self, width, height):
+        right = self.host.panel.menu.getAbsoluteLeft() + self.host.panel.menu.getOffsetWidth()
+        left = self.host.panel._contacts.getAbsoluteLeft() + self.host.panel._contacts.getOffsetWidth()
+        ideal_width = right - left - 40
+        self.host.richtext.setWidth("%spx" % ideal_width)
+
 
 class UniBox(TextArea, MouseHandler): #AutoCompleteTextBox):
     """This text box is used as a main typing point, for message, microblog, etc"""