Mercurial > libervia-backend
diff frontends/wix/chat.py @ 87:66d784082930
Tarot game
- Tarot plugin: game session start, first draft
- wix: Tarot: names of players are now printed
- wix: Tarot: game session start first draft
- wix : Tarot: card can be compared and sorted
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 11 May 2010 23:58:32 +0930 |
parents | 4b5f2d55b6ac |
children | 4020931569b8 |
line wrap: on
line diff
--- a/frontends/wix/chat.py Tue May 11 13:06:05 2010 +0930 +++ b/frontends/wix/chat.py Tue May 11 23:58:32 2010 +0930 @@ -108,15 +108,21 @@ self.__createMenus_O2O() self.historyPrint(profile=self.host.profile) - def startGame(self, game_type): + def startGame(self, game_type, players): """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.tarot_panel = CardPanel(self, players, self.nick) + self.sizer.Prepend(self.tarot_panel, 0, flag=wx.EXPAND) self.sizer.Layout() self.Fit() + def getGame(self, game_type): + """Return class managing the game type""" + #TODO: check that the game is launched, and manage errors + if game_type=="Tarot": + return self.tarot_panel + def setPresents(self, nicks): """Set the users presents in the contact list for a group chat @@ -128,8 +134,7 @@ return for nick in nicks: self.present_panel.presents.replace(nick) - if nick != self.nick: - self.occupants.add(nick) + self.occupants.add(nick) def replaceUser(self, nick): @@ -139,8 +144,7 @@ error (_("[INTERNAL] trying to replace user for a non group chat window")) return self.present_panel.presents.replace(nick) - if nick != self.nick: - self.occupants.add(nick) + self.occupants.add(nick) def removeUser(self, nick): """Remove a user from the group list""" @@ -240,4 +244,8 @@ def onStartTarot(self, e): debug (_("Starting Tarot game")) warning (_("FIXME: temporary menu, must be changed")) - self.host.bridge.createTarotGame(self.id, list(self.occupants), self.host.profile) + if len(self.occupants) != 4: + err_dlg = wx.MessageDialog(self, _("You need to be exactly 4 peoples in the room to start a Tarot game"), _("Can't start game"), style = wx.OK | wx.ICON_ERROR) #FIXME: gof: temporary only, need to choose the people with who the game has to be started + err_dlg.ShowModal() + else: + self.host.bridge.createTarotGame(self.id, list(self.occupants), self.host.profile)