diff 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
line wrap: on
line diff
--- a/frontends/primitivus/card_game.py	Wed Aug 04 17:53:20 2010 +0800
+++ b/frontends/primitivus/card_game.py	Wed Aug 04 17:57:51 2010 +0800
@@ -43,6 +43,14 @@
             self._emit('click')
         return key
 
+    def mouse_event(self, size, event, button, x, y, focus):
+        if urwid.is_mouse_press(event) and button == 1:
+            self.select(not self.__selected)
+            self._emit('click')
+            return True
+        
+        return False
+    
     def select(self, state=True):
         self.__selected = state
         attr,txt = self.card.getAttrText()
@@ -275,6 +283,7 @@
         @param invalid_cards: cards which are invalid"""
         QuickCardGame.invalidCards(self, phase, played_cards, invalid_cards)
         self.hand_wid.update(self.hand)
+        self.parent.host.notify(_('Cards played are invalid !'))
         self.parent.host.redraw()
     
     def cardsPlayed(self, player, cards):