comparison 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
comparison
equal deleted inserted replaced
90:4020931569b8 91:39c672544593
24 import wx 24 import wx
25 import os.path, glob 25 import os.path, glob
26 import pdb 26 import pdb
27 from logging import debug, info, error 27 from logging import debug, info, error
28 from tools.jid import JID 28 from tools.jid import JID
29 from quick_frontend.quick_chat import QuickChat 29 from form import Form
30 from contact_list import ContactList
31 30
32 CARD_WIDTH = 74 31 CARD_WIDTH = 74
33 CARD_HEIGHT = 136 32 CARD_HEIGHT = 136
34 MIN_WIDTH = 950 #Minimum size of the panel 33 MIN_WIDTH = 950 #Minimum size of the panel
35 MIN_HEIGHT = 500 34 MIN_HEIGHT = 500
138 for family, value in hand: 137 for family, value in hand:
139 self.hand.append(self.cards[family, value]) 138 self.hand.append(self.cards[family, value])
140 self.hand.sort() 139 self.hand.sort()
141 self.my_turn = True 140 self.my_turn = True
142 141
142 def contratSelected(self, data):
143 """Called when the contrat has been choosed
144 @param data: form result"""
145 debug (_("Contrat choosed"))
146 print "\n\n\n===============>>>> \o/ :) :) :) ", data, "\n\n\n"
147 contrat = data[0][1]
148 self.parent.host.bridge.tarotGameContratChoosed(self.user, self.referee, contrat or 'Passe', self.parent.host.profile)
149
150 def chooseContrat(self, xml_data):
151 """Called when the player as to select hist contrat
152 @param xml_data: SàT xml representation of the form"""
153 misc = {'callback': self.contratSelected}
154 form = Form(self.parent.host, xml_data, title = _('Please choose your contrat'), options = ['NO_CANCEL'], misc = misc)
155
156
143 def _is_on_hand(self, pos_x, pos_y): 157 def _is_on_hand(self, pos_x, pos_y):
144 """Return True if the coordinate are on the hand cards""" 158 """Return True if the coordinate are on the hand cards"""
145 if pos_x > self.orig_x and pos_y > self.orig_y \ 159 if pos_x > self.orig_x and pos_y > self.orig_y \
146 and pos_x < self.orig_x + (len(self.hand)+1) * self.visible_size \ 160 and pos_x < self.orig_x + (len(self.hand)+1) * self.visible_size \
147 and pos_y < self.end_y: 161 and pos_y < self.end_y: