Skip to content

Commit 5098537

Browse files
Kevin MatochaKevin Matocha
Kevin Matocha
authored and
Kevin Matocha
committed
add a root_group property to the display, reset the REPL position when display.show(None) is called.
1 parent db0140f commit 5098537

File tree

1,473 files changed

+32
-43163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,473 files changed

+32
-43163
lines changed

shared-bindings/displayio/Display.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,23 @@ const mp_obj_property_t displayio_display_bus_obj = {
444444
MP_ROM_NONE},
445445
};
446446

447+
//| root_group: _Group
448+
//| """The root group on the display."""
449+
//|
450+
//|
451+
STATIC mp_obj_t displayio_display_obj_get_root_group(mp_obj_t self_in) {
452+
displayio_display_obj_t *self = native_display(self_in);
453+
return common_hal_displayio_display_get_root_group(self);
454+
}
455+
MP_DEFINE_CONST_FUN_OBJ_1(displayio_display_get_root_group_obj, displayio_display_obj_get_root_group);
456+
457+
const mp_obj_property_t displayio_display_root_group_obj = {
458+
.base.type = &mp_type_property,
459+
.proxy = {(mp_obj_t)&displayio_display_get_root_group_obj,
460+
MP_ROM_NONE,
461+
MP_ROM_NONE},
462+
};
463+
447464

448465
//| def fill_row(self, y: int, buffer: WriteableBuffer) -> WriteableBuffer:
449466
//| """Extract the pixels from a single row
@@ -517,6 +534,7 @@ STATIC const mp_rom_map_elem_t displayio_display_locals_dict_table[] = {
517534
{ MP_ROM_QSTR(MP_QSTR_height), MP_ROM_PTR(&displayio_display_height_obj) },
518535
{ MP_ROM_QSTR(MP_QSTR_rotation), MP_ROM_PTR(&displayio_display_rotation_obj) },
519536
{ MP_ROM_QSTR(MP_QSTR_bus), MP_ROM_PTR(&displayio_display_bus_obj) },
537+
{ MP_ROM_QSTR(MP_QSTR_root_group), MP_ROM_PTR(&displayio_display_root_group_obj) },
520538
};
521539
STATIC MP_DEFINE_CONST_DICT(displayio_display_locals_dict, displayio_display_locals_dict_table);
522540

shared-bindings/displayio/Display.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ mp_float_t common_hal_displayio_display_get_brightness(displayio_display_obj_t *
6969
bool common_hal_displayio_display_set_brightness(displayio_display_obj_t *self, mp_float_t brightness);
7070

7171
mp_obj_t common_hal_displayio_display_get_bus(displayio_display_obj_t *self);
72-
72+
mp_obj_t common_hal_displayio_display_get_root_group(displayio_display_obj_t *self);
7373

7474
#endif // MICROPY_INCLUDED_SHARED_BINDINGS_DISPLAYIO_DISPLAY_H

shared-bindings/supervisor/__init__.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ STATIC const mp_rom_map_elem_t supervisor_module_globals_table[] = {
324324
{ MP_ROM_QSTR(MP_QSTR_ticks_ms), MP_ROM_PTR(&supervisor_ticks_ms_obj) },
325325
{ MP_ROM_QSTR(MP_QSTR_get_previous_traceback), MP_ROM_PTR(&supervisor_get_previous_traceback_obj) },
326326
{ MP_ROM_QSTR(MP_QSTR_disable_ble_workflow), MP_ROM_PTR(&supervisor_disable_ble_workflow_obj) },
327-
{ MP_ROM_QSTR(MP_QSTR_splash), MP_ROM_PTR(&circuitpython_splash) },
328327
{ MP_ROM_QSTR(MP_QSTR_reset_terminal), MP_ROM_PTR(&supervisor_reset_terminal_obj) },
329328
};
330329

shared-module/board/__init__.c

Lines changed: 0 additions & 234 deletions
This file was deleted.

shared-module/displayio/Display.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ mp_obj_t common_hal_displayio_display_get_bus(displayio_display_obj_t *self) {
220220
return self->core.bus;
221221
}
222222

223+
mp_obj_t common_hal_displayio_display_get_root_group(displayio_display_obj_t *self) {
224+
return self->core.current_group;
225+
}
226+
223227
STATIC const displayio_area_t *_get_refresh_areas(displayio_display_obj_t *self) {
224228
if (self->core.full_refresh) {
225229
self->core.area.next = NULL;

shared-module/displayio/display_core.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,15 @@ void displayio_display_core_set_rotation(displayio_display_core_t *self,
163163
}
164164

165165
bool displayio_display_core_show(displayio_display_core_t *self, displayio_group_t *root_group) {
166-
if (root_group == NULL) {
167-
if (!circuitpython_splash.in_group) {
168-
root_group = &circuitpython_splash;
169-
} else if (self->current_group == &circuitpython_splash) {
170-
return true;
171-
}
166+
167+
if (root_group == NULL) { // set the display to the REPL, reset REPL position and size
168+
circuitpython_splash.in_group = false;
169+
// force the circuit_python_splash out of any group (Note: could cause problems with the parent group)
170+
circuitpython_splash.x = 0; // reset position in case someone moved it.
171+
circuitpython_splash.y = 0;
172+
supervisor_stop_terminal();
173+
supervisor_start_terminal(self->width, self->height);
174+
root_group = &circuitpython_splash;
172175
}
173176
if (root_group == self->current_group) {
174177
return true;

supervisor/shared/display.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#if CIRCUITPY_TERMINALIO
3333

3434
#include "shared-bindings/displayio/Bitmap.h"
35-
#include "shared-bindings/displayio/Group.h"
3635
#include "shared-bindings/displayio/TileGrid.h"
3736
#include "shared-bindings/fontio/BuiltinFont.h"
3837
#include "shared-bindings/terminalio/Terminal.h"
@@ -46,7 +45,6 @@ extern const fontio_builtinfont_t supervisor_terminal_font;
4645
extern displayio_bitmap_t supervisor_terminal_font_bitmap;
4746
extern displayio_tilegrid_t supervisor_terminal_text_grid;
4847
extern terminalio_terminal_obj_t supervisor_terminal;
49-
extern displayio_group_t circuitpython_splash;
5048

5149
#endif
5250

tests/README

Lines changed: 0 additions & 27 deletions
This file was deleted.

tests/basics/0prelim.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/basics/andor.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/basics/annotate_var.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)