changeset 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 824516b247e6
children 258dfaa1035f
files browser_side/panels.py
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/browser_side/panels.py	Sat May 07 23:52:44 2011 +0200
+++ b/browser_side/panels.py	Sat May 07 23:54:21 2011 +0200
@@ -41,6 +41,7 @@
 from jid import JID
 from datetime import datetime
 from time import time
+from dialog import ContactsChooser
 
 class MenuCmd:
 
@@ -75,7 +76,10 @@
 
     def onTarotGame(self):
         #Window.alert("Tarot selected")
-        self.host.tab_panel.add(EmptyPanel(self.host), "Tarot")
+        #self.host.tab_panel.add(EmptyPanel(self.host), "Tarot")
+        def onPlayersSelected(other_players):
+            self.host.bridge.call('launchTarotGame', None, other_players)
+        ContactsChooser(self.host, onPlayersSelected, 3, text="Please select 3 other players").getContacts() 
 
     def onXiangqiGame(self):
         Window.alert("Xiangqi selected")
@@ -210,7 +214,7 @@
         if self.accept_all:
             return True
         for group in self.accepted_groups:
-            if self.host.contactPanel.isContactInGroup(group, jid):
+            if self.host.contact_panel.isContactInGroup(group, jid):
                 return True
         return False
 
@@ -306,7 +310,7 @@
     def __init__(self, host):
         self.host=host
         HorizontalPanel.__init__(self)
-        self._left = self.host.contactPanel
+        self._left = self.host.contact_panel
         self._right = Grid(1,3)
         self._right.setWidth('100%')
         self._right.setHeight('100%')
@@ -341,8 +345,8 @@
         self.setVerticalAlignment(HasAlignment.ALIGN_TOP)
 
         menu = Menu(host)
-        uni_box = host.uniBox
-        status = host.statusPanel
+        uni_box = host.uni_box
+        status = host.status_panel
         self.tab_panel = MainTabPannel(self)
         self.tab_panel.setWidth('100%')
         self.tab_panel.setHeight('100%')