Mercurial > libervia-web
diff libervia.py @ 239:b911f2b43fd4
browser_side: added input history in the unibox:
This functionality uses a file from the sat project:
use the -I parameter of pyjsbuild to add sat library
to your PYJSPATH. To ease also possible to use your
sat source directory instead of the library, you just
need to trick pyjsbuild with a symbolic link:
SAT=~/workspace/sat
if [[ ! -e $SAT/sat ]]; then ln -sf $SAT/src $SAT/sat; fi
This will allow you to import like that in libervia.py:
from sat.tools.frontend.misc import InputHistory
And then you can build with:
$PYJS/bin/pyjsbuild libervia --no-compile-inplace -m -I $SAT
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 14 Oct 2013 20:54:13 +0200 |
parents | b304cdf13a3b |
children | a25aa882e09a |
line wrap: on
line diff
--- a/libervia.py Fri Oct 11 15:40:29 2013 +0200 +++ b/libervia.py Mon Oct 14 20:54:13 2013 +0200 @@ -33,6 +33,7 @@ from browser_side import panels, dialog from browser_side.jid import JID from browser_side.tools import html_sanitize +from sat.tools.frontend.misc import InputHistory MAX_MBLOG_CACHE = 500 # Max microblog entries kept in memories @@ -96,15 +97,17 @@ dump(o)""" else: if isinstance(errobj['message'], dict): - print("Error %s: %s" % (errobj['message']['faultCode'], errobj['message']['faultString'])) + print("Error %s: %s" % (errobj['message']['faultCode'], errobj['message']['faultString'])) else: - print("Error: %s" % errobj['message']) + print("Error: %s" % errobj['message']) + class RegisterCall(LiberviaJsonProxy): def __init__(self): LiberviaJsonProxy.__init__(self, "/register_api", ["isRegistered", "isConnected", "connect"]) + class BridgeCall(LiberviaJsonProxy): def __init__(self): LiberviaJsonProxy.__init__(self, "/json_api", @@ -146,7 +149,8 @@ Timer(notify=_timerCb).schedule(self.retry_delay) self.retry_delay *= 2 -class SatWebFrontend: + +class SatWebFrontend(InputHistory): def onModuleLoad(self): print "============ onModuleLoad ==============" panels.ChatPanel.registerClass() @@ -648,6 +652,7 @@ # TODO: chat state notification for groupchat pass + if __name__ == '__main__': pyjd.setup("http://localhost:8080/libervia.html") app = SatWebFrontend()