diff frontends/src/primitivus/card_game.py @ 328:809733b8d9be

Tarot game: - draw game managed - we can now play continuously \o/
author Goffi <goffi@goffi.org>
date Mon, 23 May 2011 00:46:51 +0200
parents 7bc1b3401ecb
children cf005701624b
line wrap: on
line diff
--- a/frontends/src/primitivus/card_game.py	Sun May 22 12:59:25 2011 +0200
+++ b/frontends/src/primitivus/card_game.py	Mon May 23 00:46:51 2011 +0200
@@ -274,7 +274,17 @@
     def showScores(self, xml_data, winners, loosers):
         """Called when the player as to select hist contrat
         @param xml_data: SàT xml representation of the form"""
-        form = XMLUI(self.parent.host, xml_data, title = _('You win \o/') if self.player_nick in winners else _('You loose :('), options = ['NO_CANCEL'])
+        def _new_game(ignore):
+            self.resetRound()
+            for location in ['top','left','bottom','right']:
+                self.table.putCard(location, None)
+            self.parent.host.redraw()
+            self.parent.host.bridge.tarotGameReady(self.player_nick, self.referee, profile_key = self.parent.host.profile)
+        if not winners and not loosers:
+            title = _("Draw game")
+        else:
+            title = _('You win \o/') if self.player_nick in winners else _('You loose :(')
+        form = XMLUI(self.parent.host, xml_data, title = title, options = ['NO_CANCEL'], misc={'callback':_new_game})
         form.show()
 
     def invalidCards(self, phase, played_cards, invalid_cards):