mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
About app: show logo at the top
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user