-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add name key to Device * Create Device.md * Update Home.md
- Loading branch information
1 parent
33065d0
commit f7dc98d
Showing
3 changed files
with
52 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
## lib.device.Device | ||
|
||
`device` is an automatically generated module containing the `Device` class. This class provides access to device-specific constants (as set in the `device/DEVICENAME/definition.yml` file, and is designed to assist in building multi-platform apps. | ||
|
||
The class has two main attributes: | ||
`Device.vals` contains a dictionary of constants for this device. | ||
`Device.feats` contains a tuple of features that this device has. | ||
|
||
Usage examples: | ||
``` Py | ||
from lib.device import Device | ||
|
||
# acess device constants | ||
width = Device.display_width | ||
height = Device.display_height | ||
name = Device.name | ||
|
||
# Check for device features | ||
if 'touchscreen' in Device: | ||
get_touch() | ||
|
||
if `keyboard` in Device or 'CARDPUTER' in device: | ||
keyboard_stuff() | ||
``` | ||
|
||
> Note: `Device` is a singleton and can't be called or re-initialized after importing. |
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