AnalogSensePy 1.0.3__tar.gz → 1.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {analogsensepy-1.0.3 → analogsensepy-1.0.4}/AnalogSensePy.egg-info/PKG-INFO +1 -1
- {analogsensepy-1.0.3 → analogsensepy-1.0.4}/PKG-INFO +1 -1
- {analogsensepy-1.0.3 → analogsensepy-1.0.4}/README.md +24 -3
- {analogsensepy-1.0.3 → analogsensepy-1.0.4}/pyproject.toml +1 -1
- {analogsensepy-1.0.3 → analogsensepy-1.0.4}/AnalogSensePy.egg-info/SOURCES.txt +0 -0
- {analogsensepy-1.0.3 → analogsensepy-1.0.4}/AnalogSensePy.egg-info/dependency_links.txt +0 -0
- {analogsensepy-1.0.3 → analogsensepy-1.0.4}/AnalogSensePy.egg-info/requires.txt +0 -0
- {analogsensepy-1.0.3 → analogsensepy-1.0.4}/AnalogSensePy.egg-info/top_level.txt +0 -0
- {analogsensepy-1.0.3 → analogsensepy-1.0.4}/LICENSE +0 -0
- {analogsensepy-1.0.3 → analogsensepy-1.0.4}/analogsense/__init__.py +0 -0
- {analogsensepy-1.0.3 → analogsensepy-1.0.4}/analogsense/analogsense.py +0 -0
- {analogsensepy-1.0.3 → analogsensepy-1.0.4}/analogsense/keymaps.py +0 -0
- {analogsensepy-1.0.3 → analogsensepy-1.0.4}/analogsense/layouts.py +0 -0
- {analogsensepy-1.0.3 → analogsensepy-1.0.4}/analogsense/providers.py +0 -0
- {analogsensepy-1.0.3 → analogsensepy-1.0.4}/setup.cfg +0 -0
|
@@ -35,14 +35,35 @@ from analogsense import AnalogSense
|
|
|
35
35
|
|
|
36
36
|
as_ = AnalogSense()
|
|
37
37
|
devices = as_.get_devices()
|
|
38
|
-
|
|
38
|
+
|
|
39
|
+
if not devices:
|
|
40
|
+
print("no supported analog keyboards found.")
|
|
41
|
+
exit()
|
|
42
|
+
|
|
43
|
+
if len(devices) == 1:
|
|
44
|
+
dev = devices[0]
|
|
45
|
+
else:
|
|
46
|
+
for i, d in enumerate(devices):
|
|
47
|
+
print(f" [{i}] {d.product_name}")
|
|
48
|
+
dev = devices[int(input("select device index: "))]
|
|
39
49
|
|
|
40
50
|
def on_keys(active_keys):
|
|
41
51
|
for k in active_keys:
|
|
42
|
-
|
|
52
|
+
# converting the scancode to a nice readable string
|
|
53
|
+
name = as_.scancode_to_string(k["scancode"])
|
|
54
|
+
|
|
55
|
+
# some providers can return the digital state of the key
|
|
56
|
+
# (what the system perceives the key as pressed or not)
|
|
57
|
+
# other providers that do not support this will return None
|
|
58
|
+
if k["digital"] is not None:
|
|
59
|
+
digital = " [down]" if k["digital"] else " [up]"
|
|
60
|
+
else:
|
|
61
|
+
digital = ""
|
|
62
|
+
|
|
63
|
+
print(f"{name:20s} {k['value']:.4f}{digital}")
|
|
43
64
|
|
|
44
65
|
dev.start_listening(on_keys)
|
|
45
|
-
input("enter to stop
|
|
66
|
+
input("press keys... enter to stop.\n")
|
|
46
67
|
dev.stop_listening()
|
|
47
68
|
```
|
|
48
69
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|