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
+1
View File
@@ -1,5 +1,6 @@
0.7.0
=====
- About app: show MicroPythonOS logo at the top
- AppStore app: fix BadgeHub backend handling
- OSUpdate app: eliminate requests library
- Remove dependency on micropython-esp32-ota library
@@ -3,10 +3,10 @@
"publisher": "MicroPythonOS",
"short_description": "Simple drawing app",
"long_description": "Draw simple shapes on the screen.",
"icon_url": "https://apps.micropythonos.com/apps/com.micropythonos.draw/icons/com.micropythonos.draw_0.0.5_64x64.png",
"download_url": "https://apps.micropythonos.com/apps/com.micropythonos.draw/mpks/com.micropythonos.draw_0.0.5.mpk",
"icon_url": "https://apps.micropythonos.com/apps/com.micropythonos.draw/icons/com.micropythonos.draw_0.1.0_64x64.png",
"download_url": "https://apps.micropythonos.com/apps/com.micropythonos.draw/mpks/com.micropythonos.draw_0.1.0.mpk",
"fullname": "com.micropythonos.draw",
"version": "0.0.5",
"version": "0.1.0",
"category": "graphics",
"activities": [
{
Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

@@ -1,10 +1,10 @@
from mpos import Activity, DisplayMetrics, BuildInfo, DeviceInfo
import sys
from mpos import Activity, DisplayMetrics, BuildInfo, DeviceInfo
class About(Activity):
def _add_label(self, parent, text, is_header=False):
def _add_label(self, parent, text, is_header=False, margin_top=DisplayMetrics.pct_of_height(5)):
"""Helper to create and add a label with text."""
label = lv.label(parent)
label.set_text(text)
@@ -12,8 +12,8 @@ class About(Activity):
primary_color = lv.theme_get_color_primary(None)
label.set_style_text_color(primary_color, 0)
label.set_style_text_font(lv.font_montserrat_14, 0)
label.set_style_margin_top(12, 0)
label.set_style_margin_bottom(4, 0)
label.set_style_margin_top(margin_top, 0)
label.set_style_margin_bottom(DisplayMetrics.pct_of_height(2), 0)
else:
label.set_style_text_font(lv.font_montserrat_12, 0)
label.set_style_margin_bottom(2, 0)
@@ -37,23 +37,34 @@ class About(Activity):
screen = lv.obj()
screen.set_style_border_width(0, 0)
screen.set_flex_flow(lv.FLEX_FLOW.COLUMN)
screen.set_style_pad_all(DisplayMetrics.pct_of_width(2), 0)
screen.set_style_pad_all(DisplayMetrics.pct_of_width(2), lv.PART.MAIN)
# Make the screen focusable so it can be scrolled with the arrow keys
focusgroup = lv.group_get_default()
if focusgroup:
focusgroup.add_obj(screen)
# 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)
# Basic OS info
self._add_label(screen, f"{lv.SYMBOL.HOME} System Information", is_header=True)
self._add_label(screen, f"MicroPythonOS version: {BuildInfo.version.release}")
self._add_label(screen, f"{lv.SYMBOL.HOME} Build Information", is_header=True, margin_top=0) # close to logo
self._add_label(screen, f"Release version: {BuildInfo.version.release}")
self._add_label(screen, f"API Level: {BuildInfo.version.api_level}")
self._add_label(screen, f"Hardware ID: {DeviceInfo.hardware_id}")
self._add_label(screen, f"sys.version: {sys.version}")
self._add_label(screen, f"sys.implementation: {sys.implementation}")
self._add_label(screen, f"sys.byteorder: {sys.byteorder}")
self._add_label(screen, f"sys.maxsize of integer: {sys.maxsize}")
# Platform info
self._add_label(screen, f"{lv.SYMBOL.FILE} Platform", is_header=True)
self._add_label(screen, f"sys.platform: {sys.platform}")
self._add_label(screen, f"sys.path: {sys.path}")
# MPY version info
self._add_label(screen, f"{lv.SYMBOL.SETTINGS} MicroPython Version", is_header=True)
self._add_label(screen, f"{lv.SYMBOL.SETTINGS} Binary MPY Format", is_header=True)
sys_mpy = sys.implementation._mpy
self._add_label(screen, f'mpy version: {sys_mpy & 0xff}')
self._add_label(screen, f'mpy sub-version: {sys_mpy >> 8 & 3}')
@@ -68,11 +79,6 @@ class About(Activity):
if len(flags) > 0:
self._add_label(screen, 'mpy flags: ' + flags)
# Platform info
self._add_label(screen, f"{lv.SYMBOL.FILE} Platform", is_header=True)
self._add_label(screen, f"sys.platform: {sys.platform}")
self._add_label(screen, f"sys.path: {sys.path}")
# MicroPython and memory info
self._add_label(screen, f"{lv.SYMBOL.DRIVE} Memory & Performance", is_header=True)
import micropython
+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