test doesnt spam keycodes
parent
721a8e7e38
commit
90667cba52
|
|
@ -26,11 +26,30 @@ def __init_keys__():
|
|||
assert(_p.returncode == 0)
|
||||
stdout = _p.stdout
|
||||
result = []
|
||||
allowed = ["F"+str(i) for i in range(13, 25)]
|
||||
unassigned = []
|
||||
# already assigned
|
||||
for line in stdout.split("\n".encode())[1:]:
|
||||
if line:
|
||||
words = line.split()
|
||||
key = int(words[1])
|
||||
if len(words) < 4:
|
||||
unassigned.append(key)
|
||||
elif words[3].decode() in allowed:
|
||||
allowed.remove(words[3].decode())
|
||||
result.append(key)
|
||||
# not assigned
|
||||
for key in unassigned:
|
||||
if not allowed:
|
||||
break
|
||||
word = allowed.pop()
|
||||
if word:
|
||||
assert(subprocess.run([
|
||||
"xmodmap", "-e", f"keycode {key} = {word}",
|
||||
]).returncode == 0)
|
||||
result.append(key)
|
||||
print("unassigned", unassigned)
|
||||
print("allowed", allowed)
|
||||
print("result", result)
|
||||
return result
|
||||
keys = __init_keys__()
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ def main():
|
|||
buckets[key][0] = False if line[0] == "/" else float(line.split()[-1])
|
||||
for key in buckets:
|
||||
keyindex = buckets[key][1]
|
||||
print("getting", keyindex, "of", len(buckets))
|
||||
keycode = buttons.keys[keyindex]
|
||||
if buckets[key][0]:
|
||||
print(f"+{key}", end=" ")
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ trap cleanup EXIT
|
|||
|
||||
python3 ./state_to_buttons.py &
|
||||
|
||||
(
|
||||
python3 ./testdata/rand_0_n_weighted_stream.py \
|
||||
-n 6 \
|
||||
-b-min 1 \
|
||||
|
|
@ -34,3 +35,8 @@ python3 ./testdata/rand_0_n_weighted_stream.py \
|
|||
-n 1 \
|
||||
-m .25 \
|
||||
-r .3
|
||||
) &
|
||||
|
||||
while true; do
|
||||
read -s var
|
||||
done
|
||||
|
|
|
|||
Loading…
Reference in New Issue