diff frontends/wix/card_game.py @ 91:39c672544593

Tarot: bidding phase - quick_app: command line is now parsed, "profile" option allow to select it - xml_tools: list-single is now managed - plugin tarot: method and signal to manage contract (contrat): tarotChooseContrat & tarotGameContratChoosed - wix: Q&D Form hack to manage more generic form (not only registration), used to show contract selection form
author Goffi <goffi@goffi.org>
date Thu, 27 May 2010 19:26:19 +0930
parents 4020931569b8
children 2503de7fb4c7
line wrap: on
line diff
--- a/frontends/wix/card_game.py	Sun May 23 16:39:05 2010 +0930
+++ b/frontends/wix/card_game.py	Thu May 27 19:26:19 2010 +0930
@@ -26,8 +26,7 @@
 import pdb
 from logging import debug, info, error
 from tools.jid  import JID
-from quick_frontend.quick_chat import QuickChat
-from contact_list import ContactList
+from form import Form
 
 CARD_WIDTH = 74
 CARD_HEIGHT = 136
@@ -140,6 +139,21 @@
         self.hand.sort()
         self.my_turn = True
 
+    def contratSelected(self, data):
+        """Called when the contrat has been choosed
+        @param data: form result"""
+        debug (_("Contrat choosed"))
+        print "\n\n\n===============>>>> \o/ :) :) :) ", data, "\n\n\n"
+        contrat = data[0][1]
+        self.parent.host.bridge.tarotGameContratChoosed(self.user, self.referee, contrat or 'Passe', self.parent.host.profile)
+
+    def chooseContrat(self, xml_data):
+        """Called when the player as to select hist contrat
+        @param xml_data: SàT xml representation of the form"""
+        misc = {'callback': self.contratSelected}
+        form = Form(self.parent.host, xml_data, title = _('Please choose your contrat'), options = ['NO_CANCEL'], misc = misc)
+
+
     def _is_on_hand(self, pos_x, pos_y):
         """Return True if the coordinate are on the hand cards"""
         if pos_x > self.orig_x and pos_y > self.orig_y \