# HG changeset patch # User Goffi # Date 1305035161 -7200 # Node ID 7bc1b3401ecb4d9e87b1bdbf2280215ba00244a2 # Parent 2b9b6b6ec7175e495a16dda53bb41c4e22b6eecc primitivus: fixed state state change in tarot game diff -r 2b9b6b6ec717 -r 7bc1b3401ecb frontends/src/primitivus/card_game.py --- a/frontends/src/primitivus/card_game.py Tue May 10 15:42:12 2011 +0200 +++ b/frontends/src/primitivus/card_game.py Tue May 10 15:46:01 2011 +0200 @@ -292,15 +292,10 @@ """A card has been played by player""" QuickCardGame.cardsPlayed(self, player, cards) self.table.putCard(self.getPlayerLocation(player),self.played[player]) + self._checkState() self.parent.host.redraw() - - ##EVENTS## - def onClick(self, hand, card_wid): - """Called when user do an action on the hand""" - if not self.state in ['play','ecart','wait_for_ecart']: - #it's not our turn, we ignore the click - card_wid.select(False) - return + + def _checkState(self): if isinstance(self.center.widget_list[1].original_widget, Hand): #if we have a hand displayed self.center.widget_list[1] = urwid.Filler(self.table) #we show again the table if self.state == "chien": @@ -312,6 +307,16 @@ self.hand.sort() self.to_show = [] self.hand_wid.update(self.hand) + + + ##EVENTS## + def onClick(self, hand, card_wid): + """Called when user do an action on the hand""" + if not self.state in ['play','ecart','wait_for_ecart']: + #it's not our turn, we ignore the click + card_wid.select(False) + return + self._checkState() if self.state == "ecart": if len(self.hand_wid.getSelected()) == 6: pop_up_widget = sat_widgets.ConfirmDialog(_("Do you put these cards in chien ?"), yes_cb=self.onEcartDone, no_cb=self.parent.host.removePopUp)