Mercurial > libervia-backend
annotate frontends/src/wix/chat.py @ 359:eb9d33ba4e36
bridge: templates' constants can now be overrided
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 06 Jun 2011 18:35:30 +0200 |
parents | 1a990a88bff2 |
children | 141eeb7cd9e6 |
rev | line source |
---|---|
0 | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | |
3 | |
4 """ | |
5 wix: a SAT frontend | |
228 | 6 Copyright (C) 2009, 2010, 2011 Jérôme Poisson (goffi@goffi.org) |
0 | 7 |
8 This program is free software: you can redistribute it and/or modify | |
9 it under the terms of the GNU General Public License as published by | |
10 the Free Software Foundation, either version 3 of the License, or | |
11 (at your option) any later version. | |
12 | |
13 This program is distributed in the hope that it will be useful, | |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 GNU General Public License for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 """ | |
21 | |
22 | |
23 | |
24 import wx | |
25 import os.path | |
122
29998cd0ed8d
wix: time is now printed in chat window
Goffi <goffi@goffi.org>
parents:
120
diff
changeset
|
26 import time |
0 | 27 import pdb |
85 | 28 from logging import debug, info, error, warning |
225
fd9b7834d98a
distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
223
diff
changeset
|
29 from sat.tools.jid import JID |
227 | 30 from sat_frontends.quick_frontend.quick_chat import QuickChat |
31 from sat_frontends.wix.contact_list import ContactList | |
32 from sat_frontends.wix.card_game import CardPanel | |
0 | 33 |
34 | |
35 idSEND = 1 | |
85 | 36 idTAROT = 2 |
0 | 37 |
38 class Chat(wx.Frame, QuickChat): | |
39 """The chat Window for one to one conversations""" | |
40 | |
72 | 41 def __init__(self, target, host, type='one2one'): |
42 wx.Frame.__init__(self, None, title=target, pos=(0,0), size=(400,200)) | |
43 QuickChat.__init__(self, target, host, type) | |
0 | 44 |
86
4b5f2d55b6ac
wix: Tarot panel now appear on top of groupchat window when a Tarot game is started
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
45 self.sizer = wx.BoxSizer(wx.VERTICAL) |
4b5f2d55b6ac
wix: Tarot panel now appear on top of groupchat window when a Tarot game is started
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
46 self.SetSizer(self.sizer) |
4b5f2d55b6ac
wix: Tarot panel now appear on top of groupchat window when a Tarot game is started
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
47 |
72 | 48 self.splitter = wx.SplitterWindow(self, -1) |
86
4b5f2d55b6ac
wix: Tarot panel now appear on top of groupchat window when a Tarot game is started
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
49 self.sizer.Add(self.splitter, 1, flag = wx.EXPAND) |
4b5f2d55b6ac
wix: Tarot panel now appear on top of groupchat window when a Tarot game is started
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
50 |
72 | 51 self.conv_panel = wx.Panel(self.splitter) |
52 self.conv_panel.sizer = wx.BoxSizer(wx.VERTICAL) | |
76 | 53 self.subjectBox = wx.TextCtrl(self.conv_panel, -1, style = wx.TE_READONLY) |
72 | 54 self.chatWindow = wx.TextCtrl(self.conv_panel, -1, style = wx.TE_MULTILINE | wx.TE_RICH | wx.TE_READONLY) |
55 self.textBox = wx.TextCtrl(self.conv_panel, -1, style = wx.TE_PROCESS_ENTER) | |
76 | 56 self.conv_panel.sizer.Add(self.subjectBox, flag=wx.EXPAND) |
72 | 57 self.conv_panel.sizer.Add(self.chatWindow, 1, flag=wx.EXPAND) |
86
4b5f2d55b6ac
wix: Tarot panel now appear on top of groupchat window when a Tarot game is started
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
58 self.conv_panel.sizer.Add(self.textBox, 0, flag=wx.EXPAND) |
72 | 59 self.conv_panel.SetSizer(self.conv_panel.sizer) |
60 self.splitter.Initialize(self.conv_panel) | |
78
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
61 self.SetMenuBar(wx.MenuBar()) |
0 | 62 |
63 #events | |
64 self.Bind(wx.EVT_CLOSE, self.onClose, self) | |
65 self.Bind(wx.EVT_TEXT_ENTER, self.onEnterPressed, self.textBox) | |
66 | |
67 #fonts | |
68 self.font={} | |
69 self.font["points"] = self.chatWindow.GetFont().GetPointSize() | |
70 self.font["family"] = self.chatWindow.GetFont().GetFamily() | |
71 | |
79 | 72 |
0 | 73 #misc |
122
29998cd0ed8d
wix: time is now printed in chat window
Goffi <goffi@goffi.org>
parents:
120
diff
changeset
|
74 self.day_change = time.strptime(time.strftime("%a %b %d 00:00:00 %Y")) #struct_time of day changing time |
29998cd0ed8d
wix: time is now printed in chat window
Goffi <goffi@goffi.org>
parents:
120
diff
changeset
|
75 self.setType(self.type) |
0 | 76 self.textBox.SetFocus() |
77 self.Hide() #We hide because of the show toggle | |
72 | 78 |
79 def __createPresents(self): | |
80 """Create a list of present people in a group chat""" | |
81 self.present_panel = wx.Panel(self.splitter) | |
82 self.present_panel.sizer = wx.BoxSizer(wx.VERTICAL) | |
83 self.present_panel.SetBackgroundColour(wx.BLUE) | |
84 self.present_panel.presents = ContactList(self.present_panel, self.host, type='nicks') | |
85 self.present_panel.presents.SetMinSize(wx.Size(80,20)) | |
86 self.present_panel.sizer.Add(self.present_panel.presents, 1, wx.EXPAND) | |
87 self.present_panel.SetSizer(self.present_panel.sizer) | |
88 self.splitter.SplitVertically(self.present_panel, self.conv_panel, 80) | |
89 | |
90 def setType(self, type): | |
91 QuickChat.setType(self, type) | |
92 if type is 'group' and not self.splitter.IsSplit(): | |
93 self.__createPresents() | |
76 | 94 self.subjectBox.Show() |
78
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
95 self.__eraseMenus() |
85 | 96 self.__createMenus_group() |
86
4b5f2d55b6ac
wix: Tarot panel now appear on top of groupchat window when a Tarot game is started
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
97 self.sizer.Layout() |
72 | 98 elif type is 'one2one' and self.splitter.IsSplit(): |
99 self.splitter.Unsplit(self.present_panel) | |
100 del self.present_panel | |
78
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
101 self.GetMenuBar().Show() |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
102 self.subjectBox.Hide() |
85 | 103 self.__eraseMenus() |
78
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
104 self.__createMenus_O2O() |
79 | 105 self.nick = None |
76 | 106 else: |
107 self.subjectBox.Hide() | |
85 | 108 self.__eraseMenus() |
78
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
109 self.__createMenus_O2O() |
79 | 110 self.historyPrint(profile=self.host.profile) |
86
4b5f2d55b6ac
wix: Tarot panel now appear on top of groupchat window when a Tarot game is started
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
111 |
90 | 112 def startGame(self, game_type, referee, players): |
86
4b5f2d55b6ac
wix: Tarot panel now appear on top of groupchat window when a Tarot game is started
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
113 """Configure the chat window to start a game""" |
4b5f2d55b6ac
wix: Tarot panel now appear on top of groupchat window when a Tarot game is started
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
114 if game_type=="Tarot": |
4b5f2d55b6ac
wix: Tarot panel now appear on top of groupchat window when a Tarot game is started
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
115 debug (_("configure chat window for Tarot game")) |
90 | 116 self.tarot_panel = CardPanel(self, referee, players, self.nick) |
87 | 117 self.sizer.Prepend(self.tarot_panel, 0, flag=wx.EXPAND) |
86
4b5f2d55b6ac
wix: Tarot panel now appear on top of groupchat window when a Tarot game is started
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
118 self.sizer.Layout() |
4b5f2d55b6ac
wix: Tarot panel now appear on top of groupchat window when a Tarot game is started
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
119 self.Fit() |
321
1a990a88bff2
wix: force updating of splitterWindow in ChatWindow (needed when Tarot game is launched)
Goffi <goffi@goffi.org>
parents:
276
diff
changeset
|
120 self.splitter.UpdateSize() |
86
4b5f2d55b6ac
wix: Tarot panel now appear on top of groupchat window when a Tarot game is started
Goffi <goffi@goffi.org>
parents:
85
diff
changeset
|
121 |
87 | 122 def getGame(self, game_type): |
123 """Return class managing the game type""" | |
124 #TODO: check that the game is launched, and manage errors | |
125 if game_type=="Tarot": | |
126 return self.tarot_panel | |
127 | |
85 | 128 |
72 | 129 def setPresents(self, nicks): |
130 """Set the users presents in the contact list for a group chat | |
131 @param nicks: list of nicknames | |
132 """ | |
120 | 133 QuickChat.setPresents(self, nicks) |
72 | 134 for nick in nicks: |
85 | 135 self.present_panel.presents.replace(nick) |
75 | 136 |
137 def replaceUser(self, nick): | |
138 """Add user if it is not in the group list""" | |
139 debug (_("Replacing user %s") % nick) | |
140 if self.type != "group": | |
141 error (_("[INTERNAL] trying to replace user for a non group chat window")) | |
142 return | |
120 | 143 QuickChat.replaceUser(self, nick) |
122
29998cd0ed8d
wix: time is now printed in chat window
Goffi <goffi@goffi.org>
parents:
120
diff
changeset
|
144 self.present_panel.presents.replace(nick) |
120 | 145 |
75 | 146 def removeUser(self, nick): |
147 """Remove a user from the group list""" | |
120 | 148 QuickChat.removeUser(self, nick) |
75 | 149 self.present_panel.presents.remove(nick) |
150 | |
76 | 151 def setSubject(self, subject): |
152 """Set title for a group chat""" | |
120 | 153 QuickChat.setSubject(self, subject) |
76 | 154 self.subjectBox.SetValue(subject) |
75 | 155 |
78
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
156 def __eraseMenus(self): |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
157 """erase all menus""" |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
158 menuBar = self.GetMenuBar() |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
159 for i in range(menuBar.GetMenuCount()): |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
160 menuBar.Remove(i) |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
161 |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
162 def __createMenus_O2O(self): |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
163 """create menu bar for one 2 one chat""" |
0 | 164 info("Creating menus") |
78
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
165 self.__eraseMenus() |
ace2af8abc5a
Added method to know which MUC are joined, and which subjects were received.
Goffi <goffi@goffi.org>
parents:
77
diff
changeset
|
166 menuBar = self.GetMenuBar() |
0 | 167 actionMenu = wx.Menu() |
70 | 168 actionMenu.Append(idSEND, _("&SendFile CTRL-s"),_(" Send a file to contact")) |
169 menuBar.Append(actionMenu,_("&Action")) | |
0 | 170 |
171 #events | |
172 wx.EVT_MENU(self, idSEND, self.onSendFile) | |
173 | |
85 | 174 def __createMenus_group(self): |
175 """create menu bar for group chat""" | |
176 info("Creating menus") | |
177 self.__eraseMenus() | |
178 menuBar = self.GetMenuBar() | |
179 actionMenu = wx.Menu() | |
180 actionMenu.Append(idTAROT, _("Start &Tarot game CTRL-t"),_(" Start a Tarot card game")) #tmp | |
181 menuBar.Append(actionMenu,_("&Games")) | |
182 | |
183 #events | |
184 wx.EVT_MENU(self, idTAROT, self.onStartTarot) | |
185 | |
0 | 186 def __del__(self): |
187 wx.Frame.__del__(self) | |
188 | |
189 def onClose(self, event): | |
190 """Close event: we only hide the frame.""" | |
191 event.Veto() | |
192 self.Hide() | |
193 | |
194 def onEnterPressed(self, event): | |
195 """Behaviour when enter pressed in send line.""" | |
77
1ae680f9682e
wix: MUC groupchat management + short nick shown in chat window instead of full jid when possible
Goffi <goffi@goffi.org>
parents:
76
diff
changeset
|
196 self.host.bridge.sendMessage(self.target.short if self.type=='group' else self.target, |
1ae680f9682e
wix: MUC groupchat management + short nick shown in chat window instead of full jid when possible
Goffi <goffi@goffi.org>
parents:
76
diff
changeset
|
197 event.GetString(), |
276
a00e87d48213
bridge, bridge constructor: fixed mix stuff
Goffi <goffi@goffi.org>
parents:
228
diff
changeset
|
198 mess_type = "groupchat" if self.type=='group' else "chat", |
77
1ae680f9682e
wix: MUC groupchat management + short nick shown in chat window instead of full jid when possible
Goffi <goffi@goffi.org>
parents:
76
diff
changeset
|
199 profile_key=self.host.profile) |
0 | 200 self.textBox.Clear() |
201 | |
190
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
202 def __blink(self): |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
203 """Do wizzz and buzzz to show window to user or |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
204 at least inform him of something new""" |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
205 #TODO: use notification system |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
206 if not self.IsActive(): |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
207 self.RequestUserAttention() |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
208 if not self.IsShown(): |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
209 self.Show() |
0 | 210 |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
211 def printMessage(self, from_jid, msg, profile, timestamp=""): |
0 | 212 """Print the message with differents colors depending on where it comes from.""" |
190
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
213 try: |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
214 jid,nick,mymess = QuickChat.printMessage(self, from_jid, msg, profile, timestamp) |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
215 except TypeError: |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
216 return |
79 | 217 print "printMessage, jid=",jid,"type=",self.type |
122
29998cd0ed8d
wix: time is now printed in chat window
Goffi <goffi@goffi.org>
parents:
120
diff
changeset
|
218 _font_bold = wx.Font(self.font["points"], self.font["family"], wx.NORMAL, wx.BOLD) |
29998cd0ed8d
wix: time is now printed in chat window
Goffi <goffi@goffi.org>
parents:
120
diff
changeset
|
219 _font_normal = wx.Font(self.font["points"], self.font["family"], wx.NORMAL, wx.NORMAL) |
29998cd0ed8d
wix: time is now printed in chat window
Goffi <goffi@goffi.org>
parents:
120
diff
changeset
|
220 _font_italic = wx.Font(self.font["points"], self.font["family"], wx.ITALIC if mymess else wx.NORMAL, wx.NORMAL) |
123
34766e0cf970
wix: chat: date is now printed in grey
Goffi <goffi@goffi.org>
parents:
122
diff
changeset
|
221 self.chatWindow.SetDefaultStyle(wx.TextAttr("GREY", font=_font_normal)) |
122
29998cd0ed8d
wix: time is now printed in chat window
Goffi <goffi@goffi.org>
parents:
120
diff
changeset
|
222 msg_time = time.localtime(timestamp or None) |
29998cd0ed8d
wix: time is now printed in chat window
Goffi <goffi@goffi.org>
parents:
120
diff
changeset
|
223 time_format = "%c" if msg_time < self.day_change else "%H:%M" #if the message was sent before today, we print the full date |
29998cd0ed8d
wix: time is now printed in chat window
Goffi <goffi@goffi.org>
parents:
120
diff
changeset
|
224 self.chatWindow.AppendText("[%s]" % time.strftime(time_format, msg_time )) |
29998cd0ed8d
wix: time is now printed in chat window
Goffi <goffi@goffi.org>
parents:
120
diff
changeset
|
225 self.chatWindow.SetDefaultStyle(wx.TextAttr( "BLACK" if mymess else "BLUE", font=_font_bold)) |
77
1ae680f9682e
wix: MUC groupchat management + short nick shown in chat window instead of full jid when possible
Goffi <goffi@goffi.org>
parents:
76
diff
changeset
|
226 self.chatWindow.AppendText("[%s] " % nick) |
122
29998cd0ed8d
wix: time is now printed in chat window
Goffi <goffi@goffi.org>
parents:
120
diff
changeset
|
227 self.chatWindow.SetDefaultStyle(wx.TextAttr("BLACK", font=_font_italic)) |
0 | 228 self.chatWindow.AppendText("%s\n" % msg) |
229 if not mymess: | |
190
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
230 self.__blink() |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
231 |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
232 def printInfo(self, msg, type='normal'): |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
233 """Print general info |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
234 @param msg: message to print |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
235 @type: one of: |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
236 normal: general info like "toto has joined the room" |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
237 me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist" |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
238 """ |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
239 _font_bold = wx.Font(self.font["points"], self.font["family"], wx.NORMAL, wx.BOLD) |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
240 _font_normal = wx.Font(self.font["points"], self.font["family"], wx.NORMAL, wx.NORMAL) |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
241 self.chatWindow.SetDefaultStyle(wx.TextAttr("BLACK", font=_font_bold if type == 'normal' else _font_normal)) |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
242 self.chatWindow.AppendText("%s\n" % msg) |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
243 if type=="me": |
31632472e857
quick_frontend, wix, primitivus: informations in chat window
Goffi <goffi@goffi.org>
parents:
183
diff
changeset
|
244 self.__blink() |
0 | 245 |
246 ### events ### | |
247 | |
248 def onSendFile(self, e): | |
70 | 249 debug(_("Send File")) |
250 filename = wx.FileSelector(_("Choose a file to send"), flags = wx.FD_FILE_MUST_EXIST) | |
0 | 251 if filename: |
70 | 252 debug(_("filename: %s"),filename) |
72 | 253 full_jid = self.host.CM.get_full(self.target) |
0 | 254 id = self.host.bridge.sendFile(full_jid, filename) |
70 | 255 self.host.waitProgress(id, _("File Transfer"), _("Copying %s") % os.path.basename(filename)) |
0 | 256 |
85 | 257 def onStartTarot(self, e): |
258 debug (_("Starting Tarot game")) | |
259 warning (_("FIXME: temporary menu, must be changed")) | |
87 | 260 if len(self.occupants) != 4: |
261 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 | |
262 err_dlg.ShowModal() | |
263 else: | |
90 | 264 self.host.bridge.tarotGameCreate(self.id, list(self.occupants), self.host.profile) |