Chat presentation enhancement
- core: message signal is not sent anymore for groupchat type, cause MUC chat server do it for us - wix: user nick can now be specified to chat windows, usefull for colorization - memory: full jid are now sent - wix: message from user are now in black for group chat
This commit is contained in:
parent
a9fc22c842
commit
4b10dd725e
1 changed files with 17 additions and 8 deletions
|
|
@ -52,7 +52,6 @@ class Chat(wx.Frame, QuickChat):
|
|||
self.conv_panel.SetSizer(self.conv_panel.sizer)
|
||||
self.splitter.Initialize(self.conv_panel)
|
||||
self.SetMenuBar(wx.MenuBar())
|
||||
self.setType(self.type)
|
||||
|
||||
#events
|
||||
self.Bind(wx.EVT_CLOSE, self.onClose, self)
|
||||
|
|
@ -63,8 +62,8 @@ class Chat(wx.Frame, QuickChat):
|
|||
self.font["points"] = self.chatWindow.GetFont().GetPointSize()
|
||||
self.font["family"] = self.chatWindow.GetFont().GetFamily()
|
||||
|
||||
self.historyPrint(profile=self.host.profile)
|
||||
|
||||
self.setType(self.type)
|
||||
|
||||
#misc
|
||||
self.textBox.SetFocus()
|
||||
self.Hide() #We hide because of the show toggle
|
||||
|
|
@ -86,17 +85,19 @@ class Chat(wx.Frame, QuickChat):
|
|||
self.__createPresents()
|
||||
self.subjectBox.Show()
|
||||
self.__eraseMenus()
|
||||
|
||||
self.historyPrint(profile=self.host.profile)
|
||||
elif type is 'one2one' and self.splitter.IsSplit():
|
||||
self.splitter.Unsplit(self.present_panel)
|
||||
del self.present_panel
|
||||
self.GetMenuBar().Show()
|
||||
self.subjectBox.Hide()
|
||||
self.__createMenus_O2O()
|
||||
self.nick = None
|
||||
else:
|
||||
self.subjectBox.Hide()
|
||||
self.__createMenus_O2O()
|
||||
|
||||
self.historyPrint(profile=self.host.profile)
|
||||
|
||||
def setPresents(self, nicks):
|
||||
"""Set the users presents in the contact list for a group chat
|
||||
@param nicks: list of nicknames
|
||||
|
|
@ -176,8 +177,9 @@ class Chat(wx.Frame, QuickChat):
|
|||
def printMessage(self, from_jid, msg, profile, timestamp=""):
|
||||
"""Print the message with differents colors depending on where it comes from."""
|
||||
jid=JID(from_jid)
|
||||
print "printMessage, jid=",jid,"type=",self.type
|
||||
nick = jid.resource if self.type == "group" else (self.host.CM.getAttr(jid,'nick') or self.host.CM.getAttr(jid,'name') or jid)
|
||||
mymess = (jid.short == self.host.profiles[profile]['whoami'].short) #mymess = True if message comes from local user
|
||||
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
|
||||
_font = wx.Font(self.font["points"], self.font["family"], wx.NORMAL, wx.BOLD)
|
||||
self.chatWindow.SetDefaultStyle(wx.TextAttr( "BLACK" if mymess else "BLUE", font=_font))
|
||||
self.chatWindow.AppendText("[%s] " % nick)
|
||||
|
|
|
|||
Loading…
Reference in a new issue