home
·
contact
·
privacy
projects
/
plomrogue
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5655c2d
)
New client: Set up rump command DB infrastructure.
author
Christian Heller
<c.heller@plomlompom.de>
Sat, 31 Oct 2015 11:56:19 +0000
(12:56 +0100)
committer
Christian Heller
<c.heller@plomlompom.de>
Sat, 31 Oct 2015 11:56:19 +0000
(12:56 +0100)
client_prototype.py
patch
|
blob
|
history
diff --git
a/client_prototype.py
b/client_prototype.py
index 2ed03fd645dc46c0357e97e910f6362be0a3d444..b788d6da9b957b62898120dc0b5fd135a159b926 100644
(file)
--- a/
client_prototype.py
+++ b/
client_prototype.py
@@
-174,8
+174,10
@@
def main(stdscr):
while True:
draw_screen()
char = stdscr.getch()
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']
def foo():
winmap = ['.', 'o', '.', 'o', 'O', 'o', '.', 'o', '.', 'x', 'y', 'x']
@@
-184,6
+186,10
@@
def foo():
return offset, size, winmap
return offset, size, winmap
+def command_quit():
+ exit()
+
+
windows = [
{"config": [1, 33], "func": foo},
{"config": [-7, 33], "func": foo},
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}
]
{"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]
sep_size = 1 # Width of inter-window borders and title bars.
stdscr = None
screen_size = [0,0]
-
curses.wrapper(main)
curses.wrapper(main)