Skip to content

Commit cb6201d

Browse files
authored
Merge pull request adafruit#7659 from dhalbert/gifio-displayio-doc
Update gifio and displayio documentation
2 parents 34033d9 + 5386caf commit cb6201d

File tree

3 files changed

+38
-11
lines changed

3 files changed

+38
-11
lines changed

shared-bindings/displayio/Display.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,16 @@ static displayio_display_obj_t *native_display(mp_obj_t display_obj) {
240240
}
241241

242242
//| def show(self, group: Group) -> None:
243-
//| """Switches to displaying the given group of layers. When group is None, the default
243+
//| """
244+
//| .. note:: `show()` is deprecated and will be removed in CircuitPython 9.0.0.
245+
//| Use ``.root_group = group`` instead.
246+
//|
247+
//| Switches to displaying the given group of layers. When group is None, the default
244248
//| CircuitPython terminal will be shown.
245249
//|
246-
//| :param Group group: The group to show."""
250+
//| :param Group group: The group to show.
251+
//|
252+
//| """
247253
//| ...
248254
STATIC mp_obj_t displayio_display_obj_show(mp_obj_t self_in, mp_obj_t group_in) {
249255
displayio_display_obj_t *self = native_display(self_in);
@@ -419,7 +425,9 @@ MP_PROPERTY_GETTER(displayio_display_bus_obj,
419425
(mp_obj_t)&displayio_display_get_bus_obj);
420426

421427
//| root_group: Group
422-
//| """The root group on the display."""
428+
//| """The root group on the display.
429+
//| If the root group is set to ``None``, the default CircuitPython terminal will be shown.
430+
//| """
423431
STATIC mp_obj_t displayio_display_obj_get_root_group(mp_obj_t self_in) {
424432
displayio_display_obj_t *self = native_display(self_in);
425433
return common_hal_displayio_display_get_root_group(self);

shared-bindings/displayio/EPaperDisplay.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,11 @@ static displayio_epaperdisplay_obj_t *native_display(mp_obj_t display_obj) {
242242
}
243243

244244
//| def show(self, group: Group) -> None:
245-
//| """Switches to displaying the given group of layers. When group is None, the default
245+
//| """
246+
//| .. note:: `show()` is deprecated and will be removed in CircuitPython 9.0.0.
247+
//| Use ``.root_group = group`` instead.
248+
//|
249+
//| Switches to displaying the given group of layers. When group is None, the default
246250
//| CircuitPython terminal will be shown.
247251
//|
248252
//| :param Group group: The group to show."""
@@ -379,7 +383,9 @@ MP_PROPERTY_GETTER(displayio_epaperdisplay_bus_obj,
379383
(mp_obj_t)&displayio_epaperdisplay_get_bus_obj);
380384

381385
//| root_group: Group
382-
//| """The root group on the epaper display."""
386+
//| """The root group on the epaper display.
387+
//| If the root group is set to ``None``, the default CircuitPython terminal will be shown.
388+
//| """
383389
//|
384390
STATIC mp_obj_t displayio_epaperdisplay_obj_get_root_group(mp_obj_t self_in) {
385391
displayio_epaperdisplay_obj_t *self = native_display(self_in);

shared-bindings/gifio/OnDiskGif.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,22 +48,35 @@
4848
//| display.root_group = splash
4949
//|
5050
//| odg = gifio.OnDiskGif('/sample.gif')
51+
//|
52+
//| start = time.monotonic()
5153
//| odg.next_frame() # Load the first frame
52-
//| # Depending on your display the next line may need Colorspace.RGB565 instead of Colorspace.RGB565_SWAPPED
53-
//| face = displayio.TileGrid(odg.bitmap, pixel_shader=displayio.ColorConverter(input_colorspace=displayio.Colorspace.RGB565_SWAPPED))
54+
//| end = time.monotonic()
55+
//| overhead = end - start
56+
//|
57+
//| face = displayio.TileGrid(
58+
//| odg.bitmap,
59+
//| pixel_shader=displayio.ColorConverter(
60+
//| input_colorspace=displayio.Colorspace.RGB565_SWAPPED
61+
//| ),
62+
//| )
5463
//| splash.append(face)
5564
//| board.DISPLAY.refresh()
5665
//|
57-
//| # Wait forever
66+
//| # Display repeatedly.
5867
//| while True:
68+
//| # Sleep for the frame delay specified by the GIF,
69+
//| # minus the overhead measured to advance between frames.
70+
//| time.sleep(max(0, next_delay - overhead))
5971
//| next_delay = odg.next_frame()
60-
//| time.sleep(next_delay)"""
72+
//| """
6173
//|
6274
//| def __init__(self, file: str) -> None:
63-
//| """Create an OnDiskGif object with the given file.
75+
//| """Create an `OnDiskGif` object with the given file.
76+
//| The GIF frames are decoded into RGB565 big-endian format.
77+
//| `displayio` expects little-endian, so the example above uses `Colorspace.RGB565_SWAPPED`.
6478
//|
6579
//| :param file file: The name of the GIF file.
66-
//|
6780
//| """
6881
//| ...
6982
STATIC mp_obj_t gifio_ondiskgif_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy