Mercurial > libervia-web
comparison browser_side/panels.py @ 27:d89982865c57
browser side: ContactsChooser is now used to ask for 3 others players when tarot game is launched + names refactoring
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 07 May 2011 23:54:21 +0200 |
parents | 0ce2a57b34ca |
children | e70521e6d803 |
comparison
equal
deleted
inserted
replaced
26:824516b247e6 | 27:d89982865c57 |
---|---|
39 from pyjamas.dnd import makeDraggable | 39 from pyjamas.dnd import makeDraggable |
40 from pyjamas.ui.DragWidget import DragWidget, DragContainer | 40 from pyjamas.ui.DragWidget import DragWidget, DragContainer |
41 from jid import JID | 41 from jid import JID |
42 from datetime import datetime | 42 from datetime import datetime |
43 from time import time | 43 from time import time |
44 from dialog import ContactsChooser | |
44 | 45 |
45 class MenuCmd: | 46 class MenuCmd: |
46 | 47 |
47 def __init__(self, object, handler): | 48 def __init__(self, object, handler): |
48 self._object = object | 49 self._object = object |
73 def onProperties(self): | 74 def onProperties(self): |
74 Window.alert("Properties selected") | 75 Window.alert("Properties selected") |
75 | 76 |
76 def onTarotGame(self): | 77 def onTarotGame(self): |
77 #Window.alert("Tarot selected") | 78 #Window.alert("Tarot selected") |
78 self.host.tab_panel.add(EmptyPanel(self.host), "Tarot") | 79 #self.host.tab_panel.add(EmptyPanel(self.host), "Tarot") |
80 def onPlayersSelected(other_players): | |
81 self.host.bridge.call('launchTarotGame', None, other_players) | |
82 ContactsChooser(self.host, onPlayersSelected, 3, text="Please select 3 other players").getContacts() | |
79 | 83 |
80 def onXiangqiGame(self): | 84 def onXiangqiGame(self): |
81 Window.alert("Xiangqi selected") | 85 Window.alert("Xiangqi selected") |
82 | 86 |
83 class DropCell(DropWidget): | 87 class DropCell(DropWidget): |
208 @param jid: jid | 212 @param jid: jid |
209 @return: True if the jid is accepted""" | 213 @return: True if the jid is accepted""" |
210 if self.accept_all: | 214 if self.accept_all: |
211 return True | 215 return True |
212 for group in self.accepted_groups: | 216 for group in self.accepted_groups: |
213 if self.host.contactPanel.isContactInGroup(group, jid): | 217 if self.host.contact_panel.isContactInGroup(group, jid): |
214 return True | 218 return True |
215 return False | 219 return False |
216 | 220 |
217 class StatusPanel(HTMLPanel, ClickHandler): | 221 class StatusPanel(HTMLPanel, ClickHandler): |
218 def __init__(self, host, status=''): | 222 def __init__(self, host, status=''): |
304 class MainDiscussionPannel(HorizontalPanel): | 308 class MainDiscussionPannel(HorizontalPanel): |
305 | 309 |
306 def __init__(self, host): | 310 def __init__(self, host): |
307 self.host=host | 311 self.host=host |
308 HorizontalPanel.__init__(self) | 312 HorizontalPanel.__init__(self) |
309 self._left = self.host.contactPanel | 313 self._left = self.host.contact_panel |
310 self._right = Grid(1,3) | 314 self._right = Grid(1,3) |
311 self._right.setWidth('100%') | 315 self._right.setWidth('100%') |
312 self._right.setHeight('100%') | 316 self._right.setHeight('100%') |
313 self.add(self._left) | 317 self.add(self._left) |
314 self.setCellWidth(self._left, "15%") | 318 self.setCellWidth(self._left, "15%") |
339 | 343 |
340 self.setHorizontalAlignment(HasAlignment.ALIGN_LEFT) | 344 self.setHorizontalAlignment(HasAlignment.ALIGN_LEFT) |
341 self.setVerticalAlignment(HasAlignment.ALIGN_TOP) | 345 self.setVerticalAlignment(HasAlignment.ALIGN_TOP) |
342 | 346 |
343 menu = Menu(host) | 347 menu = Menu(host) |
344 uni_box = host.uniBox | 348 uni_box = host.uni_box |
345 status = host.statusPanel | 349 status = host.status_panel |
346 self.tab_panel = MainTabPannel(self) | 350 self.tab_panel = MainTabPannel(self) |
347 self.tab_panel.setWidth('100%') | 351 self.tab_panel.setWidth('100%') |
348 self.tab_panel.setHeight('100%') | 352 self.tab_panel.setHeight('100%') |
349 self.discuss_panel = MainDiscussionPannel(self.host) | 353 self.discuss_panel = MainDiscussionPannel(self.host) |
350 self.discuss_panel.setWidth('100%') | 354 self.discuss_panel.setWidth('100%') |