mirror of
https://github.com/morgan9e/warehouse
synced 2026-04-14 00:04:08 +09:00
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:
@@ -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()
|
||||
|
||||
@@ -716,6 +716,3 @@ class WarehouseWindow(Adw.ApplicationWindow):
|
||||
if Config.DEVEL:
|
||||
self.add_css_class("devel")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user