comparison frontends/src/primitivus/chat.py @ 1788:526e4145253c

primitivus (chat): since dialog refresh is done in message notification, print the message first and then notify
author souliane <souliane@mailoo.org>
date Wed, 13 Jan 2016 08:50:40 +0100
parents 104874018ab0
children 2daf7b4c6756
comparison
equal deleted inserted replaced
1787:d678b723460b 1788:526e4145253c
301 @param nick (unicode): author nick 301 @param nick (unicode): author nick
302 @param my_message (boolean): True if profile is the author 302 @param my_message (boolean): True if profile is the author
303 @param message (unicode): message content 303 @param message (unicode): message content
304 @param extra (dict): extra data 304 @param extra (dict): extra data
305 """ 305 """
306 QuickChat.printMessage(self, nick, my_message, message, timestamp, extra, profile)
307 new_text = ChatText(self, timestamp, nick, my_message, message) 306 new_text = ChatText(self, timestamp, nick, my_message, message)
308 self.content.append(new_text) 307 self.content.append(new_text)
308 QuickChat.printMessage(self, nick, my_message, message, timestamp, extra, profile)
309 309
310 def printInfo(self, msg, type_='normal', extra=None): 310 def printInfo(self, msg, type_='normal', extra=None):
311 """Print general info 311 """Print general info
312 @param msg: message to print 312 @param msg: message to print
313 @type_: one of: 313 @type_: one of:
314 normal: general info like "toto has joined the room" 314 normal: general info like "toto has joined the room"
315 me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist" 315 me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist"
316 @param timestamp (float): number of seconds since epoch 316 @param timestamp (float): number of seconds since epoch
317 """ 317 """
318 QuickChat.printInfo(self, msg, type_, extra)
319 if extra is None: 318 if extra is None:
320 extra = {} 319 extra = {}
321 try: 320 try:
322 timestamp = float(extra['timestamp']) 321 timestamp = float(extra['timestamp'])
323 except KeyError: 322 except KeyError:
324 timestamp = None 323 timestamp = None
325 _widget = ChatText(self, timestamp, None, False, msg, is_info=True) 324 _widget = ChatText(self, timestamp, None, False, msg, is_info=True)
326 self.content.append(_widget) 325 self.content.append(_widget)
326 QuickChat.printInfo(self, msg, type_, extra)
327 327
328 def notify(self, contact="somebody", msg=""): 328 def notify(self, contact="somebody", msg=""):
329 """Notify the user of a new message if primitivus doesn't have the focus. 329 """Notify the user of a new message if primitivus doesn't have the focus.
330 330
331 @param contact (unicode): contact who wrote to the users 331 @param contact (unicode): contact who wrote to the users