diff frontends/wix/chat.py @ 78:ace2af8abc5a

Added method to know which MUC are joined, and which subjects were received. - plugin xep-0045: new methods getRoomJoined and getRoomSubjects - wix: room joined are openned and subjects are set on profile plug
author Goffi <goffi@goffi.org>
date Wed, 31 Mar 2010 17:16:27 +1100
parents 1ae680f9682e
children db0a0f000e37
line wrap: on
line diff
--- a/frontends/wix/chat.py	Tue Mar 30 16:08:44 2010 +1100
+++ b/frontends/wix/chat.py	Wed Mar 31 17:16:27 2010 +1100
@@ -51,9 +51,8 @@
         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.SetMenuBar(wx.MenuBar())
         self.setType(self.type)
-
-        self.__createMenus()
         
         #events
         self.Bind(wx.EVT_CLOSE, self.onClose, self)
@@ -86,11 +85,17 @@
         if type is 'group' and not self.splitter.IsSplit():
             self.__createPresents()
             self.subjectBox.Show()
+            self.__eraseMenus()
+
         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()
         else:
             self.subjectBox.Hide()
+            self.__createMenus_O2O()
 
     def setPresents(self, nicks):
         """Set the users presents in the contact list for a group chat
@@ -129,13 +134,20 @@
         self.subjectBox.SetValue(subject)
 
 
-    def __createMenus(self):
+    def __eraseMenus(self):
+        """erase all menus"""
+        menuBar = self.GetMenuBar()
+        for i in range(menuBar.GetMenuCount()):
+            menuBar.Remove(i)
+    
+    def __createMenus_O2O(self):
+        """create menu bar for one 2 one chat"""
         info("Creating menus")
+        self.__eraseMenus()
+        menuBar = self.GetMenuBar()
         actionMenu = wx.Menu()
         actionMenu.Append(idSEND, _("&SendFile	CTRL-s"),_(" Send a file to contact"))
-        menuBar = wx.MenuBar()
         menuBar.Append(actionMenu,_("&Action"))
-        self.SetMenuBar(menuBar)
 
         #events
         wx.EVT_MENU(self, idSEND, self.onSendFile)