From b30c9a02d652e8139dd85e394272c01fa3d8ea94 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sat, 31 Oct 2015 12:56:19 +0100
Subject: [PATCH] New client: Set up rump command DB infrastructure.

---
 client_prototype.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/client_prototype.py b/client_prototype.py
index 2ed03fd..b788d6d 100644
--- a/client_prototype.py
+++ b/client_prototype.py
@@ -174,8 +174,10 @@ def main(stdscr):
     while True:
         draw_screen()
         char = stdscr.getch()
-        if (char >= 0 and chr(char) == 'Q'):
-            exit()
+        if (char >= 0):
+            if chr(char) in commands:
+                commands[chr(char)]()
+
 
 def foo():
     winmap = ['.', 'o', '.', 'o', 'O', 'o', '.', 'o', '.', 'x', 'y', 'x']
@@ -184,6 +186,10 @@ def foo():
     return offset, size, winmap
 
 
+def command_quit():
+    exit()
+
+
 windows = [
     {"config": [1, 33], "func": foo},
     {"config": [-7, 33], "func": foo},
@@ -191,9 +197,10 @@ windows = [
     {"config": [4, 16], "func": foo},
     {"config": [0, -34], "func": foo}
 ]
-
+commands = {
+    "Q": command_quit
+}
 sep_size = 1  # Width of inter-window borders and title bars.
 stdscr = None
 screen_size = [0,0]
-
 curses.wrapper(main)
-- 
2.30.2