comparison frontends/src/wix/chat.py @ 1223:802b7e6bf098

frontends: printInfo and printMessage timestamp attribute defaults to None instead of ''
author souliane <souliane@mailoo.org>
date Sat, 04 Oct 2014 10:23:13 +0200
parents e15d8a01cf6a
children
comparison
equal deleted inserted replaced
1222:e6e0ea4dc835 1223:802b7e6bf098
215 if not self.IsActive(): 215 if not self.IsActive():
216 self.RequestUserAttention() 216 self.RequestUserAttention()
217 if not self.IsShown(): 217 if not self.IsShown():
218 self.Show() 218 self.Show()
219 219
220 def printMessage(self, from_jid, msg, profile, timestamp=""): 220 def printMessage(self, from_jid, msg, profile, timestamp=None):
221 """Print the message with differents colors depending on where it comes from.""" 221 """Print the message with differents colors depending on where it comes from."""
222 try: 222 try:
223 jid,nick,mymess = QuickChat.printMessage(self, from_jid, msg, profile, timestamp) 223 jid,nick,mymess = QuickChat.printMessage(self, from_jid, msg, profile, timestamp)
224 except TypeError: 224 except TypeError:
225 return 225 return
236 self.chatWindow.SetDefaultStyle(wx.TextAttr("BLACK", font=_font_italic)) 236 self.chatWindow.SetDefaultStyle(wx.TextAttr("BLACK", font=_font_italic))
237 self.chatWindow.AppendText("%s\n" % msg) 237 self.chatWindow.AppendText("%s\n" % msg)
238 if not mymess: 238 if not mymess:
239 self.__blink() 239 self.__blink()
240 240
241 def printInfo(self, msg, type_='normal', timestamp=""): 241 def printInfo(self, msg, type_='normal', timestamp=None):
242 """Print general info 242 """Print general info
243 @param msg: message to print 243 @param msg: message to print
244 @type_: one of: 244 @type_: one of:
245 normal: general info like "toto has joined the room" 245 normal: general info like "toto has joined the room"
246 me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist" 246 me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist"
247 @param timestamp (float): number of seconds since epoch
247 """ 248 """
248 _font_bold = wx.Font(self.font["points"], self.font["family"], wx.NORMAL, wx.BOLD) 249 _font_bold = wx.Font(self.font["points"], self.font["family"], wx.NORMAL, wx.BOLD)
249 _font_normal = wx.Font(self.font["points"], self.font["family"], wx.NORMAL, wx.NORMAL) 250 _font_normal = wx.Font(self.font["points"], self.font["family"], wx.NORMAL, wx.NORMAL)
250 self.chatWindow.SetDefaultStyle(wx.TextAttr("BLACK", font=_font_bold if type_ == 'normal' else _font_normal)) 251 self.chatWindow.SetDefaultStyle(wx.TextAttr("BLACK", font=_font_bold if type_ == 'normal' else _font_normal))
251 self.chatWindow.AppendText("%s\n" % msg) 252 self.chatWindow.AppendText("%s\n" % msg)