comparison frontends/primitivus/chat.py @ 137:227394eb080c

Primitivus: menu are now managed and fully working - new class MenuRoller for manager different menus - Chat window now create is own menu - some menu items added for general/contact menus
author Goffi <goffi@goffi.org>
date Fri, 16 Jul 2010 20:25:06 +0800
parents 5a88ad24ccc0
children 80661755ea8d
comparison
equal deleted inserted replaced
136:d6c0fe7489af 137:227394eb080c
119 self.chat_widget.header = None 119 self.chat_widget.header = None
120 self._invalidate() 120 self._invalidate()
121 121
122 122
123 return super(Chat, self).keypress(size, key) 123 return super(Chat, self).keypress(size, key)
124
125 def getMenu(self):
126 """Return Menu bar"""
127 menu = custom_widgets.Menu(self.host.loop)
128 if self.type == 'group':
129 game = _("Game")
130 menu.addMenu(game, "Tarot", self.onTarotRequest)
131 return menu
124 132
125 def setType(self, type): 133 def setType(self, type):
126 QuickChat.setType(self, type) 134 QuickChat.setType(self, type)
127 if type == 'one2one': 135 if type == 'one2one':
128 self.historyPrint(profile=self.host.profile) 136 self.historyPrint(profile=self.host.profile)
199 assert (from_jid.__class__ == JID) 207 assert (from_jid.__class__ == JID)
200 my_jid = self.host.profiles[profile]['whoami'] 208 my_jid = self.host.profiles[profile]['whoami']
201 self.content.append(ChatText(self, timestamp or None, my_jid, from_jid, msg)) 209 self.content.append(ChatText(self, timestamp or None, my_jid, from_jid, msg))
202 self.text_list.set_focus(len(self.content)-1) 210 self.text_list.set_focus(len(self.content)-1)
203 self.host.redraw() 211 self.host.redraw()
212
213 #MENU EVENTS#
214 def onTarotRequest(self, menu):
215 if len(self.occupants) != 4:
216 self.host.debug()
217 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))
218 else:
219 self.host.bridge.tarotGameCreate(self.id, list(self.occupants), self.host.profile)