projects
/
naja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Better event handling.
[naja.git]
/
naja
/
widgets
/
info_area.py
diff --git
a/naja/widgets/info_area.py
b/naja/widgets/info_area.py
index a2956a0d139a4d1d1cd369fed03cccddf6769228..ad31e68f9bee50974c71f661e0b58cf61fc0d957 100644
(file)
--- 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
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
from naja.resources import resources
from naja.resources.mutators import EIGHT_BIT
@@
-88,19
+88,16
@@
class InfoAreaWidget(Widget):
action = self.card.actions[self.chosen]
if not action.check_available(self.state.gameboard.player):
print "BEEP!"
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
+ else:
+ action.perform_action(self.state.gameboard, self.card)
+ self.state.gameboard.change_mode()
+ return finish_event()
if ev.key in KEYS.UP:
if self.chosen > 0:
self.chosen -= 1
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
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)
return super(InfoAreaWidget, self).handle_event(ev)