Changes to file size and file size formatting func

Make the human readable response use powers of 1000 instead of 1024
Add a flat rate of 4000 to any returned file size to attempt to get a bit more accurate to the real file size
This commit is contained in:
heliguy
2023-11-29 03:29:41 -05:00
parent 39163d124e
commit e8fb7ef981
2 changed files with 4 additions and 6 deletions

View File

@@ -1,4 +1,4 @@
from gi.repository import GLib, Gtk, Adw #, Gdk, Gio
from gi.repository import GLib, Gtk, Adw, Gio #, Gdk
import os
import subprocess
import pathlib
@@ -28,7 +28,7 @@ class myUtils:
return self.getSizeFormat(self.getDirectorySize(path))
def getSizeFormat(self, b):
factor = 1024
factor = 1000
suffix = "B"
for unit in ["", "K", "M", "G", "T", "P", "E", "Z"]:
if b < factor:
@@ -61,7 +61,8 @@ class myUtils:
return 0
if total == 0:
return 0
return total + 1500
# Adding 4000 seems to make it more accurate to whatever data we can't scan from within the sandbox
return total + 4000
def findAppIcon(self, app_id):
icon_theme = Gtk.IconTheme.new()

View File

@@ -716,6 +716,3 @@ class WarehouseWindow(Adw.ApplicationWindow):
if Config.DEVEL:
self.add_css_class("devel")