projects
/
naja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Beep if action is unavailable.
[naja.git]
/
naja
/
widgets
/
info_area.py
diff --git
a/naja/widgets/info_area.py
b/naja/widgets/info_area.py
index 2a4d06b69e2ca5082ccd2508f4f27bcb7461212d..40bc75b662a758920a1ccc7855b12cd8571b0aae 100644
(file)
--- a/
naja/widgets/info_area.py
+++ b/
naja/widgets/info_area.py
@@
-83,17
+83,20
@@
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):
return super(InfoAreaWidget, self).handle_event(ev)
if ev.type == pgl.KEYDOWN:
if ev.key in (pgl.K_RETURN, pgl.K_KP_ENTER):
+ 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()
self.state.gameboard.change_mode()
- # FIXME: also need to signal the correct action
- # here
InvalidateTheWorld.post()
return True
InvalidateTheWorld.post()
return True
- if ev.key in (pgl.K_UP, pgl.K_w):
+ if ev.key in (pgl.K_UP, pgl.K_w
, pgl.K_COMMA
):
if self.chosen > 0:
self.chosen -= 1
InvalidateTheWorld.post()
return True
if self.chosen > 0:
self.chosen -= 1
InvalidateTheWorld.post()
return True
- if ev.key in (pgl.K_DOWN, pgl.K_s):
+ if ev.key in (pgl.K_DOWN, pgl.K_s
, pgl.K_o
):
if self.chosen + 1 < len(self.card.actions):
self.chosen += 1
InvalidateTheWorld.post()
if self.chosen + 1 < len(self.card.actions):
self.chosen += 1
InvalidateTheWorld.post()