X-Git-Url: https://git.ctpug.org.za/?a=blobdiff_plain;f=naja%2Fwidgets%2Finfo_area.py;h=0bb02f41aca8551d453680fdf68e363066ee8ad6;hb=963216cd4493996f5859347fe50249fb5865d6e5;hp=a2956a0d139a4d1d1cd369fed03cccddf6769228;hpb=23bc655a89f4ac16e2b17a5f359192d1d9268648;p=naja.git diff --git a/naja/widgets/info_area.py b/naja/widgets/info_area.py index a2956a0..0bb02f4 100644 --- a/naja/widgets/info_area.py +++ b/naja/widgets/info_area.py @@ -5,7 +5,7 @@ import pygame import pygame.locals as pgl from naja.constants import INFO_SIZE, EIGHT_BIT_SCALE, MOVE, ACT, KEYS -from naja.events import InvalidateTheWorld, PlayerMoved +from naja.events import PlayerMoved, finish_event from naja.resources import resources from naja.resources.mutators import EIGHT_BIT @@ -85,22 +85,21 @@ class InfoAreaWidget(Widget): return super(InfoAreaWidget, self).handle_event(ev) if ev.type == pgl.KEYDOWN: if ev.key in KEYS.SELECT: + player = self.state.gameboard.player action = self.card.actions[self.chosen] - if not action.check_available(self.state.gameboard.player): + if not action.check_available(player): print "BEEP!" - return True - action.perform_action(self.state.gameboard, self.card) - self.state.gameboard.change_mode() - InvalidateTheWorld.post() - return True + else: + action.perform_action(self.state.gameboard, self.card) + self.state.gameboard.replace_card(player.position) + self.state.gameboard.change_mode() + return finish_event() if ev.key in KEYS.UP: if self.chosen > 0: self.chosen -= 1 - InvalidateTheWorld.post() - return True + return finish_event() if ev.key in KEYS.DOWN: if self.chosen + 1 < len(self.card.actions): self.chosen += 1 - InvalidateTheWorld.post() - return True + return finish_event() return super(InfoAreaWidget, self).handle_event(ev)