diff frontends/wix/chat.py @ 76:8becde8a967c

MUC: added subject management - plugin xep-0045: added roomNewSubject signal - wix: added subject bar for group windows
author Goffi <goffi@goffi.org>
date Tue, 30 Mar 2010 13:15:05 +1100
parents 7322a41f8a8e
children 1ae680f9682e
line wrap: on
line diff
--- a/frontends/wix/chat.py	Mon Mar 29 16:54:53 2010 +1100
+++ b/frontends/wix/chat.py	Tue Mar 30 13:15:05 2010 +1100
@@ -43,15 +43,17 @@
         
         self.conv_panel = wx.Panel(self.splitter)
         self.conv_panel.sizer = wx.BoxSizer(wx.VERTICAL)
+        self.subjectBox = wx.TextCtrl(self.conv_panel, -1, style = wx.TE_READONLY)
         self.chatWindow = wx.TextCtrl(self.conv_panel, -1, style = wx.TE_MULTILINE | wx.TE_RICH | wx.TE_READONLY)
         self.textBox = wx.TextCtrl(self.conv_panel, -1, style = wx.TE_PROCESS_ENTER)
+        self.conv_panel.sizer.Add(self.subjectBox, flag=wx.EXPAND)
         self.conv_panel.sizer.Add(self.chatWindow, 1, flag=wx.EXPAND)
         self.conv_panel.sizer.Add(self.textBox, flag=wx.EXPAND)
         self.conv_panel.SetSizer(self.conv_panel.sizer)
         self.splitter.Initialize(self.conv_panel)
         self.setType(self.type)
 
-        self.createMenus()
+        self.__createMenus()
         
         #events
         self.Bind(wx.EVT_CLOSE, self.onClose, self)
@@ -83,9 +85,12 @@
         QuickChat.setType(self, type)
         if type is 'group' and not self.splitter.IsSplit():
             self.__createPresents()
+            self.subjectBox.Show()
         elif type is 'one2one' and self.splitter.IsSplit():
             self.splitter.Unsplit(self.present_panel)
             del self.present_panel
+        else:
+            self.subjectBox.Hide()
 
     def setPresents(self, nicks):
         """Set the users presents in the contact list for a group chat
@@ -115,9 +120,16 @@
             return
         self.present_panel.presents.remove(nick)
 
+    def setSubject(self, subject):
+        """Set title for a group chat"""
+        debug(_("Setting subject to %s") % subject)
+        if self.type != "group":
+            error (_("[INTERNAL] trying to set subject for a non group chat window"))
+            return
+        self.subjectBox.SetValue(subject)
 
 
-    def createMenus(self):
+    def __createMenus(self):
         info("Creating menus")
         actionMenu = wx.Menu()
         actionMenu.Append(idSEND, _("&SendFile	CTRL-s"),_(" Send a file to contact"))