Mercurial > libervia-backend
changeset 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 (2010-05-11) |
parents | fc7583282d40 |
children | 66d784082930 |
files | frontends/quick_frontend/quick_app.py frontends/wix/card_game.py frontends/wix/chat.py |
diffstat | 3 files changed, 25 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/quick_frontend/quick_app.py Fri May 07 17:09:30 2010 +0930 +++ b/frontends/quick_frontend/quick_app.py Tue May 11 13:06:05 2010 +0930 @@ -251,6 +251,10 @@ if not self.__check_profile(profile): return print "Tarot Game Started \o/" + if self.chat_wins.has_key(room_jid): + self.chat_wins[room_jid].startGame("Tarot") + debug (_("new Tarot game started in room [%(room_jid)s]") % {'room_jid':room_jid}) + def subscribe(self, type, raw_jid, profile):
--- a/frontends/wix/card_game.py Fri May 07 17:09:30 2010 +0930 +++ b/frontends/wix/card_game.py Tue May 11 13:06:05 2010 +0930 @@ -32,6 +32,8 @@ CARD_WIDTH = 74 CARD_HEIGHT = 136 +MIN_WIDTH = 950 #Minimum size of the panel +MIN_HEIGHT = 500 class Card(): """This class is used to represent a card, graphically and logically""" @@ -59,6 +61,7 @@ def __init__(self, parent): wx.Panel.__init__(self, parent) + self.SetMinSize(wx.Size(MIN_WIDTH, MIN_HEIGHT)) self.load_cards("/home/goffi/dev/divers/images/cards/") self.selected = None #contain the card to highlight self.hand_size = 13 #number of cards in a hand
--- 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