comparison 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
comparison
equal deleted inserted replaced
85:fc7583282d40 86:4b5f2d55b6ac
26 import pdb 26 import pdb
27 from logging import debug, info, error, warning 27 from logging import debug, info, error, warning
28 from tools.jid import JID 28 from tools.jid import JID
29 from quick_frontend.quick_chat import QuickChat 29 from quick_frontend.quick_chat import QuickChat
30 from contact_list import ContactList 30 from contact_list import ContactList
31 from card_game import CardPanel
31 32
32 33
33 idSEND = 1 34 idSEND = 1
34 idTAROT = 2 35 idTAROT = 2
35 36
38 39
39 def __init__(self, target, host, type='one2one'): 40 def __init__(self, target, host, type='one2one'):
40 wx.Frame.__init__(self, None, title=target, pos=(0,0), size=(400,200)) 41 wx.Frame.__init__(self, None, title=target, pos=(0,0), size=(400,200))
41 QuickChat.__init__(self, target, host, type) 42 QuickChat.__init__(self, target, host, type)
42 43
44 self.sizer = wx.BoxSizer(wx.VERTICAL)
45 self.SetSizer(self.sizer)
46
43 self.splitter = wx.SplitterWindow(self, -1) 47 self.splitter = wx.SplitterWindow(self, -1)
44 48 self.sizer.Add(self.splitter, 1, flag = wx.EXPAND)
49
45 self.conv_panel = wx.Panel(self.splitter) 50 self.conv_panel = wx.Panel(self.splitter)
46 self.conv_panel.sizer = wx.BoxSizer(wx.VERTICAL) 51 self.conv_panel.sizer = wx.BoxSizer(wx.VERTICAL)
47 self.subjectBox = wx.TextCtrl(self.conv_panel, -1, style = wx.TE_READONLY) 52 self.subjectBox = wx.TextCtrl(self.conv_panel, -1, style = wx.TE_READONLY)
48 self.chatWindow = wx.TextCtrl(self.conv_panel, -1, style = wx.TE_MULTILINE | wx.TE_RICH | wx.TE_READONLY) 53 self.chatWindow = wx.TextCtrl(self.conv_panel, -1, style = wx.TE_MULTILINE | wx.TE_RICH | wx.TE_READONLY)
49 self.textBox = wx.TextCtrl(self.conv_panel, -1, style = wx.TE_PROCESS_ENTER) 54 self.textBox = wx.TextCtrl(self.conv_panel, -1, style = wx.TE_PROCESS_ENTER)
50 self.conv_panel.sizer.Add(self.subjectBox, flag=wx.EXPAND) 55 self.conv_panel.sizer.Add(self.subjectBox, flag=wx.EXPAND)
51 self.conv_panel.sizer.Add(self.chatWindow, 1, flag=wx.EXPAND) 56 self.conv_panel.sizer.Add(self.chatWindow, 1, flag=wx.EXPAND)
52 self.conv_panel.sizer.Add(self.textBox, flag=wx.EXPAND) 57 self.conv_panel.sizer.Add(self.textBox, 0, flag=wx.EXPAND)
53 self.conv_panel.SetSizer(self.conv_panel.sizer) 58 self.conv_panel.SetSizer(self.conv_panel.sizer)
54 self.splitter.Initialize(self.conv_panel) 59 self.splitter.Initialize(self.conv_panel)
55 self.SetMenuBar(wx.MenuBar()) 60 self.SetMenuBar(wx.MenuBar())
56 61
57 #events 62 #events
86 self.__createPresents() 91 self.__createPresents()
87 self.subjectBox.Show() 92 self.subjectBox.Show()
88 self.__eraseMenus() 93 self.__eraseMenus()
89 self.__createMenus_group() 94 self.__createMenus_group()
90 self.historyPrint(profile=self.host.profile) 95 self.historyPrint(profile=self.host.profile)
96 self.sizer.Layout()
91 elif type is 'one2one' and self.splitter.IsSplit(): 97 elif type is 'one2one' and self.splitter.IsSplit():
92 self.splitter.Unsplit(self.present_panel) 98 self.splitter.Unsplit(self.present_panel)
93 del self.present_panel 99 del self.present_panel
94 self.GetMenuBar().Show() 100 self.GetMenuBar().Show()
95 self.subjectBox.Hide() 101 self.subjectBox.Hide()
99 else: 105 else:
100 self.subjectBox.Hide() 106 self.subjectBox.Hide()
101 self.__eraseMenus() 107 self.__eraseMenus()
102 self.__createMenus_O2O() 108 self.__createMenus_O2O()
103 self.historyPrint(profile=self.host.profile) 109 self.historyPrint(profile=self.host.profile)
110
111 def startGame(self, game_type):
112 """Configure the chat window to start a game"""
113 if game_type=="Tarot":
114 debug (_("configure chat window for Tarot game"))
115 tarot_panel = CardPanel(self)
116 self.sizer.Prepend(tarot_panel, 0, flag=wx.EXPAND)
117 self.sizer.Layout()
118 self.Fit()
119
104 120
105 def setPresents(self, nicks): 121 def setPresents(self, nicks):
106 """Set the users presents in the contact list for a group chat 122 """Set the users presents in the contact list for a group chat
107 @param nicks: list of nicknames 123 @param nicks: list of nicknames
108 """ 124 """