diff --git a/.github/workflows/build_docs.yaml b/.github/workflows/build_docs.yaml index d86d7c5..5393f99 100644 --- a/.github/workflows/build_docs.yaml +++ b/.github/workflows/build_docs.yaml @@ -20,7 +20,7 @@ jobs: - name: Build HTML documentation with Sphinx run: | make html - make html SPHINXOPTS="--keep-going -n" + make html SPHINXOPTS="-W --keep-going" working-directory: docs - uses: actions/upload-pages-artifact@v3 with: diff --git a/.github/workflows/check_docs.yaml b/.github/workflows/check_docs.yaml index ccf0e1a..354228e 100644 --- a/.github/workflows/check_docs.yaml +++ b/.github/workflows/check_docs.yaml @@ -18,7 +18,7 @@ jobs: - name: Build HTML documentation with Sphinx run: | make html - make html SPHINXOPTS="--keep-going -n" + make html SPHINXOPTS="-W --keep-going" working-directory: docs - uses: actions/upload-artifact@v4 with: diff --git a/docs/source/user_guide/geometries.rst b/docs/source/user_guide/geometries.rst deleted file mode 100644 index 5df4401..0000000 --- a/docs/source/user_guide/geometries.rst +++ /dev/null @@ -1,43 +0,0 @@ -============== -Geometry Types -============== - -.. py:currentmodule:: tempe.shape - -The :py:class:`~tempe.geometry.Geometry` classes are fairly abstract, and -in particular don't specify what they produce when iterated, other than -some sequence of integers. However the :py:class:`~tempe.shape.Shape` classes -that use those Geoemtries have expectations about what those sequences look -like. - -The following are the specific data types that these objects expect: - -.. py:class:: geom - - A generic geometry as a sequence of ints of unspecified length. - -.. py:class:: point - - A sequence of ints of the form (x, y). - -.. py:class:: points - - A sequence of ints of the form (x0, y0, x1, y1). - -.. py:class:: point_array - - An array of signed 16-bit integers giving point coordinates of the - form ``array('h', [x0, y0, x1, y1, ...])``. - -.. py:class:: rectangle - - A sequence of ints of the form (x, y, w, h). - -.. py:class:: ellipse - - A sequence of ints of the form (center_x, center_y, radius_x, radius_y). - -.. py:class:: point_length - - A sequence of ints of the form (x, y, length). The length can also be - used as a size parameter for markers or radius of a circle, as appropriate. diff --git a/docs/source/user_guide/index.rst b/docs/source/user_guide/index.rst index dd0b151..694ec23 100644 --- a/docs/source/user_guide/index.rst +++ b/docs/source/user_guide/index.rst @@ -15,4 +15,3 @@ This is the user-guide for Tempe. introduction.rst installation.rst tutorial.rst - geometries.rst diff --git a/src/tempe/markers.pyi b/src/tempe/markers.pyi index 95b1935..ea350fb 100644 --- a/src/tempe/markers.pyi +++ b/src/tempe/markers.pyi @@ -4,7 +4,7 @@ import framebuf from typing import Any from .geometry import Geometry -from .shapes import ColoredGeometry, BLIT_KEY_RGB565, rectangle +from .shapes import ColoredGeometry, BLIT_KEY_RGB565, rectangle, point_length from .surface import Surface @@ -19,12 +19,27 @@ class Marker: CROSS = 6 -class Markers(ColoredGeometry): - """Display sized, colored markers at points.""" +class Markers(ColoredGeometry[point_length]): + """Display sized, colored markers at points. + + Parameters + ---------- + geometry : Iterable[geom] | None + The sequence of geometries to render. + colors : Iterable[int] | None + The sequence of colors for each geometry. + markers : Iterable[Any] | None + The sequence of colors for each geometry. + surface : Surface | None + The surface which this shape is associated with. + clip : rectangle | None + An (x, y, w, h) tuple to clip drawing to - anything drawn outside + this region will not show on the display. + """ def __init__( self, - geometry: Geometry[tuple[int, int, int]], + geometry: Geometry[point_length], colors: Iterable[int], markers: Iterable[Any], *, @@ -34,8 +49,19 @@ class Markers(ColoredGeometry): def update( self, - geometry: Geometry[tuple[int, int, int]] | None = None, + geometry: Iterable[point_length] | None = None, colors: Iterable[int] | None = None, markers: Iterable[Any] | None = None, **kwargs: Any, - ): ... + ): + """Update the state of the Shape, marking a redraw as needed. + + Parameters + ---------- + geometry : Iterable[geom] | None + The sequence of geometries to render. + colors : Iterable[int] | None + The sequence of colors for each geometry. + markers : Iterable[Any] | None + The sequence of colors for each geometry. + """ diff --git a/src/tempe/shapes.pyi b/src/tempe/shapes.pyi index 9daa011..5b5ee5e 100644 --- a/src/tempe/shapes.pyi +++ b/src/tempe/shapes.pyi @@ -86,7 +86,11 @@ class Shape: this region will not show on the display. """ - def __init__(self, surface: "tempe.surface.Surface | None" = None, clip: rectangle | None = None): ... + def __init__( + self, + surface: "tempe.surface.Surface | None" = None, + clip: rectangle | None = None, + ): ... def draw(self, buffer: FrameBuffer, x: int = 0, y: int = 0) -> None: """Render the shape into the given buffer offset by x and y. diff --git a/src/tempe/surface.pyi b/src/tempe/surface.pyi index 577312e..5f0cf70 100644 --- a/src/tempe/surface.pyi +++ b/src/tempe/surface.pyi @@ -64,7 +64,7 @@ class Surface: ---------- display : Display The actual physical display that the surface will be drawn on. - working_buffer : array[int] + working_buffer : array.array[int] An empty array of unsigned 16-bit ints (ie. ``array('H', ...)``) that the Surface will use as memory for temporary drawing buffers. """