Get size for paths
This commit is contained in:
parent
d61daff685
commit
fa07c3c99e
|
@ -2752,18 +2752,6 @@ def _set_column_model(columns):
|
|||
return column_model
|
||||
|
||||
|
||||
def _set_image_url(image, id_extension=''):
|
||||
if exists_path(image):
|
||||
return _path_url(image)
|
||||
|
||||
if not id_extension:
|
||||
return ''
|
||||
|
||||
path = get_path_extension(id_extension)
|
||||
path = join(path, DIR['images'], image)
|
||||
return _path_url(path)
|
||||
|
||||
|
||||
class LODialog(object):
|
||||
|
||||
def __init__(self, **properties):
|
||||
|
@ -3287,26 +3275,6 @@ def get_dir(init_dir=''):
|
|||
return path
|
||||
|
||||
|
||||
# ~ Export ok
|
||||
def json_dumps(data):
|
||||
return json.dumps(data, indent=4, sort_keys=True)
|
||||
|
||||
|
||||
# ~ Export ok
|
||||
def json_loads(data):
|
||||
return json.loads(data)
|
||||
|
||||
|
||||
# ~ Export ok
|
||||
def get_file_size(path):
|
||||
return Path(path).stat().st_size
|
||||
|
||||
|
||||
# ~ Export ok
|
||||
def is_created(path):
|
||||
return is_file(path) and bool(get_file_size(path))
|
||||
|
||||
|
||||
# ~ Export ok
|
||||
def zip_content(path):
|
||||
with zipfile.ZipFile(path) as z:
|
||||
|
|
|
@ -3694,6 +3694,10 @@ class Paths(object):
|
|||
def url(self):
|
||||
return self._path.as_uri()
|
||||
|
||||
@property
|
||||
def size(self):
|
||||
return self._path.stat().st_size
|
||||
|
||||
@classproperty
|
||||
def home(self):
|
||||
return str(Path.home())
|
||||
|
|
Loading…
Reference in New Issue