diff libervia.py @ 309:05e264e96a1c

browser_side: make unibox optional
author souliane <souliane@mailoo.org>
date Sun, 29 Dec 2013 23:07:28 +0100
parents 2ab513a47e3b
children b4781a350483
line wrap: on
line diff
--- a/libervia.py	Fri Dec 27 13:59:06 2013 +0100
+++ b/libervia.py	Sun Dec 29 23:07:28 2013 +0100
@@ -36,6 +36,7 @@
 from browser_side.tools import html_sanitize
 from sat_frontends.tools.misc import InputHistory
 from sat_frontends.tools.strings import getURLParams
+from sat_frontends.constants import Const
 
 MAX_MBLOG_CACHE = 500  # Max microblog entries kept in memories
 
@@ -262,10 +263,12 @@
         except KeyError:
             print ('WARNING: trying to remove a non registered Widget:', wid.getDebugName())
 
-    def setUniBox(self, unibox):
-        """register the unibox widget"""
-        self.uni_box = unibox
-        self.uni_box.addKey("@@: ")
+    def _setUniBox(self, enable):
+        """Enable or disable the unibox widget.
+        @param enable: boolean
+        """
+        self.panel.unibox_panel.setUniBox(enable == 'true')
+        self.uni_box = self.panel.unibox_panel.unibox
 
     def addTab(self, label, wid, select=True):
         """Create a new tab and eventually add a widget in
@@ -325,6 +328,7 @@
             self._defaultDomain = "libervia.org"
 
         self.bridge.call("getNewAccountDomain", (domain_cb, domain_eb))
+        self.bridge.call('asyncGetParamA', self._setUniBox, Const.ENABLE_UNIBOX_PARAM, Const.ENABLE_UNIBOX_KEY)
 
     def _tryAutoConnect(self):
         """This method retrieve the eventual URL parameters to auto-connect the user."""