pybricks.media.ev3dev: Repair build.

Upon temporarily including these to update typing for pybricks.ev3devices, a lot of build errors were encountered.

Even though we won't be re-including these pages any time soon, we'll want to occasionally make sure that they still build with more recent versions of Sphinx.
This commit is contained in:
Laurens Valk
2022-05-30 14:29:14 +02:00
parent 8a4c4a5400
commit aab6c0d3e0
4 changed files with 60 additions and 26 deletions
+29 -4
View File
@@ -44,17 +44,42 @@ Motors
.. automethod:: pybricks.ev3devices.Motor.run_target
.. automethod:: pybricks.ev3devices.Motor.track_target
.. automethod:: pybricks.ev3devices.Motor.run_until_stalled
.. automethod:: pybricks.ev3devices.Motor.dc
.. rubric:: Advanced motion control
.. rubric:: Motor status
.. automethod:: pybricks.ev3devices.Motor.track_target
.. attribute:: control.scale
.. autoattribute:: pybricks.ev3devices.Motor.control
:annotation:
Number of degrees that the motor turns to complete one degree at the
output of the gear train. This is the gear ratio determined from the
``gears`` argument when initializing the motor.
.. automethod:: pybricks.ev3devices.Motor.control.done
.. automethod:: pybricks.ev3devices.Motor.control.stalled
.. automethod:: pybricks.ev3devices.Motor.control.load
.. rubric:: Motor settings
You can only change these settings while the controller is stopped. For
example, you can change them at the start of your program. Alternatively,
first call :meth:`stop() <pybricks.ev3devices.Motor.stop>`, and then change
the settings.
.. automethod:: pybricks.ev3devices.Motor.settings
.. automethod:: pybricks.ev3devices.Motor.control.limits
.. automethod:: pybricks.ev3devices.Motor.control.pid
.. automethod:: pybricks.ev3devices.Motor.control.target_tolerances
.. automethod:: pybricks.ev3devices.Motor.control.stall_tolerances
Touch Sensor
^^^^^^^^^^^^
+4
View File
@@ -38,14 +38,18 @@ MINDSTORMS EV3 Brick
.. automethod:: pybricks.hubs::EV3Brick.screen.clear
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_text
:noindex:
.. automethod:: pybricks.hubs::EV3Brick.screen.print
:noindex:
.. automethod:: pybricks.hubs::EV3Brick.screen.set_font
:noindex:
.. automethod:: pybricks.hubs::EV3Brick.screen.load_image
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_image
:noindex:
.. automethod:: pybricks.hubs::EV3Brick.screen.draw_pixel
+6 -6
View File
@@ -66,7 +66,7 @@ class Speaker:
"""Says a given text string.
You can configure the language and voice of the text using
:meth:`set_speech_options`.
:meth:`.set_speech_options`.
Arguments:
text (str): What to say.
@@ -75,10 +75,10 @@ class Speaker:
pass
def set_speech_options(self, language=None, voice=None, speed=None, pitch=None):
"""Configures speech settings used by the :meth:`say` method.
"""Configures speech settings used by the :meth:`.say` method.
Any option that is set to ``None`` will not be changed. If an option
is set to an invalid value :meth:`say` will use the default value
is set to an invalid value :meth:`.say` will use the default value
instead.
Arguments:
@@ -105,8 +105,8 @@ class Speaker:
Volume of the speaker.
which (str):
Which volume to set. ``'Beep'`` sets the volume for
:meth:`beep` and :meth:`play_notes`. ``'PCM'`` sets the volume
for :meth:`play_file` and :meth:`say`. ``'_all_'`` sets both
at the same time.
`beep` and `play_notes`. ``'PCM'`` sets the
volume for :meth:`.play_file` and :meth:`.say`. ``'_all_'``
sets both at the same time.
"""
pass
+21 -16
View File
@@ -117,8 +117,9 @@ class Image:
y (int):
The y-axis value where the top of the image will start.
source (Image or str):
The source :class:`Image`. If the argument is a string, then
the ``source`` image is loaded from file.
The source :class:`Image <pybricks.media.ev3dev.Image>`. If
the argument is a string, then the ``source`` image is loaded
from file.
transparent (Color):
The color of ``image`` to treat as transparent or ``None`` for
no transparency.
@@ -130,15 +131,17 @@ class Image:
Arguments:
source (Image or str):
The source :class:`Image`. If the argument is a string, then
the ``source`` image is loaded from file.
The source :class:`Image <pybricks.media.ev3dev.Image>`. If
the argument is a string, then the ``source`` image is loaded
from file.
"""
def draw_text(self, x, y, text, text_color=_Color.BLACK, background_color=None):
"""Draws text on |this image|.
The most recent font set using :meth:`set_font` will be used or
:data:`Font.DEFAULT` if no font has been set yet.
The most recent font set using :meth:`.set_font` will be used or
:data:`Font.DEFAULT <pybricks.media.ev3dev.Font.DEFAULT>` if no font
has been set yet.
Arguments:
x (int):
@@ -150,8 +153,8 @@ class Image:
text_color (Color):
The color used for drawing the text.
background_color (Color):
The color used to fill the rectangle behind the text or ``None``
for transparent background.
The color used to fill the rectangle behind the text or
``None`` for transparent background.
"""
pass
@@ -161,14 +164,16 @@ class Image:
This method works like the builtin ``print()`` function, but it writes
on |this image| instead.
You can set the font using :meth:`set_font`. If no font has been set,
:data:`Font.DEFAULT` will be used. The text is always printed used
black text with a white background.
You can set the font using :meth:`.set_font`. If no font has been set,
:data:`Font.DEFAULT <pybricks.media.ev3dev.Font.DEFAULT>` will be
used. The text is always printed used black text with a white
background.
Unlike the builtin ``print()``, the text does not wrap if it is too
wide to fit on |this image|. It just gets cut off. But if the text would
go off of the bottom of |this image|, the entire image is scrolled up and
the text is printed in the new blank area at the bottom of |this image|.
wide to fit on |this image|. It just gets cut off. But if the text
would go off of the bottom of |this image|, the entire image is
scrolled up and the text is printed in the new blank area at the
bottom of |this image|.
Arguments:
* (object):
@@ -184,10 +189,10 @@ class Image:
def set_font(self, font):
"""Sets the font used for writing on |this image|.
The font is used for both :meth:`draw_text` and :meth:`print`.
The font is used for both :meth:`.draw_text` and :meth:`.print`.
Arguments:
font (:class:`Font`):
font (Font):
The font to use.
"""
pass