add debugging lines
This commit is contained in:
parent
1be146baf8
commit
2cdcd8832a
1 changed files with 8 additions and 4 deletions
12
server.py
12
server.py
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
import string
|
import string
|
||||||
from http.server import HTTPServer, BaseHTTPRequestHandler
|
from http.server import HTTPServer, BaseHTTPRequestHandler
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
@ -29,9 +30,11 @@ def release_keys():
|
||||||
|
|
||||||
|
|
||||||
def printchar(c):
|
def printchar(c):
|
||||||
|
print(c)
|
||||||
if last_c == '§':
|
if last_c == '§':
|
||||||
|
print('changing color')
|
||||||
change_color(c)
|
change_color(c)
|
||||||
if c.islower():
|
elif c.islower():
|
||||||
write_report(NULL_CHAR*2+chr(4 + ord(c) - ord('a'))+NULL_CHAR*5)
|
write_report(NULL_CHAR*2+chr(4 + ord(c) - ord('a'))+NULL_CHAR*5)
|
||||||
elif c.isupper():
|
elif c.isupper():
|
||||||
write_report(chr(32)+NULL_CHAR+chr(4 + ord(c) - ord('A'))+NULL_CHAR*5)
|
write_report(chr(32)+NULL_CHAR+chr(4 + ord(c) - ord('A'))+NULL_CHAR*5)
|
||||||
|
@ -41,7 +44,7 @@ def printchar(c):
|
||||||
write_report(NULL_CHAR*2+chr(44)+NULL_CHAR*5)
|
write_report(NULL_CHAR*2+chr(44)+NULL_CHAR*5)
|
||||||
elif c == '\n':
|
elif c == '\n':
|
||||||
write_report(NULL_CHAR*2+chr(40)+NULL_CHAR*5)
|
write_report(NULL_CHAR*2+chr(40)+NULL_CHAR*5)
|
||||||
else:
|
elif c != '§':
|
||||||
write_report(chr(32)+NULL_CHAR+chr(0x38)+NULL_CHAR*5)
|
write_report(chr(32)+NULL_CHAR+chr(0x38)+NULL_CHAR*5)
|
||||||
release_keys()
|
release_keys()
|
||||||
|
|
||||||
|
@ -51,9 +54,9 @@ def change_color(c: str):
|
||||||
# DELETE keypress
|
# DELETE keypress
|
||||||
write_report(NULL_CHAR*2+chr(0x2a)+NULL_CHAR*5)
|
write_report(NULL_CHAR*2+chr(0x2a)+NULL_CHAR*5)
|
||||||
release_keys()
|
release_keys()
|
||||||
write_report(NULL_CHAR*2+chr(4 + ord(colors[0]) - ord('a'))+NULL_CHAR*5)
|
write_report(NULL_CHAR*2+chr(4 + ord(colors[c][0]) - ord('a'))+NULL_CHAR*5)
|
||||||
release_keys()
|
release_keys()
|
||||||
write_report(NULL_CHAR*2+chr(4 + ord(colors[1]) - ord('a'))+NULL_CHAR*5)
|
write_report(NULL_CHAR*2+chr(4 + ord(colors[c][1]) - ord('a'))+NULL_CHAR*5)
|
||||||
else:
|
else:
|
||||||
write_report(chr(32)+NULL_CHAR+chr(0x38)+NULL_CHAR*5)
|
write_report(chr(32)+NULL_CHAR+chr(0x38)+NULL_CHAR*5)
|
||||||
|
|
||||||
|
@ -62,6 +65,7 @@ def printstring(s):
|
||||||
for c in s:
|
for c in s:
|
||||||
printchar(c)
|
printchar(c)
|
||||||
last_c = c
|
last_c = c
|
||||||
|
print('last_c=' + str(last_c == '§'))
|
||||||
|
|
||||||
|
|
||||||
def reset_color():
|
def reset_color():
|
||||||
|
|
Loading…
Reference in a new issue