wix: Tarot panel now appear on top of groupchat window when a Tarot game is started
This commit is contained in:
parent
fe4db2366b
commit
f335cb60a7
3 changed files with 25 additions and 2 deletions
|
|
@ -251,6 +251,10 @@ class QuickApp():
|
|||
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):
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ from contact_list import ContactList
|
|||
|
||||
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 @@ class CardPanel(wx.Panel):
|
|||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ from logging import debug, info, error, warning
|
|||
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 @@ class Chat(wx.Frame, QuickChat):
|
|||
wx.Frame.__init__(self, None, title=target, pos=(0,0), size=(400,200))
|
||||
QuickChat.__init__(self, target, host, type)
|
||||
|
||||
self.splitter = wx.SplitterWindow(self, -1)
|
||||
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 @@ class Chat(wx.Frame, QuickChat):
|
|||
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 @@ class Chat(wx.Frame, QuickChat):
|
|||
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 @@ class Chat(wx.Frame, QuickChat):
|
|||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue