# HG changeset patch # User Goffi # Date 1409938175 -7200 # Node ID d2bf317b2d28897f18d2d205fc79e2fab049c932 # Parent 19fc2ebc02dd072c12c1cba4a46824ff0f2b4f48 browser_side: printInfo fixes: - type_ is managed as follow: - me: a Label will be used - link: a *NOT SANITIZED* HTML will be used - normal: a sanitized HTML with url added will be used - scrolling fixed diff -r 19fc2ebc02dd -r d2bf317b2d28 src/browser/sat_browser/panels.py --- a/src/browser/sat_browser/panels.py Fri Sep 05 19:29:35 2014 +0200 +++ b/src/browser/sat_browser/panels.py Fri Sep 05 19:29:35 2014 +0200 @@ -1265,23 +1265,26 @@ """Print general info @param msg: message to print @param type_: one of: - "normal": general info like "toto has joined the room" - "link": general info that is clickable like "click here to join the main room" - "me": "/me" information like "/me clenches his fist" ==> "toto clenches his fist" + "normal": general info like "toto has joined the room" (will be sanitized) + "link": general info that is clickable like "click here to join the main room" (no sanitize done) + "me": "/me" information like "/me clenches his fist" ==> "toto clenches his fist" (will stay on one line) @param link_cb: method to call when the info is clicked, ignored if type_ is not 'link' """ - _wid = HTML(msg) if type_ == 'link' else Label(msg) if type_ == 'normal': + _wid = HTML(addURLToText(html_tools.XHTML2Text(msg))) _wid.setStyleName('chatTextInfo') elif type_ == 'link': + _wid = HTML(msg) _wid.setStyleName('chatTextInfo-link') if link_cb: _wid.addClickListener(link_cb) elif type_ == 'me': + _wid = Label(msg) _wid.setStyleName('chatTextMe') else: - _wid.setStyleName('chatTextInfo') + raise ValueError("Unknown printInfo type %s" % type_) self.content.add(_wid) + self.content_scroll.scrollToBottom() def printMessage(self, from_jid, msg, extra, timestamp=None): """Print message in chat window. Must be implemented by child class"""