Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
86:4b5f2d55b6ac | 87:66d784082930 |
---|---|
106 self.subjectBox.Hide() | 106 self.subjectBox.Hide() |
107 self.__eraseMenus() | 107 self.__eraseMenus() |
108 self.__createMenus_O2O() | 108 self.__createMenus_O2O() |
109 self.historyPrint(profile=self.host.profile) | 109 self.historyPrint(profile=self.host.profile) |
110 | 110 |
111 def startGame(self, game_type): | 111 def startGame(self, game_type, players): |
112 """Configure the chat window to start a game""" | 112 """Configure the chat window to start a game""" |
113 if game_type=="Tarot": | 113 if game_type=="Tarot": |
114 debug (_("configure chat window for Tarot game")) | 114 debug (_("configure chat window for Tarot game")) |
115 tarot_panel = CardPanel(self) | 115 self.tarot_panel = CardPanel(self, players, self.nick) |
116 self.sizer.Prepend(tarot_panel, 0, flag=wx.EXPAND) | 116 self.sizer.Prepend(self.tarot_panel, 0, flag=wx.EXPAND) |
117 self.sizer.Layout() | 117 self.sizer.Layout() |
118 self.Fit() | 118 self.Fit() |
119 | |
120 def getGame(self, game_type): | |
121 """Return class managing the game type""" | |
122 #TODO: check that the game is launched, and manage errors | |
123 if game_type=="Tarot": | |
124 return self.tarot_panel | |
119 | 125 |
120 | 126 |
121 def setPresents(self, nicks): | 127 def setPresents(self, nicks): |
122 """Set the users presents in the contact list for a group chat | 128 """Set the users presents in the contact list for a group chat |
123 @param nicks: list of nicknames | 129 @param nicks: list of nicknames |
126 if self.type != "group": | 132 if self.type != "group": |
127 error (_("[INTERNAL] trying to set presents nicks for a non group chat window")) | 133 error (_("[INTERNAL] trying to set presents nicks for a non group chat window")) |
128 return | 134 return |
129 for nick in nicks: | 135 for nick in nicks: |
130 self.present_panel.presents.replace(nick) | 136 self.present_panel.presents.replace(nick) |
131 if nick != self.nick: | 137 self.occupants.add(nick) |
132 self.occupants.add(nick) | |
133 | 138 |
134 | 139 |
135 def replaceUser(self, nick): | 140 def replaceUser(self, nick): |
136 """Add user if it is not in the group list""" | 141 """Add user if it is not in the group list""" |
137 debug (_("Replacing user %s") % nick) | 142 debug (_("Replacing user %s") % nick) |
138 if self.type != "group": | 143 if self.type != "group": |
139 error (_("[INTERNAL] trying to replace user for a non group chat window")) | 144 error (_("[INTERNAL] trying to replace user for a non group chat window")) |
140 return | 145 return |
141 self.present_panel.presents.replace(nick) | 146 self.present_panel.presents.replace(nick) |
142 if nick != self.nick: | 147 self.occupants.add(nick) |
143 self.occupants.add(nick) | |
144 | 148 |
145 def removeUser(self, nick): | 149 def removeUser(self, nick): |
146 """Remove a user from the group list""" | 150 """Remove a user from the group list""" |
147 debug(_("Removing user %s") % nick) | 151 debug(_("Removing user %s") % nick) |
148 if self.type != "group": | 152 if self.type != "group": |
238 self.host.waitProgress(id, _("File Transfer"), _("Copying %s") % os.path.basename(filename)) | 242 self.host.waitProgress(id, _("File Transfer"), _("Copying %s") % os.path.basename(filename)) |
239 | 243 |
240 def onStartTarot(self, e): | 244 def onStartTarot(self, e): |
241 debug (_("Starting Tarot game")) | 245 debug (_("Starting Tarot game")) |
242 warning (_("FIXME: temporary menu, must be changed")) | 246 warning (_("FIXME: temporary menu, must be changed")) |
243 self.host.bridge.createTarotGame(self.id, list(self.occupants), self.host.profile) | 247 if len(self.occupants) != 4: |
248 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 | |
249 err_dlg.ShowModal() | |
250 else: | |
251 self.host.bridge.createTarotGame(self.id, list(self.occupants), self.host.profile) |