About app: show logo at the top

This commit is contained in:
Thomas Farstrike
2026-01-26 11:05:32 +01:00
parent e1d3f1a279
commit cd5fe31bbf
10 changed files with 32 additions and 44 deletions
+2 -2
View File
@@ -9,5 +9,5 @@ class BuildInfo:
class version:
"""Version information."""
release = "0.7.0" # Human-readable version: "0.7.0"
sdk_int = 0 # API level: 0
release = "0.7.0"
api_level = 0 # subject to change until API Level 1
+6 -25
View File
@@ -7,15 +7,6 @@ import mpos.ui.topmenu
from mpos import AppearanceManager, DisplayMetrics, AppManager, SharedPreferences, TaskManager, DeviceInfo
# White text on black logo works (for dark mode) and can be inverted (for light mode)
logo_white = "M:builtin/res/mipmap-mdpi/MicroPythonOS-logo-white-long-w296.png" # from the MPOS-logo repo
# Black text on transparent logo works (for light mode) but can't be inverted (for dark mode)
# Even when trying different blend modes (SUBTRACTIVE, ADDITIVE, MULTIPLY)
# Even when it's on a white (instead of transparent) background
#logo_black = "M:builtin/res/mipmap-mdpi/MicroPythonOS-logo-black-long-w240.png"
def init_rootscreen():
"""Initialize the root screen and set display metrics."""
screen = lv.screen_active()
@@ -26,24 +17,14 @@ def init_rootscreen():
# Initialize DisplayMetrics with actual display values
DisplayMetrics.set_resolution(width, height)
DisplayMetrics.set_dpi(dpi)
DisplayMetrics.set_dpi(dpi)
print(f"init_rootscreen set resolution to {width}x{height} at {dpi} DPI")
try:
img = lv.image(screen)
img.set_src(logo_white)
img.set_blend_mode(lv.BLEND_MODE.DIFFERENCE)
img.center()
except Exception as e: # if image loading fails
print(f"ERROR: logo image failed, LVGL will be in a bad state and the UI will hang: {e}")
import sys
sys.print_exception(e)
print("Trying to fall back to a simple text-based 'logo' but it won't showup because the UI broke...")
label = lv.label(screen)
label.set_text("MicroPythonOS")
label.set_style_text_font(lv.font_montserrat_20, lv.PART.MAIN)
label.center()
# Show logo
img = lv.image(screen)
img.set_src("M:builtin/res/mipmap-mdpi/MicroPythonOS-logo-white-long-w296.png") # from the MPOS-logo repo
img.set_blend_mode(lv.BLEND_MODE.DIFFERENCE)
img.center()
def detect_board():
import sys