comparison 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
comparison
equal deleted inserted replaced
308:0ca441ba4317 309:05e264e96a1c
34 from browser_side import panels, dialog 34 from browser_side import panels, dialog
35 from browser_side.jid import JID 35 from browser_side.jid import JID
36 from browser_side.tools import html_sanitize 36 from browser_side.tools import html_sanitize
37 from sat_frontends.tools.misc import InputHistory 37 from sat_frontends.tools.misc import InputHistory
38 from sat_frontends.tools.strings import getURLParams 38 from sat_frontends.tools.strings import getURLParams
39 from sat_frontends.constants import Const
39 40
40 MAX_MBLOG_CACHE = 500 # Max microblog entries kept in memories 41 MAX_MBLOG_CACHE = 500 # Max microblog entries kept in memories
41 42
42 # Set to true to not create a new LiberviaWidget when a similar one 43 # Set to true to not create a new LiberviaWidget when a similar one
43 # already exist (i.e. a chat panel with the same target). Instead 44 # already exist (i.e. a chat panel with the same target). Instead
260 try: 261 try:
261 self.libervia_widgets.remove(wid) 262 self.libervia_widgets.remove(wid)
262 except KeyError: 263 except KeyError:
263 print ('WARNING: trying to remove a non registered Widget:', wid.getDebugName()) 264 print ('WARNING: trying to remove a non registered Widget:', wid.getDebugName())
264 265
265 def setUniBox(self, unibox): 266 def _setUniBox(self, enable):
266 """register the unibox widget""" 267 """Enable or disable the unibox widget.
267 self.uni_box = unibox 268 @param enable: boolean
268 self.uni_box.addKey("@@: ") 269 """
270 self.panel.unibox_panel.setUniBox(enable == 'true')
271 self.uni_box = self.panel.unibox_panel.unibox
269 272
270 def addTab(self, label, wid, select=True): 273 def addTab(self, label, wid, select=True):
271 """Create a new tab and eventually add a widget in 274 """Create a new tab and eventually add a widget in
272 @param label: label of the tab 275 @param label: label of the tab
273 @param wid: LiberviaWidget to add 276 @param wid: LiberviaWidget to add
323 326
324 def domain_eb(value): 327 def domain_eb(value):
325 self._defaultDomain = "libervia.org" 328 self._defaultDomain = "libervia.org"
326 329
327 self.bridge.call("getNewAccountDomain", (domain_cb, domain_eb)) 330 self.bridge.call("getNewAccountDomain", (domain_cb, domain_eb))
331 self.bridge.call('asyncGetParamA', self._setUniBox, Const.ENABLE_UNIBOX_PARAM, Const.ENABLE_UNIBOX_KEY)
328 332
329 def _tryAutoConnect(self): 333 def _tryAutoConnect(self):
330 """This method retrieve the eventual URL parameters to auto-connect the user.""" 334 """This method retrieve the eventual URL parameters to auto-connect the user."""
331 params = getURLParams(Window.getLocation().getSearch()) 335 params = getURLParams(Window.getLocation().getSearch())
332 if "login" in params: 336 if "login" in params: