api/parameters/Button: add remote buttons

Also clean up how it is displayed by reading the attributes from the API instead of copying them.
This commit is contained in:
Laurens Valk
2020-12-30 12:27:12 +01:00
parent 313a51219a
commit 352bff564c
3 changed files with 51 additions and 27 deletions
+42
View File
@@ -132,6 +132,48 @@
.. autoclass:: pybricks.parameters.Button
:no-members:
.. autoattribute:: pybricks.parameters.Button.LEFT_DOWN
:annotation:
.. autoattribute:: pybricks.parameters.Button.LEFT_MINUS
:annotation:
.. autoattribute:: pybricks.parameters.Button.DOWN
:annotation:
.. autoattribute:: pybricks.parameters.Button.RIGHT_DOWN
:annotation:
.. autoattribute:: pybricks.parameters.Button.RIGHT_MINUS
:annotation:
.. autoattribute:: pybricks.parameters.Button.LEFT
:annotation:
.. autoattribute:: pybricks.parameters.Button.CENTER
:annotation:
.. autoattribute:: pybricks.parameters.Button.RIGHT
:annotation:
.. autoattribute:: pybricks.parameters.Button.LEFT_UP
:annotation:
.. autoattribute:: pybricks.parameters.Button.LEFT_PLUS
:annotation:
.. autoattribute:: pybricks.parameters.Button.UP
:annotation:
.. autoattribute:: pybricks.parameters.Button.BEACON
:annotation:
.. autoattribute:: pybricks.parameters.Button.RIGHT_UP
:annotation:
.. autoattribute:: pybricks.parameters.Button.RIGHT_PLUS
:annotation:
.. .. autoclass:: pybricks.parameters.Axis
.. :no-members:
+5 -27
View File
@@ -137,44 +137,22 @@ class Direction(_PybricksEnum):
class Button(_PybricksEnum):
"""Buttons on a brick or remote:
.. data:: LEFT_DOWN
.. data:: DOWN
.. data:: RIGHT_DOWN
.. data:: LEFT
.. data:: CENTER
.. data:: RIGHT
.. data:: LEFT_UP
.. data:: UP
.. data:: BEACON
.. data:: RIGHT_UP
+-----------+----------+-----------+
| | | |
| LEFT_UP |UP/BEACON | RIGHT_UP |
| | | |
+-----------+----------+-----------+
| | | |
| LEFT | CENTER | RIGHT |
| | | |
+-----------+----------+-----------+
| | | |
| LEFT_DOWN | DOWN | RIGHT_DOWN|
| | | |
+-----------+----------+-----------+
"""
"""Buttons on a brick or remote"""
LEFT_DOWN = 1
LEFT_MINUS = 1
DOWN = 2
RIGHT_DOWN = 3
RIGHT_MINUS = 3
LEFT = 4
CENTER = 5
RIGHT = 6
LEFT_UP = 7
LEFT_PLUS = 7
UP = 8
BEACON = 8
RIGHT_UP = 9
RIGHT_PLUS = 9
class Axis(_PybricksEnum):
+4
View File
@@ -37,15 +37,19 @@ class Direction:
class Button:
LEFT_DOWN: Button
LEFT_MINUS: Button
DOWN: Button
RIGHT_DOWN: Button
RIGHT_MINUS: Button
LEFT: Button
CENTER: Button
RIGHT: Button
LEFT_UP: Button
LEFT_PLUS: Button
UP: Button
BEACON: Button
RIGHT_UP: Button
RIGHT_PLUS: Button
class Axis:
X: Axis