From: Christian Heller Date: Sat, 31 Oct 2015 11:56:19 +0000 (+0100) Subject: New client: Set up rump command DB infrastructure. X-Git-Tag: tce~265 X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/day_todos?a=commitdiff_plain;h=b30c9a02d652e8139dd85e394272c01fa3d8ea94;p=plomrogue New client: Set up rump command DB infrastructure. --- 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)