About app: more robust

This commit is contained in:
Thomas Farstrike
2025-11-30 23:17:54 +01:00
parent 01faf1d20b
commit eff01581aa
@@ -87,24 +87,30 @@ class About(Activity):
label11.set_text(f"freezefs_mount_builtin exception (normal on dev builds): {e}") label11.set_text(f"freezefs_mount_builtin exception (normal on dev builds): {e}")
# Disk usage: # Disk usage:
import os import os
stat = os.statvfs('/') try:
total_space = stat[0] * stat[2] stat = os.statvfs('/')
free_space = stat[0] * stat[3] total_space = stat[0] * stat[2]
used_space = total_space - free_space free_space = stat[0] * stat[3]
label20 = lv.label(screen) used_space = total_space - free_space
label20.set_text(f"Total space in /: {total_space} bytes") label20 = lv.label(screen)
label21 = lv.label(screen) label20.set_text(f"Total space in /: {total_space} bytes")
label21.set_text(f"Free space in /: {free_space} bytes") label21 = lv.label(screen)
label22 = lv.label(screen) label21.set_text(f"Free space in /: {free_space} bytes")
label22.set_text(f"Used space in /: {used_space} bytes") label22 = lv.label(screen)
stat = os.statvfs('/sdcard') label22.set_text(f"Used space in /: {used_space} bytes")
total_space = stat[0] * stat[2] except Exception as e:
free_space = stat[0] * stat[3] print(f"About app could not get info on / filesystem: {e}")
used_space = total_space - free_space try:
label23 = lv.label(screen) stat = os.statvfs('/sdcard')
label23.set_text(f"Total space /sdcard: {total_space} bytes") total_space = stat[0] * stat[2]
label24 = lv.label(screen) free_space = stat[0] * stat[3]
label24.set_text(f"Free space /sdcard: {free_space} bytes") used_space = total_space - free_space
label25 = lv.label(screen) label23 = lv.label(screen)
label25.set_text(f"Used space /sdcard: {used_space} bytes") 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) self.setContentView(screen)