Skip to content

Commit 8183d8e

Browse files
committed
Remove displayio.*.show()
Use `displayio.*.root_group =`.
1 parent a3c9320 commit 8183d8e

File tree

12 files changed

+11
-110
lines changed

12 files changed

+11
-110
lines changed

shared-bindings/displayio/Display.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -239,33 +239,6 @@ static displayio_display_obj_t *native_display(mp_obj_t display_obj) {
239239
return MP_OBJ_TO_PTR(native_display);
240240
}
241241

242-
//| def show(self, group: Group) -> None:
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
248-
//| CircuitPython terminal will be shown.
249-
//|
250-
//| :param Group group: The group to show.
251-
//|
252-
//| """
253-
//| ...
254-
STATIC mp_obj_t displayio_display_obj_show(mp_obj_t self_in, mp_obj_t group_in) {
255-
displayio_display_obj_t *self = native_display(self_in);
256-
displayio_group_t *group = NULL;
257-
if (group_in != mp_const_none) {
258-
group = MP_OBJ_TO_PTR(native_group(group_in));
259-
}
260-
261-
bool ok = common_hal_displayio_display_show(self, group);
262-
if (!ok) {
263-
mp_raise_ValueError(translate("Group already used"));
264-
}
265-
return mp_const_none;
266-
}
267-
MP_DEFINE_CONST_FUN_OBJ_2(displayio_display_show_obj, displayio_display_obj_show);
268-
269242
//| def refresh(
270243
//| self,
271244
//| *,
@@ -512,7 +485,6 @@ STATIC mp_obj_t displayio_display_obj_fill_row(size_t n_args, const mp_obj_t *po
512485
MP_DEFINE_CONST_FUN_OBJ_KW(displayio_display_fill_row_obj, 1, displayio_display_obj_fill_row);
513486

514487
STATIC const mp_rom_map_elem_t displayio_display_locals_dict_table[] = {
515-
{ MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&displayio_display_show_obj) },
516488
{ MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&displayio_display_refresh_obj) },
517489
{ MP_ROM_QSTR(MP_QSTR_fill_row), MP_ROM_PTR(&displayio_display_fill_row_obj) },
518490

shared-bindings/displayio/Display.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self,
4646
bool single_byte_bounds, bool data_as_commands, bool auto_refresh, uint16_t native_frames_per_second,
4747
bool backlight_on_high, bool SH1107_addressing, uint16_t backlight_pwm_frequency);
4848

49-
bool common_hal_displayio_display_show(displayio_display_obj_t *self,
50-
displayio_group_t *root_group);
51-
5249
bool common_hal_displayio_display_refresh(displayio_display_obj_t *self, uint32_t target_ms_per_frame, uint32_t maximum_ms_per_real_frame);
5350

5451
bool common_hal_displayio_display_get_auto_refresh(displayio_display_obj_t *self);

shared-bindings/displayio/EPaperDisplay.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -245,31 +245,6 @@ static displayio_epaperdisplay_obj_t *native_display(mp_obj_t display_obj) {
245245
return MP_OBJ_TO_PTR(native_display);
246246
}
247247

248-
//| def show(self, group: Group) -> None:
249-
//| """
250-
//| .. note:: `show()` is deprecated and will be removed in CircuitPython 9.0.0.
251-
//| Use ``.root_group = group`` instead.
252-
//|
253-
//| Switches to displaying the given group of layers. When group is None, the default
254-
//| CircuitPython terminal will be shown.
255-
//|
256-
//| :param Group group: The group to show."""
257-
//| ...
258-
STATIC mp_obj_t displayio_epaperdisplay_obj_show(mp_obj_t self_in, mp_obj_t group_in) {
259-
displayio_epaperdisplay_obj_t *self = native_display(self_in);
260-
displayio_group_t *group = NULL;
261-
if (group_in != mp_const_none) {
262-
group = MP_OBJ_TO_PTR(native_group(group_in));
263-
}
264-
265-
bool ok = common_hal_displayio_epaperdisplay_show(self, group);
266-
if (!ok) {
267-
mp_raise_ValueError(translate("Group already used"));
268-
}
269-
return mp_const_none;
270-
}
271-
MP_DEFINE_CONST_FUN_OBJ_2(displayio_epaperdisplay_show_obj, displayio_epaperdisplay_obj_show);
272-
273248
//| def update_refresh_mode(
274249
//| self, start_sequence: ReadableBuffer, seconds_per_frame: float = 180
275250
//| ) -> None:
@@ -415,7 +390,6 @@ MP_PROPERTY_GETSET(displayio_epaperdisplay_root_group_obj,
415390
(mp_obj_t)&displayio_epaperdisplay_set_root_group_obj);
416391

417392
STATIC const mp_rom_map_elem_t displayio_epaperdisplay_locals_dict_table[] = {
418-
{ MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&displayio_epaperdisplay_show_obj) },
419393
{ MP_ROM_QSTR(MP_QSTR_update_refresh_mode), MP_ROM_PTR(&displayio_epaperdisplay_update_refresh_mode_obj) },
420394
{ MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&displayio_epaperdisplay_refresh_obj) },
421395

shared-bindings/displayio/EPaperDisplay.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t
5252

5353
bool common_hal_displayio_epaperdisplay_refresh(displayio_epaperdisplay_obj_t *self);
5454

55-
bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t *self, displayio_group_t *root_group);
56-
5755
mp_obj_t common_hal_displayio_epaperdisplay_get_root_group(displayio_epaperdisplay_obj_t *self);
5856
bool common_hal_displayio_epaperdisplay_set_root_group(displayio_epaperdisplay_obj_t *self, displayio_group_t *root_group);
5957

shared-bindings/displayio/OnDiskBitmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
//|
5151
//| board.DISPLAY.brightness = 0
5252
//| splash = displayio.Group()
53-
//| board.DISPLAY.show(splash)
53+
//| board.DISPLAY.root_group = splash
5454
//|
5555
//| odb = displayio.OnDiskBitmap('/sample.bmp')
5656
//| face = displayio.TileGrid(odb, pixel_shader=odb.pixel_shader)

shared-bindings/framebufferio/FramebufferDisplay.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -99,27 +99,6 @@ static framebufferio_framebufferdisplay_obj_t *native_display(mp_obj_t display_o
9999
return MP_OBJ_TO_PTR(native_display);
100100
}
101101

102-
//| def show(self, group: displayio.Group) -> None:
103-
//| """Switches to displaying the given group of layers. When group is None, the default
104-
//| CircuitPython terminal will be shown.
105-
//|
106-
//| :param Group group: The group to show."""
107-
//| ...
108-
STATIC mp_obj_t framebufferio_framebufferdisplay_obj_show(mp_obj_t self_in, mp_obj_t group_in) {
109-
framebufferio_framebufferdisplay_obj_t *self = native_display(self_in);
110-
displayio_group_t *group = NULL;
111-
if (group_in != mp_const_none) {
112-
group = MP_OBJ_TO_PTR(native_group(group_in));
113-
}
114-
115-
bool ok = common_hal_framebufferio_framebufferdisplay_show(self, group);
116-
if (!ok) {
117-
mp_raise_ValueError(translate("Group already used"));
118-
}
119-
return mp_const_none;
120-
}
121-
MP_DEFINE_CONST_FUN_OBJ_2(framebufferio_framebufferdisplay_show_obj, framebufferio_framebufferdisplay_obj_show);
122-
123102
//| def refresh(
124103
//| self, *, target_frames_per_second: int = 60, minimum_frames_per_second: int = 1
125104
//| ) -> bool:
@@ -354,7 +333,6 @@ MP_PROPERTY_GETSET(framebufferio_framebufferdisplay_root_group_obj,
354333
(mp_obj_t)&framebufferio_framebufferdisplay_set_root_group_obj);
355334

356335
STATIC const mp_rom_map_elem_t framebufferio_framebufferdisplay_locals_dict_table[] = {
357-
{ MP_ROM_QSTR(MP_QSTR_show), MP_ROM_PTR(&framebufferio_framebufferdisplay_show_obj) },
358336
{ MP_ROM_QSTR(MP_QSTR_refresh), MP_ROM_PTR(&framebufferio_framebufferdisplay_refresh_obj) },
359337
{ MP_ROM_QSTR(MP_QSTR_fill_row), MP_ROM_PTR(&framebufferio_framebufferdisplay_fill_row_obj) },
360338

shared-bindings/framebufferio/FramebufferDisplay.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ void common_hal_framebufferio_framebufferdisplay_construct(framebufferio_framebu
4242
uint16_t rotation,
4343
bool auto_refresh);
4444

45-
bool common_hal_framebufferio_framebufferdisplay_show(framebufferio_framebufferdisplay_obj_t *self,
46-
displayio_group_t *root_group);
47-
4845
bool common_hal_framebufferio_framebufferdisplay_refresh(framebufferio_framebufferdisplay_obj_t *self, uint32_t target_ms_per_frame, uint32_t maximum_ms_per_real_frame);
4946

5047
bool common_hal_framebufferio_framebufferdisplay_get_auto_refresh(framebufferio_framebufferdisplay_obj_t *self);

shared-module/displayio/Display.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,6 @@ void common_hal_displayio_display_construct(displayio_display_obj_t *self,
140140
common_hal_displayio_display_set_auto_refresh(self, auto_refresh);
141141
}
142142

143-
bool common_hal_displayio_display_show(displayio_display_obj_t *self, displayio_group_t *root_group) {
144-
if (root_group == NULL) {
145-
root_group = &circuitpython_splash;
146-
}
147-
return displayio_display_core_set_root_group(&self->core, root_group);
148-
}
149-
150143
uint16_t common_hal_displayio_display_get_width(displayio_display_obj_t *self) {
151144
return displayio_display_core_get_width(&self->core);
152145
}

shared-module/displayio/EPaperDisplay.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,7 @@ void common_hal_displayio_epaperdisplay_construct(displayio_epaperdisplay_obj_t
116116

117117
// Set the group after initialization otherwise we may send pixels while we delay in
118118
// initialization.
119-
common_hal_displayio_epaperdisplay_show(self, &circuitpython_splash);
120-
}
121-
122-
bool common_hal_displayio_epaperdisplay_show(displayio_epaperdisplay_obj_t *self, displayio_group_t *root_group) {
123-
if (root_group == NULL) {
124-
root_group = &circuitpython_splash;
125-
}
126-
return displayio_display_core_set_root_group(&self->core, root_group);
119+
common_hal_displayio_epaperdisplay_set_root_group(self, &circuitpython_splash);
127120
}
128121

129122
bool common_hal_displayio_epaperdisplay_set_root_group(displayio_epaperdisplay_obj_t *self, displayio_group_t *root_group) {
@@ -503,6 +496,11 @@ void release_epaperdisplay(displayio_epaperdisplay_obj_t *self) {
503496
}
504497
}
505498

499+
void displayio_epaperdisplay_reset(displayio_epaperdisplay_obj_t *self) {
500+
displayio_display_core_set_root_group(&self->core, &circuitpython_splash);
501+
self->core.full_refresh = true;
502+
}
503+
506504
void displayio_epaperdisplay_collect_ptrs(displayio_epaperdisplay_obj_t *self) {
507505
displayio_display_core_collect_ptrs(&self->core);
508506
gc_collect_ptr((void *)self->start_sequence);

shared-module/displayio/EPaperDisplay.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ typedef struct {
6262
void displayio_epaperdisplay_change_refresh_mode_parameters(displayio_epaperdisplay_obj_t *self,
6363
mp_buffer_info_t *start_sequence, float seconds_per_frame);
6464
void displayio_epaperdisplay_background(displayio_epaperdisplay_obj_t *self);
65+
void displayio_epaperdisplay_reset(displayio_epaperdisplay_obj_t *self);
6566
void release_epaperdisplay(displayio_epaperdisplay_obj_t *self);
6667
size_t maybe_refresh_epaperdisplay(void);
6768

0 commit comments

Comments
 (0)