diff --git a/pype/tools/workfiles/app.py b/pype/tools/workfiles/app.py
index fc5109fabf..7cbafc8fb2 100644
--- a/pype/tools/workfiles/app.py
+++ b/pype/tools/workfiles/app.py
@@ -4,6 +4,7 @@ import copy
import getpass
import shutil
import logging
+import datetime
import Qt
from Qt import QtWidgets, QtCore
@@ -856,13 +857,36 @@ class SidePanelWidget(QtWidgets.QWidget):
self._orig_note = orig_note
self.note_input.setPlainText(orig_note)
+ # Set as empty string
+ self.details_input.setPlainText("")
- # filename = os.path.basename(filepath)
filestat = os.stat(filepath)
+ size_ending_mapping = {
+ "KB": 1024 ** 1,
+ "MB": 1024 ** 2,
+ "GB": 1024 ** 3
+ }
+ size = filestat.st_size
+ ending = "B"
+ for _ending, _size in size_ending_mapping.items():
+ if filestat.st_size < _size:
+ break
+ size = filestat.st_size / _size
+ ending = _ending
+
+ # Append html string
+ datetime_format = "%b %d %Y %H:%M:%S"
+ creation_time = datetime.datetime.fromtimestamp(filestat.st_ctime)
+ modification_time = datetime.datetime.fromtimestamp(filestat.st_mtime)
lines = (
- "Size: {}".format(filestat.st_size),
+ "Size:",
+ "{:.2f} {}".format(size, ending),
+ "Created:",
+ creation_time.strftime(datetime_format),
+ "Modified:",
+ modification_time.strftime(datetime_format)
)
- self.details_input.setPlainText("\n".join(lines))
+ self.details_input.appendHtml("
".join(lines))
def get_workfile_data(self):
data = {