From: Jeremy Thurgood Date: Tue, 13 May 2014 18:09:48 +0000 (+0200) Subject: Beep if action is unavailable. X-Git-Tag: 0.1~329 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=a6261f51a91485805fe7ebd3d85ea20a257f798f;p=naja.git Beep if action is unavailable. --- 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