diff frontends/wix/chat.py @ 86:4b5f2d55b6ac

wix: Tarot panel now appear on top of groupchat window when a Tarot game is started
author Goffi <goffi@goffi.org>
date Tue, 11 May 2010 13:06:05 +0930
parents fc7583282d40
children 66d784082930
line wrap: on
line diff
--- a/frontends/wix/chat.py	Fri May 07 17:09:30 2010 +0930
+++ b/frontends/wix/chat.py	Tue May 11 13:06:05 2010 +0930
@@ -28,6 +28,7 @@
 from tools.jid  import JID
 from quick_frontend.quick_chat import QuickChat
 from contact_list import ContactList
+from card_game import CardPanel
 
 
 idSEND           = 1
@@ -40,8 +41,12 @@
         wx.Frame.__init__(self, None, title=target, pos=(0,0), size=(400,200))
         QuickChat.__init__(self, target, host, type) 
 
+        self.sizer = wx.BoxSizer(wx.VERTICAL)
+        self.SetSizer(self.sizer)
+        
         self.splitter = wx.SplitterWindow(self, -1)
-        
+        self.sizer.Add(self.splitter, 1, flag = wx.EXPAND)
+
         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)
@@ -49,7 +54,7 @@
         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.sizer.Add(self.textBox, 0, flag=wx.EXPAND)
         self.conv_panel.SetSizer(self.conv_panel.sizer)
         self.splitter.Initialize(self.conv_panel)
         self.SetMenuBar(wx.MenuBar())
@@ -88,6 +93,7 @@
             self.__eraseMenus()
             self.__createMenus_group()
             self.historyPrint(profile=self.host.profile)
+            self.sizer.Layout()
         elif type is 'one2one' and self.splitter.IsSplit():
             self.splitter.Unsplit(self.present_panel)
             del self.present_panel
@@ -101,6 +107,16 @@
             self.__eraseMenus()
             self.__createMenus_O2O()
             self.historyPrint(profile=self.host.profile)
+    
+    def startGame(self, game_type):
+        """Configure the chat window to start a game"""
+        if game_type=="Tarot":
+            debug (_("configure chat window for Tarot game"))
+            tarot_panel = CardPanel(self)
+            self.sizer.Prepend(tarot_panel, 0, flag=wx.EXPAND)
+            self.sizer.Layout()
+            self.Fit()
+
 
     def setPresents(self, nicks):
         """Set the users presents in the contact list for a group chat