Skip to content

Commit 4d0a913

Browse files
committed
Bump to 1.2.2
- Add date created and modified to tree view - Make tree column labels translatable
1 parent 748896c commit 4d0a913

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

QOpenScienceFramework/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "1.2.1"
1+
__version__ = "1.2.2"
22
__author__ = "Daniel Schreij"
33

44
import os

QOpenScienceFramework/widgets/projecttree.py

+19-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import QOpenScienceFramework.connection as osf
1919
# Fileinspector for determining filetypes
2020
import fileinspector
21+
# For better time functions
22+
import arrow
2123
# For presenting numbers in human readible formats
2224
import humanize
2325
# Unix style filename matching
@@ -95,7 +97,8 @@ def __init__(self, manager, use_theme=None, theme_path='./resources/iconthemes')
9597
self.setWindowIcon(osf_icon)
9698

9799
# Set column labels
98-
self.setHeaderLabels(["Name","Kind","Size"])
100+
self.setHeaderLabels([_("Name"), _("Kind"), _("Size"), _("Created"),
101+
_("Modified")])
99102
self.setColumnWidth(0,300)
100103

101104
# Event handling
@@ -486,7 +489,21 @@ def add_item(self, parent, data):
486489

487490
values = [name, kind]
488491
if "size" in data["attributes"] and data["attributes"]["size"]:
489-
values += [humanize.naturalsize(data["attributes"]["size"])]
492+
values += [ humanize.naturalsize(data["attributes"]["size"]) ]
493+
else:
494+
values += ['']
495+
496+
if "date_created" in data["attributes"]:
497+
cArrow = arrow.get(data["attributes"]["date_created"]).to('local')
498+
values += [ cArrow.format('YYYY-MM-DD') ]
499+
else:
500+
values += ['']
501+
502+
if "date_modified" in data["attributes"]:
503+
mArrow = arrow.get(data["attributes"]["date_modified"]).to('local')
504+
values += [ mArrow.format('YYYY-MM-DD') ]
505+
else:
506+
values += ['']
490507

491508
# Create item
492509
item = QtWidgets.QTreeWidgetItem(parent, values)

0 commit comments

Comments
 (0)