Device metrics in the sidebar

Added functions to enable device monitoring in the sidebar by tapping on their respective metric boxes.
This commit is contained in:
FrogAi
2024-02-27 16:34:47 -07:00
parent 8f2cb1dd53
commit 3794b4f06b
6 changed files with 127 additions and 4 deletions

View File

@@ -27,3 +27,14 @@ def get_available_bytes(default=None):
available_bytes = default
return available_bytes
def get_used_bytes(default=None):
try:
statvfs = os.statvfs(Paths.log_root())
total_bytes = statvfs.f_blocks * statvfs.f_frsize
available_bytes = statvfs.f_bavail * statvfs.f_frsize
used_bytes = total_bytes - available_bytes
except OSError:
used_bytes = default
return used_bytes