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