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
This commit is contained in:
parent
0d4f988f23
commit
d6ae995bd6
1 changed files with 133 additions and 16 deletions
|
|
@ -121,6 +121,14 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
|
||||
|
||||
return super(Chat, self).keypress(size, key)
|
||||
|
||||
def getMenu(self):
|
||||
"""Return Menu bar"""
|
||||
menu = custom_widgets.Menu(self.host.loop)
|
||||
if self.type == 'group':
|
||||
game = _("Game")
|
||||
menu.addMenu(game, "Tarot", self.onTarotRequest)
|
||||
return menu
|
||||
|
||||
def setType(self, type):
|
||||
QuickChat.setType(self, type)
|
||||
|
|
@ -201,3 +209,11 @@ class Chat(urwid.WidgetWrap, QuickChat):
|
|||
self.content.append(ChatText(self, timestamp or None, my_jid, from_jid, msg))
|
||||
self.text_list.set_focus(len(self.content)-1)
|
||||
self.host.redraw()
|
||||
|
||||
#MENU EVENTS#
|
||||
def onTarotRequest(self, menu):
|
||||
if len(self.occupants) != 4:
|
||||
self.host.debug()
|
||||
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))
|
||||
else:
|
||||
self.host.bridge.tarotGameCreate(self.id, list(self.occupants), self.host.profile)
|
||||
|
|
|
|||
Loading…
Reference in a new issue