pybricks.parameters.Icon: Document it.

Fixes https://github.com/pybricks/pybricks-api/issues/107
This commit is contained in:
Laurens Valk
2022-11-10 16:38:44 +01:00
parent a236609ebf
commit d2b1b2183b
5 changed files with 274 additions and 3 deletions
+2 -2
View File
@@ -24,8 +24,8 @@ HUB_FEATURES = {
"movehub": {"movehub"} | FEATURES_SMALL,
"cityhub": {"cityhub"} | FEATURES_MEDIUM,
"technichub": {"technichub"} | FEATURES_MEDIUM,
"primehub": {"primehub", "inventorhub"} | FEATURES_LARGE,
"inventorhub": {"primehub", "inventorhub"} | FEATURES_LARGE,
"primehub": {"primehub", "inventorhub", "light-matrix"} | FEATURES_LARGE,
"inventorhub": {"primehub", "inventorhub", "light-matrix"} | FEATURES_LARGE,
"essentialhub": {"essentialhub"} | FEATURES_LARGE,
}
+3 -1
View File
@@ -177,13 +177,15 @@ Changing the display orientation
.. literalinclude::
../../../examples/pup/hub_primehub/display_orientation_imu.py
.. _make_icons:
Making your own images
**********************
.. literalinclude::
../../../examples/pup/hub_primehub/display_matrix.py
Combining images to make expressions
Combining icons to make expressions
************************************
.. literalinclude::
+8
View File
@@ -0,0 +1,8 @@
.. pybricks-requirements:: light-matrix
Icon
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. autoclass:: pybricks.parameters.Icon
See the :ref:`make_icons` section for examples.
+3
View File
@@ -13,6 +13,7 @@
button
color
direction
icon
port
side
stop
@@ -23,6 +24,8 @@
.. pybricks-classlink:: Direction
.. pybricks-classlink:: Icon
.. pybricks-classlink:: Port
.. pybricks-classlink:: Side
+258
View File
@@ -185,39 +185,297 @@ class Side(_PybricksEnum):
class Icon:
"""Icons to display on a light matrix.
Each of the following attributes are matrices. This means you can scale
icons to adjust the brightness or add icons to make composites.
"""
UP: _Matrix
"""
| ⬜⬜🟨⬜⬜
| ⬜🟨🟨🟨⬜
| 🟨🟨🟨🟨🟨
| ⬜🟨🟨🟨⬜
| ⬜🟨🟨🟨⬜
"""
DOWN: _Matrix
"""
| ⬜🟨🟨🟨⬜
| ⬜🟨🟨🟨⬜
| 🟨🟨🟨🟨🟨
| ⬜🟨🟨🟨⬜
| ⬜⬜🟨⬜⬜
"""
LEFT: _Matrix
"""
| ⬜⬜🟨⬜⬜
| ⬜🟨🟨🟨🟨
| 🟨🟨🟨🟨🟨
| ⬜🟨🟨🟨🟨
| ⬜⬜🟨⬜⬜
"""
RIGHT: _Matrix
"""
| ⬜⬜🟨⬜⬜
| 🟨🟨🟨🟨⬜
| 🟨🟨🟨🟨🟨
| 🟨🟨🟨🟨⬜
| ⬜⬜🟨⬜⬜
"""
ARROW_RIGHT_UP: _Matrix
"""
| ⬜⬜🟨🟨🟨
| ⬜⬜⬜🟨🟨
| ⬜⬜🟨⬜🟨
| ⬜🟨⬜⬜⬜
| 🟨⬜⬜⬜⬜
"""
ARROW_RIGHT_DOWN: _Matrix
"""
| 🟨⬜⬜⬜⬜
| ⬜🟨⬜⬜⬜
| ⬜⬜🟨⬜🟨
| ⬜⬜⬜🟨🟨
| ⬜⬜🟨🟨🟨
"""
ARROW_LEFT_UP: _Matrix
"""
| 🟨🟨🟨⬜⬜
| 🟨🟨⬜⬜⬜
| 🟨⬜🟨⬜⬜
| ⬜⬜⬜🟨⬜
| ⬜⬜⬜⬜🟨
"""
ARROW_LEFT_DOWN: _Matrix
"""
| ⬜⬜⬜⬜🟨
| ⬜⬜⬜🟨⬜
| 🟨⬜🟨⬜⬜
| 🟨🟨⬜⬜⬜
| 🟨🟨🟨⬜⬜
"""
ARROW_UP: _Matrix
"""
| ⬜⬜🟨⬜⬜
| ⬜🟨🟨🟨⬜
| 🟨⬜🟨⬜🟨
| ⬜⬜🟨⬜⬜
| ⬜⬜🟨⬜⬜
"""
ARROW_DOWN: _Matrix
"""
| ⬜⬜🟨⬜⬜
| ⬜⬜🟨⬜⬜
| 🟨⬜🟨⬜🟨
| ⬜🟨🟨🟨⬜
| ⬜⬜🟨⬜⬜
"""
ARROW_LEFT: _Matrix
"""
| ⬜⬜🟨⬜⬜
| ⬜🟨⬜⬜⬜
| 🟨🟨🟨🟨🟨
| ⬜🟨⬜⬜⬜
| ⬜⬜🟨⬜⬜
"""
ARROW_RIGHT: _Matrix
"""
| ⬜⬜🟨⬜⬜
| ⬜⬜⬜🟨⬜
| 🟨🟨🟨🟨🟨
| ⬜⬜⬜🟨⬜
| ⬜⬜🟨⬜⬜
"""
HAPPY: _Matrix
"""
| 🟨🟨⬜🟨🟨
| 🟨🟨⬜🟨🟨
| ⬜⬜⬜⬜⬜
| 🟨⬜⬜⬜🟨
| ⬜🟨🟨🟨⬜
"""
SAD: _Matrix
"""
| 🟨🟨⬜🟨🟨
| 🟨🟨⬜🟨🟨
| ⬜⬜⬜⬜⬜
| ⬜🟨🟨🟨⬜
| 🟨⬜⬜⬜🟨
"""
EYE_LEFT: _Matrix
"""
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
| 🟨🟨⬜⬜⬜
| 🟨🟨⬜⬜⬜
| ⬜⬜⬜⬜⬜
"""
EYE_RIGHT: _Matrix
"""
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜🟨🟨
| ⬜⬜⬜🟨🟨
| ⬜⬜⬜⬜⬜
"""
EYE_LEFT_BLINK: _Matrix
"""
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
| 🟨🟨⬜⬜⬜
| ⬜⬜⬜⬜⬜
"""
EYE_RIGHT_BLINK: _Matrix
"""
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜🟨🟨
| ⬜⬜⬜⬜⬜
"""
EYE_RIGHT_BROW: _Matrix
"""
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜🟨🟨
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
"""
EYE_LEFT_BROW: _Matrix
"""
| ⬜⬜⬜⬜⬜
| 🟨🟨⬜⬜⬜
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
"""
EYE_LEFT_BROW_UP: _Matrix
"""
| 🟨🟨⬜⬜⬜
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
"""
EYE_RIGHT_BROW_UP: _Matrix
"""
| ⬜⬜⬜🟨🟨
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
"""
HEART: _Matrix
"""
| ⬜🟨⬜🟨⬜
| 🟨🟨🟨🟨🟨
| 🟨🟨🟨🟨🟨
| ⬜🟨🟨🟨⬜
| ⬜⬜🟨⬜⬜
"""
PAUSE: _Matrix
"""
| ⬜⬜⬜⬜⬜
| ⬜🟨⬜🟨⬜
| ⬜🟨⬜🟨⬜
| ⬜🟨⬜🟨⬜
| ⬜⬜⬜⬜⬜
"""
EMPTY: _Matrix
"""
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
| ⬜⬜⬜⬜⬜
"""
FULL: _Matrix
"""
| 🟨🟨🟨🟨🟨
| 🟨🟨🟨🟨🟨
| 🟨🟨🟨🟨🟨
| 🟨🟨🟨🟨🟨
| 🟨🟨🟨🟨🟨
"""
SQUARE: _Matrix
"""
| ⬜⬜⬜⬜⬜
| ⬜🟨🟨🟨⬜
| ⬜🟨🟨🟨⬜
| ⬜🟨🟨🟨⬜
| ⬜⬜⬜⬜⬜
"""
TRIANGLE_RIGHT: _Matrix
"""
| ⬜🟨⬜⬜⬜
| ⬜🟨🟨⬜⬜
| ⬜🟨🟨🟨⬜
| ⬜🟨🟨⬜⬜
| ⬜🟨⬜⬜⬜
"""
TRIANGLE_LEFT: _Matrix
"""
| ⬜⬜⬜🟨⬜
| ⬜⬜🟨🟨⬜
| ⬜🟨🟨🟨⬜
| ⬜⬜🟨🟨⬜
| ⬜⬜⬜🟨⬜
"""
TRIANGLE_UP: _Matrix
"""
| ⬜⬜⬜⬜⬜
| ⬜⬜🟨⬜⬜
| ⬜🟨🟨🟨⬜
| 🟨🟨🟨🟨🟨
| ⬜⬜⬜⬜⬜
"""
TRIANGLE_DOWN: _Matrix
"""
| ⬜⬜⬜⬜⬜
| 🟨🟨🟨🟨🟨
| ⬜🟨🟨🟨⬜
| ⬜⬜🟨⬜⬜
| ⬜⬜⬜⬜⬜
"""
CIRCLE: _Matrix
"""
| ⬜🟨🟨🟨⬜
| 🟨🟨🟨🟨🟨
| 🟨🟨🟨🟨🟨
| 🟨🟨🟨🟨🟨
| ⬜🟨🟨🟨⬜
"""
CLOCKWISE: _Matrix
"""
| 🟨🟨🟨🟨⬜
| 🟨⬜⬜🟨⬜
| 🟨⬜⬜🟨⬜
| 🟨⬜🟨🟨🟨
| ⬜⬜⬜🟨⬜
"""
COUNTERCLOCKWISE: _Matrix
"""
| ⬜🟨🟨🟨🟨
| ⬜🟨⬜⬜🟨
| ⬜🟨⬜⬜🟨
| 🟨🟨🟨⬜🟨
| ⬜🟨⬜⬜⬜
"""
TRUE: _Matrix
"""
| ⬜⬜⬜⬜🟨
| ⬜⬜⬜🟨⬜
| 🟨⬜🟨⬜⬜
| ⬜🟨⬜⬜⬜
| ⬜⬜⬜⬜⬜
"""
FALSE: _Matrix
"""
| 🟨⬜⬜⬜🟨
| ⬜🟨⬜🟨⬜
| ⬜⬜🟨⬜⬜
| ⬜🟨⬜🟨⬜
| 🟨⬜⬜⬜🟨
"""