From cd0b75b50d9db985634a4cf0b539fd327c11e325 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Tue, 13 May 2014 20:03:29 +0200 Subject: [PATCH] Dvorak support (also, we need to factor these out...) --- naja/widgets/info_area.py | 4 ++-- naja/widgets/robot.py | 6 +++--- naja/widgets/selector.py | 5 +++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/naja/widgets/info_area.py b/naja/widgets/info_area.py index 58068d7..d50c3ad 100644 --- a/naja/widgets/info_area.py +++ b/naja/widgets/info_area.py @@ -88,12 +88,12 @@ class InfoAreaWidget(Widget): self.state.gameboard.change_mode() 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 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() diff --git a/naja/widgets/robot.py b/naja/widgets/robot.py index 3518cb0..2653f81 100644 --- a/naja/widgets/robot.py +++ b/naja/widgets/robot.py @@ -42,12 +42,12 @@ class RobotWidget(Widget): if self.state.gameboard.player_mode == ACT: return super(RobotWidget, self).handle_event(ev) if ev.type == pgl.KEYDOWN: - 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.state.player.move(BITS.NORTH): self.state.gameboard.change_mode() 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.state.player.move(BITS.SOUTH): self.state.gameboard.change_mode() InvalidateTheWorld.post() @@ -57,7 +57,7 @@ class RobotWidget(Widget): self.state.gameboard.change_mode() InvalidateTheWorld.post() return True - if ev.key in (pgl.K_RIGHT, pgl.K_d): + if ev.key in (pgl.K_RIGHT, pgl.K_d, pgl.K_e): if self.state.player.move(BITS.EAST): self.state.gameboard.change_mode() InvalidateTheWorld.post() diff --git a/naja/widgets/selector.py b/naja/widgets/selector.py index 5047cf8..49cf8d8 100644 --- a/naja/widgets/selector.py +++ b/naja/widgets/selector.py @@ -22,8 +22,9 @@ class SelectorWidget(Container): def handle_event(self, ev): if ev.type == pgl.KEYDOWN: - if ev.key in (pgl.K_DOWN, pgl.K_UP, pgl.K_s, pgl.K_w): - if ev.key in (pgl.K_DOWN, pgl.K_s): + if ev.key in (pgl.K_DOWN, pgl.K_s, pgl.K_o, + pgl.K_UP, pgl.K_w, pgl.K_COMMA): + if ev.key in (pgl.K_DOWN, pgl.K_s, pgl.K_o): self.position += 1 else: self.position -= 1 -- 2.34.1