forked from CRImier/pyLCI
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from ZeroPhone/input-capabilities
Input "capabilities" support + adding a UniversalInput UI element to work with input-constrained devices
- Loading branch information
Showing
14 changed files
with
430 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
|
||
|
||
import smbus | ||
from time import sleep | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
|
||
|
||
from evdev import InputDevice as HID, list_devices, ecodes | ||
from time import sleep | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from numpad_input import NumpadCharInput | ||
from char_input import CharArrowKeysInput | ||
|
||
def UniversalInput(i, o, *args, **kwargs): | ||
""" | ||
Returns the most appropriate input UI element, based on available keys | ||
of input devices present. For now, always returns UI elements configured | ||
for character input. | ||
""" | ||
# First, checking if any of the drivers with None as available_keys is present | ||
if None in i.available_keys.values(): | ||
# HID driver (or other driver with "any key is possible" is likely used | ||
# Let's use the most fully-functional input available at the moment | ||
return NumpadCharInput(i, o, *args, **kwargs) | ||
all_available_keys = sum(i.available_keys.values(), []) | ||
number_keys = ["KEY_{}".format(x) for x in range(10)] | ||
number_keys_available = all([number_key in all_available_keys for number_key in number_keys ]) | ||
if number_keys_available: | ||
# All number keys are supported | ||
return NumpadCharInput(i, o, *args, **kwargs) | ||
#fallback - only needs five primary keys | ||
return CharArrowKeysInput(i, o, *args, **kwargs) | ||
|
Oops, something went wrong.