From a6261f51a91485805fe7ebd3d85ea20a257f798f Mon Sep 17 00:00:00 2001 From: Jeremy Thurgood Date: Tue, 13 May 2014 20:09:48 +0200 Subject: [PATCH] Beep if action is unavailable. --- naja/widgets/info_area.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/naja/widgets/info_area.py b/naja/widgets/info_area.py index d50c3ad..40bc75b 100644 --- a/naja/widgets/info_area.py +++ b/naja/widgets/info_area.py @@ -83,8 +83,11 @@ class InfoAreaWidget(Widget): return super(InfoAreaWidget, self).handle_event(ev) if ev.type == pgl.KEYDOWN: if ev.key in (pgl.K_RETURN, pgl.K_KP_ENTER): - self.card.actions[self.chosen].perform_action( - self.state.gameboard, self.card) + action = self.card.actions[self.chosen] + if not action.check_available(self.state.gameboard.player): + print "BEEP!" + return True + action.perform_action(self.state.gameboard, self.card) self.state.gameboard.change_mode() InvalidateTheWorld.post() return True -- 2.34.1