Skip to content

Commit cd5fe31

Browse files
About app: show logo at the top
1 parent e1d3f1a commit cd5fe31

File tree

10 files changed

+32
-44
lines changed

10 files changed

+32
-44
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
0.7.0
22
=====
3+
- About app: show MicroPythonOS logo at the top
34
- AppStore app: fix BadgeHub backend handling
45
- OSUpdate app: eliminate requests library
56
- Remove dependency on micropython-esp32-ota library

internal_filesystem/apps/com.micropythonos.draw/META-INF/MANIFEST.JSON

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"publisher": "MicroPythonOS",
44
"short_description": "Simple drawing app",
55
"long_description": "Draw simple shapes on the screen.",
6-
"icon_url": "https://apps.micropythonos.com/apps/com.micropythonos.draw/icons/com.micropythonos.draw_0.0.5_64x64.png",
7-
"download_url": "https://apps.micropythonos.com/apps/com.micropythonos.draw/mpks/com.micropythonos.draw_0.0.5.mpk",
6+
"icon_url": "https://apps.micropythonos.com/apps/com.micropythonos.draw/icons/com.micropythonos.draw_0.1.0_64x64.png",
7+
"download_url": "https://apps.micropythonos.com/apps/com.micropythonos.draw/mpks/com.micropythonos.draw_0.1.0.mpk",
88
"fullname": "com.micropythonos.draw",
9-
"version": "0.0.5",
9+
"version": "0.1.0",
1010
"category": "graphics",
1111
"activities": [
1212
{
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

internal_filesystem/builtin/apps/com.micropythonos.about/assets/about.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
from mpos import Activity, DisplayMetrics, BuildInfo, DeviceInfo
2-
31
import sys
42

3+
from mpos import Activity, DisplayMetrics, BuildInfo, DeviceInfo
4+
55
class About(Activity):
66

7-
def _add_label(self, parent, text, is_header=False):
7+
def _add_label(self, parent, text, is_header=False, margin_top=DisplayMetrics.pct_of_height(5)):
88
"""Helper to create and add a label with text."""
99
label = lv.label(parent)
1010
label.set_text(text)
1111
if is_header:
1212
primary_color = lv.theme_get_color_primary(None)
1313
label.set_style_text_color(primary_color, 0)
1414
label.set_style_text_font(lv.font_montserrat_14, 0)
15-
label.set_style_margin_top(12, 0)
16-
label.set_style_margin_bottom(4, 0)
15+
label.set_style_margin_top(margin_top, 0)
16+
label.set_style_margin_bottom(DisplayMetrics.pct_of_height(2), 0)
1717
else:
1818
label.set_style_text_font(lv.font_montserrat_12, 0)
1919
label.set_style_margin_bottom(2, 0)
@@ -37,23 +37,34 @@ def onCreate(self):
3737
screen = lv.obj()
3838
screen.set_style_border_width(0, 0)
3939
screen.set_flex_flow(lv.FLEX_FLOW.COLUMN)
40-
screen.set_style_pad_all(DisplayMetrics.pct_of_width(2), 0)
40+
screen.set_style_pad_all(DisplayMetrics.pct_of_width(2), lv.PART.MAIN)
4141
# Make the screen focusable so it can be scrolled with the arrow keys
4242
focusgroup = lv.group_get_default()
4343
if focusgroup:
4444
focusgroup.add_obj(screen)
4545

46+
# Logo
47+
img = lv.image(screen)
48+
img.set_src("M:builtin/res/mipmap-mdpi/MicroPythonOS-logo-white-long-w296.png") # from the MPOS-logo repo
49+
img.set_blend_mode(lv.BLEND_MODE.DIFFERENCE)
50+
4651
# Basic OS info
47-
self._add_label(screen, f"{lv.SYMBOL.HOME} System Information", is_header=True)
48-
self._add_label(screen, f"MicroPythonOS version: {BuildInfo.version.release}")
52+
self._add_label(screen, f"{lv.SYMBOL.HOME} Build Information", is_header=True, margin_top=0) # close to logo
53+
self._add_label(screen, f"Release version: {BuildInfo.version.release}")
54+
self._add_label(screen, f"API Level: {BuildInfo.version.api_level}")
4955
self._add_label(screen, f"Hardware ID: {DeviceInfo.hardware_id}")
5056
self._add_label(screen, f"sys.version: {sys.version}")
5157
self._add_label(screen, f"sys.implementation: {sys.implementation}")
5258
self._add_label(screen, f"sys.byteorder: {sys.byteorder}")
5359
self._add_label(screen, f"sys.maxsize of integer: {sys.maxsize}")
5460

61+
# Platform info
62+
self._add_label(screen, f"{lv.SYMBOL.FILE} Platform", is_header=True)
63+
self._add_label(screen, f"sys.platform: {sys.platform}")
64+
self._add_label(screen, f"sys.path: {sys.path}")
65+
5566
# MPY version info
56-
self._add_label(screen, f"{lv.SYMBOL.SETTINGS} MicroPython Version", is_header=True)
67+
self._add_label(screen, f"{lv.SYMBOL.SETTINGS} Binary MPY Format", is_header=True)
5768
sys_mpy = sys.implementation._mpy
5869
self._add_label(screen, f'mpy version: {sys_mpy & 0xff}')
5970
self._add_label(screen, f'mpy sub-version: {sys_mpy >> 8 & 3}')
@@ -68,11 +79,6 @@ def onCreate(self):
6879
if len(flags) > 0:
6980
self._add_label(screen, 'mpy flags: ' + flags)
7081

71-
# Platform info
72-
self._add_label(screen, f"{lv.SYMBOL.FILE} Platform", is_header=True)
73-
self._add_label(screen, f"sys.platform: {sys.platform}")
74-
self._add_label(screen, f"sys.path: {sys.path}")
75-
7682
# MicroPython and memory info
7783
self._add_label(screen, f"{lv.SYMBOL.DRIVE} Memory & Performance", is_header=True)
7884
import micropython

internal_filesystem/lib/mpos/build_info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ class BuildInfo:
99
class version:
1010
"""Version information."""
1111

12-
release = "0.7.0" # Human-readable version: "0.7.0"
13-
sdk_int = 0 # API level: 0
12+
release = "0.7.0"
13+
api_level = 0 # subject to change until API Level 1

internal_filesystem/lib/mpos/main.py

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,6 @@
77

88
from mpos import AppearanceManager, DisplayMetrics, AppManager, SharedPreferences, TaskManager, DeviceInfo
99

10-
# White text on black logo works (for dark mode) and can be inverted (for light mode)
11-
logo_white = "M:builtin/res/mipmap-mdpi/MicroPythonOS-logo-white-long-w296.png" # from the MPOS-logo repo
12-
13-
# Black text on transparent logo works (for light mode) but can't be inverted (for dark mode)
14-
# Even when trying different blend modes (SUBTRACTIVE, ADDITIVE, MULTIPLY)
15-
# Even when it's on a white (instead of transparent) background
16-
#logo_black = "M:builtin/res/mipmap-mdpi/MicroPythonOS-logo-black-long-w240.png"
17-
18-
1910
def init_rootscreen():
2011
"""Initialize the root screen and set display metrics."""
2112
screen = lv.screen_active()
@@ -26,24 +17,14 @@ def init_rootscreen():
2617

2718
# Initialize DisplayMetrics with actual display values
2819
DisplayMetrics.set_resolution(width, height)
29-
DisplayMetrics.set_dpi(dpi)
30-
20+
DisplayMetrics.set_dpi(dpi)
3121
print(f"init_rootscreen set resolution to {width}x{height} at {dpi} DPI")
3222

33-
try:
34-
img = lv.image(screen)
35-
img.set_src(logo_white)
36-
img.set_blend_mode(lv.BLEND_MODE.DIFFERENCE)
37-
img.center()
38-
except Exception as e: # if image loading fails
39-
print(f"ERROR: logo image failed, LVGL will be in a bad state and the UI will hang: {e}")
40-
import sys
41-
sys.print_exception(e)
42-
print("Trying to fall back to a simple text-based 'logo' but it won't showup because the UI broke...")
43-
label = lv.label(screen)
44-
label.set_text("MicroPythonOS")
45-
label.set_style_text_font(lv.font_montserrat_20, lv.PART.MAIN)
46-
label.center()
23+
# Show logo
24+
img = lv.image(screen)
25+
img.set_src("M:builtin/res/mipmap-mdpi/MicroPythonOS-logo-white-long-w296.png") # from the MPOS-logo repo
26+
img.set_blend_mode(lv.BLEND_MODE.DIFFERENCE)
27+
img.center()
4728

4829
def detect_board():
4930
import sys

0 commit comments

Comments
 (0)