Mercurial > libervia-web
comparison src/browser/sat_browser/chat.py @ 834:2491898b3041
browser (chat, notification): remove the textual alerts counter, merge it with the favicon counter
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 12 Jan 2016 17:59:07 +0100 |
parents | 4db064a70fc7 |
children | fa29524774d6 |
comparison
equal
deleted
inserted
replaced
833:4db064a70fc7 | 834:2491898b3041 |
---|---|
217 "link": general info that is clickable like "click here to join the main room" (no sanitize done) | 217 "link": general info that is clickable like "click here to join the main room" (no sanitize done) |
218 "me": "/me" information like "/me clenches his fist" ==> "toto clenches his fist" (will stay on one line) | 218 "me": "/me" information like "/me clenches his fist" ==> "toto clenches his fist" (will stay on one line) |
219 @param extra (dict): message data | 219 @param extra (dict): message data |
220 @param link_cb: method to call when the info is clicked, ignored if type_ is not 'link' | 220 @param link_cb: method to call when the info is clicked, ignored if type_ is not 'link' |
221 """ | 221 """ |
222 QuickChat.printInfo(self, msg, type_, extra) | |
222 if extra is None: | 223 if extra is None: |
223 extra = {} | 224 extra = {} |
224 if type_ == 'normal': | 225 if type_ == 'normal': |
225 _wid = HTML(strings.addURLToText(html_tools.XHTML2Text(msg))) | 226 _wid = HTML(strings.addURLToText(html_tools.XHTML2Text(msg))) |
226 _wid.setStyleName('chatTextInfo') | 227 _wid.setStyleName('chatTextInfo') |
236 raise ValueError("Unknown printInfo type %s" % type_) | 237 raise ValueError("Unknown printInfo type %s" % type_) |
237 self.content.add(_wid) | 238 self.content.add(_wid) |
238 self.content_scroll.scrollToBottom() | 239 self.content_scroll.scrollToBottom() |
239 | 240 |
240 def printMessage(self, nick, my_message, message, timestamp, extra=None, profile=C.PROF_KEY_NONE): | 241 def printMessage(self, nick, my_message, message, timestamp, extra=None, profile=C.PROF_KEY_NONE): |
242 QuickChat.printMessage(self, nick, my_message, message, timestamp, extra, profile) | |
241 if extra is None: | 243 if extra is None: |
242 extra = {} | 244 extra = {} |
243 self.content.add(ChatText(timestamp, nick, my_message, message, extra)) | 245 self.content.add(ChatText(timestamp, nick, my_message, message, extra)) |
244 self.content_scroll.scrollToBottom() | 246 self.content_scroll.scrollToBottom() |
247 | |
248 def notify(self, contact="somebody", msg=""): | |
249 """Notify the user of a new message if primitivus doesn't have the focus. | |
250 | |
251 @param contact (unicode): contact who wrote to the users | |
252 @param msg (unicode): the message that has been received | |
253 """ | |
254 self.host.notification.notify(contact, msg) | |
245 | 255 |
246 def printDayChange(self, day): | 256 def printDayChange(self, day): |
247 """Display the day on a new line. | 257 """Display the day on a new line. |
248 | 258 |
249 @param day(unicode): day to display (or not if this method is not overwritten) | 259 @param day(unicode): day to display (or not if this method is not overwritten) |