diff frontends/primitivus/card_game.py @ 153:f197b52796ee

Primitivus: begining of management for actionResult
author Goffi <goffi@goffi.org>
date Sat, 31 Jul 2010 00:34:05 +0800
parents 63d20bda5754
children 2fa58703f1b7
line wrap: on
line diff
--- a/frontends/primitivus/card_game.py	Sat Jul 31 00:32:51 2010 +0800
+++ b/frontends/primitivus/card_game.py	Sat Jul 31 00:34:05 2010 +0800
@@ -94,7 +94,7 @@
         """Return a list of selected cards"""
         _selected = []
         for wid in self.columns.widget_list:
-            if wid.__class__ == CardDisplayer and wid.isSelected():
+            if isinstance(wid, CardDisplayer) and wid.isSelected():
                 _selected.append(wid.getCard())
         return _selected
 
@@ -169,7 +169,7 @@
         @param location: where to put the card (top, left, bottom or right)
         @param card: Card to play or None"""
         assert location in ['top','left','bottom','right']
-        assert card.__class__ == Card or card == None
+        assert isinstance(card,Card) or card == None
         if [getattr(self, place) for place in ['top','left','bottom','right']].count(None) == 0:
             #If the table is full of card, we remove them
             self.top = self.left = self.bottom = self.right = None
@@ -290,7 +290,7 @@
             #it's not our turn, we ignore the click
             card_wid.select(False)
             return
-        if self.center.widget_list[1].original_widget.__class__ == Hand: #if we have a hand displayed
+        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":
                 self.to_show = []