changeset 313:5ad70625867a

browser_side: save the unibox panel space when unibox is disabled
author souliane <souliane@mailoo.org>
date Mon, 30 Dec 2013 13:00:41 +0100
parents b4781a350483
children 70ac3067d641
files browser_side/panels.py libervia.py
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/browser_side/panels.py	Mon Dec 30 00:33:19 2013 +0100
+++ b/browser_side/panels.py	Mon Dec 30 13:00:41 2013 +0100
@@ -76,6 +76,7 @@
     def setUniBox(self, enable):
         """Enable or disable the unibox widget.
         @param enable: boolean
+        @return: UniBox instance or None if disabled
         """
         if enable:
             self.button = Button ('<img src="media/icons/tango/actions/32/format-text-italic.png" class="richTextIcon"/>')
@@ -87,10 +88,12 @@
             self.setCellWidth(self.unibox, '100%')
             self.button.addClickListener(self.openRichTextEditor)
             self.unibox.addKey("@@: ")
+            return self.unibox
         else:
             if self.unibox:
                 self.remove(self.unibox)
                 self.unibox = None
+        return None
 
     def openRichTextEditor(self):
         """Open the rich text editor."""
@@ -1261,6 +1264,7 @@
 
         # unibox
         self.unibox_panel = UniBoxPanel(host)
+        self.unibox_panel.setVisible(False)
 
         # status bar
         status = host.status_panel
@@ -1323,6 +1327,14 @@
         ideal_height = Window.getClientHeight() - tab_bar_h
         self.setHeight("%s%s" % (ideal_height, "px"))
 
+    def setUniBoxPanel(self, enable):
+        """Enable or disable the unibox
+        @param enable: boolean
+        @return: UniBox instance or None if disabled
+        """
+        self.unibox_panel.setVisible(enable)
+        return self.unibox_panel.setUniBox(enable)
+
 
 class PopupMenuPanel(PopupPanel):
     """This implementation of a popup menu (context menu) allow you to assign
--- a/libervia.py	Mon Dec 30 00:33:19 2013 +0100
+++ b/libervia.py	Mon Dec 30 13:00:41 2013 +0100
@@ -263,8 +263,7 @@
         """Enable or disable the unibox widget.
         @param enable: boolean
         """
-        self.panel.unibox_panel.setUniBox(enable == 'true')
-        self.uni_box = self.panel.unibox_panel.unibox
+        self.uni_box = self.panel.setUniBoxPanel(enable == 'true')
 
     def addTab(self, label, wid, select=True):
         """Create a new tab and eventually add a widget in