add debugging lines

This commit is contained in:
FKD13 2019-08-22 20:33:57 +02:00
parent 1be146baf8
commit 2cdcd8832a
No known key found for this signature in database
GPG key ID: C0B6C62B8313F2A1

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import string
from http.server import HTTPServer, BaseHTTPRequestHandler
from io import BytesIO
@ -29,9 +30,11 @@ def release_keys():
def printchar(c):
print(c)
if last_c == '§':
print('changing color')
change_color(c)
if c.islower():
elif c.islower():
write_report(NULL_CHAR*2+chr(4 + ord(c) - ord('a'))+NULL_CHAR*5)
elif c.isupper():
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)
elif c == '\n':
write_report(NULL_CHAR*2+chr(40)+NULL_CHAR*5)
else:
elif c != '§':
write_report(chr(32)+NULL_CHAR+chr(0x38)+NULL_CHAR*5)
release_keys()
@ -51,9 +54,9 @@ def change_color(c: str):
# DELETE keypress
write_report(NULL_CHAR*2+chr(0x2a)+NULL_CHAR*5)
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()
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:
write_report(chr(32)+NULL_CHAR+chr(0x38)+NULL_CHAR*5)
@ -62,6 +65,7 @@ def printstring(s):
for c in s:
printchar(c)
last_c = c
print('last_c=' + str(last_c == '§'))
def reset_color():