You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
About app: more robust
This commit is contained in:
@@ -87,24 +87,30 @@ class About(Activity):
|
||||
label11.set_text(f"freezefs_mount_builtin exception (normal on dev builds): {e}")
|
||||
# Disk usage:
|
||||
import os
|
||||
stat = os.statvfs('/')
|
||||
total_space = stat[0] * stat[2]
|
||||
free_space = stat[0] * stat[3]
|
||||
used_space = total_space - free_space
|
||||
label20 = lv.label(screen)
|
||||
label20.set_text(f"Total space in /: {total_space} bytes")
|
||||
label21 = lv.label(screen)
|
||||
label21.set_text(f"Free space in /: {free_space} bytes")
|
||||
label22 = lv.label(screen)
|
||||
label22.set_text(f"Used space in /: {used_space} bytes")
|
||||
stat = os.statvfs('/sdcard')
|
||||
total_space = stat[0] * stat[2]
|
||||
free_space = stat[0] * stat[3]
|
||||
used_space = total_space - free_space
|
||||
label23 = lv.label(screen)
|
||||
label23.set_text(f"Total space /sdcard: {total_space} bytes")
|
||||
label24 = lv.label(screen)
|
||||
label24.set_text(f"Free space /sdcard: {free_space} bytes")
|
||||
label25 = lv.label(screen)
|
||||
label25.set_text(f"Used space /sdcard: {used_space} bytes")
|
||||
try:
|
||||
stat = os.statvfs('/')
|
||||
total_space = stat[0] * stat[2]
|
||||
free_space = stat[0] * stat[3]
|
||||
used_space = total_space - free_space
|
||||
label20 = lv.label(screen)
|
||||
label20.set_text(f"Total space in /: {total_space} bytes")
|
||||
label21 = lv.label(screen)
|
||||
label21.set_text(f"Free space in /: {free_space} bytes")
|
||||
label22 = lv.label(screen)
|
||||
label22.set_text(f"Used space in /: {used_space} bytes")
|
||||
except Exception as e:
|
||||
print(f"About app could not get info on / filesystem: {e}")
|
||||
try:
|
||||
stat = os.statvfs('/sdcard')
|
||||
total_space = stat[0] * stat[2]
|
||||
free_space = stat[0] * stat[3]
|
||||
used_space = total_space - free_space
|
||||
label23 = lv.label(screen)
|
||||
label23.set_text(f"Total space /sdcard: {total_space} bytes")
|
||||
label24 = lv.label(screen)
|
||||
label24.set_text(f"Free space /sdcard: {free_space} bytes")
|
||||
label25 = lv.label(screen)
|
||||
label25.set_text(f"Used space /sdcard: {used_space} bytes")
|
||||
except Exception as e:
|
||||
print(f"About app could not get info on /sdcard filesystem: {e}")
|
||||
self.setContentView(screen)
|
||||
|
||||
Reference in New Issue
Block a user