This commit is contained in:
redfast00 2019-08-22 20:37:42 +02:00
parent 2cdcd8832a
commit abfbea97c2
No known key found for this signature in database
GPG Key ID: 5946E0E34FD0553C
1 changed files with 9 additions and 10 deletions

View File

@ -7,7 +7,6 @@ import base64
NULL_CHAR = chr(0)
last_c = None
colors = {
"Z": ["a", "a"],
@ -30,11 +29,7 @@ def release_keys():
def printchar(c):
print(c)
if last_c == '§':
print('changing color')
change_color(c)
elif c.islower():
if 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)
@ -43,8 +38,8 @@ def printchar(c):
elif c == ' ':
write_report(NULL_CHAR*2+chr(44)+NULL_CHAR*5)
elif c == '\n':
write_report(NULL_CHAR*2+chr(40)+NULL_CHAR*5)
elif c != '§':
write_report(NULL_CHAR*2+chr(40)+NULL_CHAR*5)
else:
write_report(chr(32)+NULL_CHAR+chr(0x38)+NULL_CHAR*5)
release_keys()
@ -59,13 +54,17 @@ def change_color(c: str):
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)
release_keys()
def printstring(s):
last_c = ''
for c in s:
printchar(c)
if last_c == '§':
change_color(c)
else:
printchar(c)
last_c = c
print('last_c=' + str(last_c == '§'))
def reset_color():