typing pool now integrated. also supports upper and lower case.

workspace
Brendan Howell 9 years ago
parent 020b75a619
commit 986cbaec83

@ -55,19 +55,29 @@ class TypingPool(Bureau):
def run_io(self):
val = ""
upper = False
#TODO: this is crap, needs to be multi-threaded and have one
# such loop for each active device
self.active_devices[0].grab()
# TODO: this is a bit messy / complex. break into one more function.
for ev in self.active_devices[0].read_loop():
if ev.type == evdev.ecodes.EV_KEY:
data = evdev.categorize(ev)
if data.keystate == 1:
if data.scancode == 28:
print("sending barcode:", val)
self.send(val[0:2], val[2:])
val = ""
else:
try:
val += KEYS[data.scancode]
new_key = KEYS[data.scancode]
if new_key == "LSHFT" or new_key == "RSHFT":
upper = True
else:
if upper:
new_key = new_key.upper()
upper = False
val += new_key
except KeyError:
print("Error invalid keycode:", data.scancode)

Loading…
Cancel
Save