comparison frontends/wix/chat.py @ 123:34766e0cf970

wix: chat: date is now printed in grey
author Goffi <goffi@goffi.org>
date Thu, 08 Jul 2010 18:29:44 +0800
parents 29998cd0ed8d
children a86607e5cf38
comparison
equal deleted inserted replaced
122:29998cd0ed8d 123:34766e0cf970
213 nick = jid.resource if self.type == "group" else (self.host.CM.getAttr(jid,'nick') or self.host.CM.getAttr(jid,'name') or jid.node) 213 nick = jid.resource if self.type == "group" else (self.host.CM.getAttr(jid,'nick') or self.host.CM.getAttr(jid,'name') or jid.node)
214 mymess = (jid.resource == self.nick) if self.type == "group" else (jid.short == self.host.profiles[profile]['whoami'].short) #mymess = True if message comes from local user 214 mymess = (jid.resource == self.nick) if self.type == "group" else (jid.short == self.host.profiles[profile]['whoami'].short) #mymess = True if message comes from local user
215 _font_bold = wx.Font(self.font["points"], self.font["family"], wx.NORMAL, wx.BOLD) 215 _font_bold = wx.Font(self.font["points"], self.font["family"], wx.NORMAL, wx.BOLD)
216 _font_normal = wx.Font(self.font["points"], self.font["family"], wx.NORMAL, wx.NORMAL) 216 _font_normal = wx.Font(self.font["points"], self.font["family"], wx.NORMAL, wx.NORMAL)
217 _font_italic = wx.Font(self.font["points"], self.font["family"], wx.ITALIC if mymess else wx.NORMAL, wx.NORMAL) 217 _font_italic = wx.Font(self.font["points"], self.font["family"], wx.ITALIC if mymess else wx.NORMAL, wx.NORMAL)
218 self.chatWindow.SetDefaultStyle(wx.TextAttr("BLACK", font=_font_normal)) 218 self.chatWindow.SetDefaultStyle(wx.TextAttr("GREY", font=_font_normal))
219 msg_time = time.localtime(timestamp or None) 219 msg_time = time.localtime(timestamp or None)
220 time_format = "%c" if msg_time < self.day_change else "%H:%M" #if the message was sent before today, we print the full date 220 time_format = "%c" if msg_time < self.day_change else "%H:%M" #if the message was sent before today, we print the full date
221 self.chatWindow.AppendText("[%s]" % time.strftime(time_format, msg_time )) 221 self.chatWindow.AppendText("[%s]" % time.strftime(time_format, msg_time ))
222 self.chatWindow.SetDefaultStyle(wx.TextAttr( "BLACK" if mymess else "BLUE", font=_font_bold)) 222 self.chatWindow.SetDefaultStyle(wx.TextAttr( "BLACK" if mymess else "BLUE", font=_font_bold))
223 self.chatWindow.AppendText("[%s] " % nick) 223 self.chatWindow.AppendText("[%s] " % nick)