Skip to content

Commit afa7bd5

Browse files
authored
Update display.py
Logo at boot IMPORTANT: change the url to a correct location and put this logo there https://github.com/QuasiKili/MPOS-logo/blob/main/all_formats/MicroPythonOS-logo-white-long-w240.png
1 parent f327ee3 commit afa7bd5

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

internal_filesystem/lib/mpos/ui/display.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# lib/mpos/ui/display.py
22
import lvgl as lv
3+
from mpos.ui.theme import _is_light_mode
34

45
_horizontal_resolution = None
56
_vertical_resolution = None
67
_dpi = None
78

9+
logo_url="M:lib/assets/MicroPythonOS-logo-white-long-w240.png" # change this
10+
811
def init_rootscreen():
912
global _horizontal_resolution, _vertical_resolution, _dpi
1013
screen = lv.screen_active()
@@ -13,9 +16,16 @@ def init_rootscreen():
1316
_vertical_resolution = disp.get_vertical_resolution()
1417
_dpi = disp.get_dpi()
1518
print(f"init_rootscreen set resolution to {_horizontal_resolution}x{_vertical_resolution} at {_dpi} DPI")
16-
label = lv.label(screen)
17-
label.set_text("Welcome to MicroPythonOS")
18-
label.center()
19+
try:
20+
img = lv.image(screen)
21+
img.set_src(logo_url)
22+
if _is_light_mode:
23+
img.set_blend_mode(lv.BLEND_MODE.DIFFERENCE) # invert the logo color
24+
img.center()
25+
except: # if image loading fails
26+
label = lv.label(screen)
27+
label.set_text("MicroPythonOS")
28+
label.center()
1929

2030
def get_pointer_xy():
2131
indev = lv.indev_active()
@@ -50,4 +60,4 @@ def get_display_height():
5060
def get_dpi():
5161
print(f"get_dpi_called {_dpi}")
5262
return _dpi
53-
63+

0 commit comments

Comments
 (0)