About app: add free, used and total storage space info

This commit is contained in:
Thomas Farstrike
2025-11-30 15:30:32 +01:00
parent 059e1e51ea
commit e40fe8fdb2
2 changed files with 24 additions and 3 deletions
+2
View File
@@ -2,9 +2,11 @@
=====
- Fri3d Camp 2024 Badge: workaround ADC2+WiFi conflict by temporarily disable WiFi to measure battery level
- Fri3d Camp 2024 Badge: improve battery monitor calibration to fix 0.1V delta
- About app: add free, used and total storage space info
- AppStore app: remove unnecessary scrollbar over publisher's name
- OSUpdate app: pause download when wifi is lost, resume when reconnected
- Settings app: fix un-checking of radio button
- ImageView app: add support for grayscale images
- API: SharedPreferences: add erase_all() functionality
- API: improve and cleanup animations
@@ -85,7 +85,26 @@ class About(Activity):
print("main.py: WARNING: could not import/run freezefs_mount_builtin: ", e)
label11 = lv.label(screen)
label11.set_text(f"freezefs_mount_builtin exception (normal on dev builds): {e}")
# TODO:
# - add total size, used and free space on internal storage
# - add total size, used and free space on SD card
# 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")
self.setContentView(screen)