comparison frontends/primitivus/chat.py @ 176:a50953ac6191

Primitivus: send_file first draft - a new dialog for choosing a file is work in progress
author Goffi <goffi@goffi.org>
date Thu, 12 Aug 2010 23:09:31 +0800
parents f197b52796ee
children fdb961f27ae9
comparison
equal deleted inserted replaced
175:8537df794f74 176:a50953ac6191
24 from quick_frontend.quick_chat import QuickChat 24 from quick_frontend.quick_chat import QuickChat
25 import custom_widgets 25 import custom_widgets
26 import time 26 import time
27 from tools.jid import JID 27 from tools.jid import JID
28 from card_game import CardGame 28 from card_game import CardGame
29 from files_management import FileDialog
29 30
30 31
31 class ChatText(urwid.FlowWidget): 32 class ChatText(urwid.FlowWidget):
32 """Manage the printing of chat message""" 33 """Manage the printing of chat message"""
33 34
129 """Return Menu bar""" 130 """Return Menu bar"""
130 menu = custom_widgets.Menu(self.host.loop) 131 menu = custom_widgets.Menu(self.host.loop)
131 if self.type == 'group': 132 if self.type == 'group':
132 game = _("Game") 133 game = _("Game")
133 menu.addMenu(game, "Tarot", self.onTarotRequest) 134 menu.addMenu(game, "Tarot", self.onTarotRequest)
135 elif self.type == 'one2one':
136 menu.addMenu(_("Action"), _("Send file"), self.onSendFileRequest)
134 return menu 137 return menu
135 138
136 def setType(self, type): 139 def setType(self, type):
137 QuickChat.setType(self, type) 140 QuickChat.setType(self, type)
138 if type == 'one2one': 141 if type == 'one2one':
248 def onTarotRequest(self, menu): 251 def onTarotRequest(self, menu):
249 if len(self.occupants) != 4: 252 if len(self.occupants) != 4:
250 self.host.showPopUp(custom_widgets.Alert(_("Can't start game"), _("You need to be exactly 4 peoples in the room to start a Tarot game"), ok_cb=self.host.removePopUp)) 253 self.host.showPopUp(custom_widgets.Alert(_("Can't start game"), _("You need to be exactly 4 peoples in the room to start a Tarot game"), ok_cb=self.host.removePopUp))
251 else: 254 else:
252 self.host.bridge.tarotGameCreate(self.id, list(self.occupants), self.host.profile) 255 self.host.bridge.tarotGameCreate(self.id, list(self.occupants), self.host.profile)
256
257 def onSendFileRequest(self, menu):
258 dialog = FileDialog()
259 self.host.showPopUp(dialog, 80, 80)
260