comparison frontends/primitivus/card_game.py @ 159:2fa58703f1b7

Primitivus: notification bar, first draft - popup queue is now managed - notifications can auto-hide when nothing to show - ctrl-n show next notification Primitivus: ctrl-s allow to temporarily hide a popup Primitivus: cards in card_game now answer to mouse click Primitivus: notification is shown when invalid card is played in card_game Primitivus: SelectableText has now methods get_text and set_text
author Goffi <goffi@goffi.org>
date Wed, 04 Aug 2010 17:57:51 +0800
parents f197b52796ee
children ae50b53ff868
comparison
equal deleted inserted replaced
158:74aaf230a7c3 159:2fa58703f1b7
41 if key == ' ': 41 if key == ' ':
42 self.select(not self.__selected) 42 self.select(not self.__selected)
43 self._emit('click') 43 self._emit('click')
44 return key 44 return key
45 45
46 def mouse_event(self, size, event, button, x, y, focus):
47 if urwid.is_mouse_press(event) and button == 1:
48 self.select(not self.__selected)
49 self._emit('click')
50 return True
51
52 return False
53
46 def select(self, state=True): 54 def select(self, state=True):
47 self.__selected = state 55 self.__selected = state
48 attr,txt = self.card.getAttrText() 56 attr,txt = self.card.getAttrText()
49 if self.__selected: 57 if self.__selected:
50 attr+='_selected' 58 attr+='_selected'
273 @param phase: phase of the game 281 @param phase: phase of the game
274 @param played_cards: all the cards played 282 @param played_cards: all the cards played
275 @param invalid_cards: cards which are invalid""" 283 @param invalid_cards: cards which are invalid"""
276 QuickCardGame.invalidCards(self, phase, played_cards, invalid_cards) 284 QuickCardGame.invalidCards(self, phase, played_cards, invalid_cards)
277 self.hand_wid.update(self.hand) 285 self.hand_wid.update(self.hand)
286 self.parent.host.notify(_('Cards played are invalid !'))
278 self.parent.host.redraw() 287 self.parent.host.redraw()
279 288
280 def cardsPlayed(self, player, cards): 289 def cardsPlayed(self, player, cards):
281 """A card has been played by player""" 290 """A card has been played by player"""
282 QuickCardGame.cardsPlayed(self, player, cards) 291 QuickCardGame.cardsPlayed(self, player, cards)