Skip to content

Commit

Permalink
human redeable date
Browse files Browse the repository at this point in the history
  • Loading branch information
tonymorony committed Mar 2, 2020
1 parent 570b193 commit d0da772
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from lib import sharelib
import threading
import time
import datetime

# TODO: make it as a setting?
ac_name = "FILET1"
Expand Down Expand Up @@ -38,7 +39,8 @@ def update_files_list(files_table, update_status_label):
for file in files_list_response:
# TODO: convert file size to human readable
file_size = sharelib.convert_size(float(file["amountA"]) * (10**8))
files_table.insert("", "end", text=file["id"], values=[file["timestamp"], file["tagB"],
readable_date = datetime.datetime.fromtimestamp(file["timestamp"]).isoformat()
files_table.insert("", "end", text=file["id"], values=[readable_date, file["tagB"],
file["senderpub"], file_size])
update_status_label['text'] = "Last update: " + time.ctime() + " (auto-update each 30s)"
root.after(30000, lambda: update_files_list(files_table, update_status_label))
Expand All @@ -56,6 +58,7 @@ def update_files_list(files_table, update_status_label):

file_select_button = tk.Button(root, text="Choose file to upload",
command=lambda: sharelib.select_file(file_path_var))
# TODO: print there selected file name for better UX
file_upload_button = tk.Button(root, text="Upload selected file",
command=lambda: sharelib.upload_file(file_path_var, file_uploading_proxy,
previous_uploading_progress))
Expand Down

0 comments on commit d0da772

Please sign in to comment.