projects
/
naja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add welcome sound
[naja.git]
/
naja
/
widgets
/
info_area.py
diff --git
a/naja/widgets/info_area.py
b/naja/widgets/info_area.py
index b5231b2a5ba946030869d2c603c74da97a89deff..81cd0bb1d3c228b631093af6ea356107b9942aa9 100644
(file)
--- a/
naja/widgets/info_area.py
+++ b/
naja/widgets/info_area.py
@@
-9,6
+9,7
@@
from naja.constants import (INFO_SIZE, EIGHT_BIT_SCALE, ACT, KEYS,
from naja.events import finish_event
from naja.resources import resources
from naja.resources.mutators import EIGHT_BIT
from naja.events import finish_event
from naja.resources import resources
from naja.resources.mutators import EIGHT_BIT
+from naja.sound import sound
from naja.widgets.base import Widget
from naja.widgets.tile import BIT_MAP
from naja.widgets.base import Widget
from naja.widgets.tile import BIT_MAP
@@
-117,6
+118,7
@@
class InfoAreaWidget(Widget):
player = self.state.player
action = self.card.actions[self.chosen]
if not action.check_available(player):
player = self.state.player
action = self.card.actions[self.chosen]
if not action.check_available(player):
+ sound.play_sound('error.ogg')
print "BEEP!"
else:
action.perform_action(self.state.gameboard, self.card)
print "BEEP!"
else:
action.perform_action(self.state.gameboard, self.card)
@@
-127,9
+129,11
@@
class InfoAreaWidget(Widget):
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
+ sound.play_sound('change_action.ogg')
return finish_event()
if ev.key in KEYS.DOWN:
if self.chosen + 1 < len(self.card.actions):
return finish_event()
if ev.key in KEYS.DOWN:
if self.chosen + 1 < len(self.card.actions):
+ sound.play_sound('change_action.ogg')
self.chosen += 1
return finish_event()
return super(InfoAreaWidget, self).handle_event(ev)
self.chosen += 1
return finish_event()
return super(InfoAreaWidget, self).handle_event(ev)