mirror of
https://git.srhtnin.garden/sarah/SaraView.git
synced 2026-10-15 02:43:17 +02:00
Fixed download sizes and directory highlighting
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
843ad1986e
commit
d4c018a402
8 files changed
+113
-37
No files matched your search
@@ -539,6 +539,17 @@ def HumanSize(NumBytes: Optional[int]) -> str:
|
||||
return f"{Size:.1f} TB"
|
||||
|
||||
|
||||
def HumanDuration(Seconds: float) -> str:
|
||||
"""Roughly, for "about ... left": 8 s, 3 min, 1 h, 1 h 20 min."""
|
||||
Seconds = max(1, round(Seconds))
|
||||
if Seconds < 60:
|
||||
return f"{Seconds} s"
|
||||
Hours, Minutes = divmod(round(Seconds / 60), 60)
|
||||
if not Hours:
|
||||
return f"{Minutes} min"
|
||||
return f"{Hours} h {Minutes} min" if Minutes else f"{Hours} h"
|
||||
|
||||
|
||||
def DisplayPath(PathText: str) -> str:
|
||||
"""/home/sarah/Notes -> ~/Notes, for labels (C:\\Users\\x\\Notes -> ~\\Notes)."""
|
||||
HomeText = str(Home)
|
||||
|
||||
Reference in new issue
Block a user