Primitivus: begining of management for actionResult

This commit is contained in:
Goffi 2010-07-31 00:34:05 +08:00
commit 49a5f2de2c

View file

@ -94,7 +94,7 @@ class Hand(urwid.WidgetWrap):
"""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 @@ class Table(urwid.FlowWidget):
@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 @@ class CardGame(QuickCardGame,urwid.WidgetWrap):
#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 = []