summaryrefslogtreecommitdiff
path: root/shared-bindings/displayio/Group.c
diff options
context:
space:
mode:
authordherrada <dylan.herrada@gmail.com>2020-05-07 10:54:09 -0400
committerdherrada <dylan.herrada@gmail.com>2020-05-07 10:54:09 -0400
commit2ebe3035dff0ce66b2fe65eb91d6889c4ba93b5c (patch)
tree60954388417613578138c9be870f5b2dc510b042 /shared-bindings/displayio/Group.c
parent0e465e63b98c3825298219e2144a145208aaff7f (diff)
Did board, digitalio, displayio
Diffstat (limited to 'shared-bindings/displayio/Group.c')
-rw-r--r--shared-bindings/displayio/Group.c115
1 files changed, 56 insertions, 59 deletions
diff --git a/shared-bindings/displayio/Group.c b/shared-bindings/displayio/Group.c
index dd7600eb9..36e137dc9 100644
--- a/shared-bindings/displayio/Group.c
+++ b/shared-bindings/displayio/Group.c
@@ -35,22 +35,23 @@
#include "py/runtime.h"
#include "supervisor/shared/translate.h"
-//| .. currentmodule:: displayio
+//| class Group:
+//| """.. currentmodule:: displayio
//|
-//| :class:`Group` -- Group together sprites and subgroups
-//| ==========================================================================
+//| :class:`Group` -- Group together sprites and subgroups
+//| ==========================================================================
//|
-//| Manage a group of sprites and groups and how they are inter-related.
+//| Manage a group of sprites and groups and how they are inter-related."""
//|
-//| .. class:: Group(*, max_size=4, scale=1, x=0, y=0)
+//| def __init__(self, *, max_size: int = 4, scale: int = 1, x: int = 0, y: int = 0):
+//| """Create a Group of a given size and scale. Scale is in one dimension. For example, scale=2
+//| leads to a layer's pixel being 2x2 pixels when in the group.
//|
-//| Create a Group of a given size and scale. Scale is in one dimension. For example, scale=2
-//| leads to a layer's pixel being 2x2 pixels when in the group.
-//|
-//| :param int max_size: The maximum group size.
-//| :param int scale: Scale of layer pixels in one dimension.
-//| :param int x: Initial x position within the parent.
-//| :param int y: Initial y position within the parent.
+//| :param int max_size: The maximum group size.
+//| :param int scale: Scale of layer pixels in one dimension.
+//| :param int x: Initial x position within the parent.
+//| :param int y: Initial y position within the parent."""
+//| ...
//|
STATIC mp_obj_t displayio_group_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_max_size, ARG_scale, ARG_x, ARG_y };
@@ -90,10 +91,9 @@ displayio_group_t* native_group(mp_obj_t group_obj) {
return MP_OBJ_TO_PTR(native_group);
}
-//| .. attribute:: hidden
-//|
-//| True when the Group and all of it's layers are not visible. When False, the Group's layers
-//| are visible if they haven't been hidden.
+//| hidden: Any = ...
+//| """True when the Group and all of it's layers are not visible. When False, the Group's layers
+//| are visible if they haven't been hidden."""
//|
STATIC mp_obj_t displayio_group_obj_get_hidden(mp_obj_t self_in) {
displayio_group_t *self = native_group(self_in);
@@ -116,10 +116,9 @@ const mp_obj_property_t displayio_group_hidden_obj = {
(mp_obj_t)&mp_const_none_obj},
};
-//| .. attribute:: scale
-//|
-//| Scales each pixel within the Group in both directions. For example, when scale=2 each pixel
-//| will be represented by 2x2 pixels.
+//| scale: Any = ...
+//| """Scales each pixel within the Group in both directions. For example, when scale=2 each pixel
+//| will be represented by 2x2 pixels."""
//|
STATIC mp_obj_t displayio_group_obj_get_scale(mp_obj_t self_in) {
displayio_group_t *self = native_group(self_in);
@@ -146,9 +145,8 @@ const mp_obj_property_t displayio_group_scale_obj = {
(mp_obj_t)&mp_const_none_obj},
};
-//| .. attribute:: x
-//|
-//| X position of the Group in the parent.
+//| x: Any = ...
+//| """X position of the Group in the parent."""
//|
STATIC mp_obj_t displayio_group_obj_get_x(mp_obj_t self_in) {
displayio_group_t *self = native_group(self_in);
@@ -172,9 +170,8 @@ const mp_obj_property_t displayio_group_x_obj = {
(mp_obj_t)&mp_const_none_obj},
};
-//| .. attribute:: y
-//|
-//| Y position of the Group in the parent.
+//| y: Any = ...
+//| """Y position of the Group in the parent."""
//|
STATIC mp_obj_t displayio_group_obj_get_y(mp_obj_t self_in) {
displayio_group_t *self = native_group(self_in);
@@ -198,9 +195,9 @@ const mp_obj_property_t displayio_group_y_obj = {
(mp_obj_t)&mp_const_none_obj},
};
-//| .. method:: append(layer)
-//|
-//| Append a layer to the group. It will be drawn above other layers.
+//| def append(self, layer: Any) -> Any:
+//| """Append a layer to the group. It will be drawn above other layers."""
+//| ...
//|
STATIC mp_obj_t displayio_group_obj_append(mp_obj_t self_in, mp_obj_t layer) {
displayio_group_t *self = native_group(self_in);
@@ -209,9 +206,9 @@ STATIC mp_obj_t displayio_group_obj_append(mp_obj_t self_in, mp_obj_t layer) {
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_append_obj, displayio_group_obj_append);
-//| .. method:: insert(index, layer)
-//|
-//| Insert a layer into the group.
+//| def insert(self, index: Any, layer: Any) -> Any:
+//| """Insert a layer into the group."""
+//| ...
//|
STATIC mp_obj_t displayio_group_obj_insert(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t layer) {
displayio_group_t *self = native_group(self_in);
@@ -222,9 +219,9 @@ STATIC mp_obj_t displayio_group_obj_insert(mp_obj_t self_in, mp_obj_t index_obj,
MP_DEFINE_CONST_FUN_OBJ_3(displayio_group_insert_obj, displayio_group_obj_insert);
-//| .. method:: index(layer)
-//|
-//| Returns the index of the first copy of layer. Raises ValueError if not found.
+//| def index(self, layer: Any) -> Any:
+//| """Returns the index of the first copy of layer. Raises ValueError if not found."""
+//| ...
//|
STATIC mp_obj_t displayio_group_obj_index(mp_obj_t self_in, mp_obj_t layer) {
displayio_group_t *self = native_group(self_in);
@@ -236,9 +233,9 @@ STATIC mp_obj_t displayio_group_obj_index(mp_obj_t self_in, mp_obj_t layer) {
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_index_obj, displayio_group_obj_index);
-//| .. method:: pop(i=-1)
-//|
-//| Remove the ith item and return it.
+//| def pop(self, i: Any = -1) -> Any:
+//| """Remove the ith item and return it."""
+//| ...
//|
STATIC mp_obj_t displayio_group_obj_pop(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_i };
@@ -259,9 +256,9 @@ STATIC mp_obj_t displayio_group_obj_pop(size_t n_args, const mp_obj_t *pos_args,
MP_DEFINE_CONST_FUN_OBJ_KW(displayio_group_pop_obj, 1, displayio_group_obj_pop);
-//| .. method:: remove(layer)
-//|
-//| Remove the first copy of layer. Raises ValueError if it is not present.
+//| def remove(self, layer: Any) -> Any:
+//| """Remove the first copy of layer. Raises ValueError if it is not present."""
+//| ...
//|
STATIC mp_obj_t displayio_group_obj_remove(mp_obj_t self_in, mp_obj_t layer) {
mp_obj_t index = displayio_group_obj_index(self_in, layer);
@@ -272,9 +269,9 @@ STATIC mp_obj_t displayio_group_obj_remove(mp_obj_t self_in, mp_obj_t layer) {
}
MP_DEFINE_CONST_FUN_OBJ_2(displayio_group_remove_obj, displayio_group_obj_remove);
-//| .. method:: __len__()
-//|
-//| Returns the number of layers in a Group
+//| def __len__(self, ) -> Any:
+//| """Returns the number of layers in a Group"""
+//| ...
//|
STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
displayio_group_t *self = native_group(self_in);
@@ -286,29 +283,29 @@ STATIC mp_obj_t group_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
}
-//| .. method:: __getitem__(index)
-//|
-//| Returns the value at the given index.
-//|
-//| This allows you to::
-//|
-//| print(group[0])
+//| def __getitem__(self, index: Any) -> Any:
+//| """Returns the value at the given index.
//|
-//| .. method:: __setitem__(index, value)
+//| This allows you to::
//|
-//| Sets the value at the given index.
+//| print(group[0])"""
+//| ...
//|
-//| This allows you to::
+//| def __setitem__(self, index: Any, value: Any) -> Any:
+//| """Sets the value at the given index.
//|
-//| group[0] = sprite
+//| This allows you to::
//|
-//| .. method:: __delitem__(index)
+//| group[0] = sprite"""
+//| ...
//|
-//| Deletes the value at the given index.
+//| def __delitem__(self, index: Any) -> Any:
+//| """Deletes the value at the given index.
//|
-//| This allows you to::
+//| This allows you to::
//|
-//| del group[0]
+//| del group[0]"""
+//| ...
//|
STATIC mp_obj_t group_subscr(mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t value) {
displayio_group_t *self = native_group(self_in);