Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
irods-clients
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RDM Infrastructure
irods-clients
Commits
3dcd1cec
Commit
3dcd1cec
authored
3 years ago
by
Staiger, Christine
Browse files
Options
Downloads
Patches
Plain Diff
Adding metadata and preview to ticket view
parent
9e160cd1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gui/irodsTicketLogin.py
+93
-1
93 additions, 1 deletion
gui/irodsTicketLogin.py
gui/ui-files/tabTicketAccess.ui
+89
-59
89 additions, 59 deletions
gui/ui-files/tabTicketAccess.ui
with
182 additions
and
60 deletions
gui/irodsTicketLogin.py
+
93
−
1
View file @
3dcd1cec
from
PyQt5
import
QtWidgets
from
PyQt5.QtWidgets
import
QMainWindow
,
QHeaderView
,
QMessageBox
from
PyQt5
import
QtCore
from
PyQt5.uic
import
loadUi
from
utils.irodsConnectorAnonymous
import
irodsConnectorAnonymous
from
gui.checkableFsTree
import
checkableFsTreeModel
import
os
class
irodsTicketLogin
():
...
...
@@ -8,10 +11,26 @@ class irodsTicketLogin():
self
.
ic
=
None
self
.
coll
=
None
self
.
widget
=
widget
# QTreeViews
self
.
dirmodel
=
checkableFsTreeModel
(
self
.
widget
.
localFsTreeView
)
self
.
widget
.
localFsTreeView
.
setModel
(
self
.
dirmodel
)
# Hide all columns except the Name
self
.
widget
.
localFsTreeView
.
setColumnHidden
(
1
,
True
)
self
.
widget
.
localFsTreeView
.
setColumnHidden
(
2
,
True
)
self
.
widget
.
localFsTreeView
.
setColumnHidden
(
3
,
True
)
self
.
widget
.
localFsTreeView
.
header
().
setSectionResizeMode
(
QHeaderView
.
ResizeToContents
)
home_location
=
QtCore
.
QStandardPaths
.
standardLocations
(
QtCore
.
QStandardPaths
.
HomeLocation
)[
0
]
index
=
self
.
dirmodel
.
setRootPath
(
home_location
)
self
.
widget
.
localFsTreeView
.
setCurrentIndex
(
index
)
self
.
dirmodel
.
initial_expand
()
self
.
widget
.
connectButton
.
clicked
.
connect
(
self
.
irodsSession
)
self
.
widget
.
homeButton
.
clicked
.
connect
(
self
.
loadTable
)
self
.
widget
.
collTable
.
doubleClicked
.
connect
(
self
.
browse
)
self
.
widget
.
collTable
.
clicked
.
connect
(
self
.
fillInfo
)
def
irodsSession
(
self
):
self
.
widget
.
infoLabel
.
clear
()
...
...
@@ -70,3 +89,76 @@ class irodsTicketLogin():
if
self
.
ic
.
session
.
collections
.
exists
(
path
+
'
/
'
+
item
):
coll
=
self
.
ic
.
session
.
collections
.
get
(
path
+
'
/
'
+
item
)
self
.
loadTable
(
update
=
coll
)
def
fillInfo
(
self
,
index
):
self
.
widget
.
previewBrowser
.
clear
()
self
.
widget
.
metadataTable
.
setRowCount
(
0
)
row
=
index
.
row
()
value
=
self
.
widget
.
collTable
.
item
(
row
,
1
).
text
()
path
=
self
.
widget
.
collTable
.
item
(
row
,
0
).
text
()
try
:
self
.
__fillPreview
(
value
,
path
)
self
.
__fillMetadata
(
value
,
path
)
except
Exception
as
e
:
self
.
widget
.
infoLabel
.
setText
(
repr
(
e
))
raise
def
__fillPreview
(
self
,
value
,
path
):
newPath
=
"
/
"
+
path
.
strip
(
"
/
"
)
+
"
/
"
+
value
.
strip
(
"
/
"
)
if
self
.
ic
.
session
.
collections
.
exists
(
newPath
):
# collection
coll
=
self
.
ic
.
session
.
collections
.
get
(
newPath
)
content
=
[
'
Collections:
'
,
'
-----------------
'
]
+
\
[
c
.
name
+
'
/
'
for
c
in
coll
.
subcollections
]
+
\
[
'
\n
'
,
'
Data:
'
,
'
-----------------
'
]
+
\
[
o
.
name
for
o
in
coll
.
data_objects
]
previewString
=
'
\n
'
.
join
(
content
)
self
.
widget
.
previewBrowser
.
append
(
previewString
)
else
:
# object
subcoll
=
self
.
ic
.
session
.
collections
.
get
(
path
)
obj
=
[
o
for
o
in
subcoll
.
data_objects
if
o
.
name
==
value
][
0
]
# get mimetype
mimetype
=
value
.
split
(
"
.
"
)[
len
(
value
.
split
(
"
.
"
))
-
1
]
if
mimetype
in
[
'
txt
'
,
'
json
'
,
'
csv
'
]:
try
:
out
=
[]
with
obj
.
open
(
'
r
'
)
as
readObj
:
for
i
in
range
(
20
):
out
.
append
(
readObj
.
read
(
50
))
previewString
=
''
.
join
([
line
.
decode
(
'
utf-8
'
)
for
line
in
out
])
self
.
widget
.
previewBrowser
.
append
(
previewString
)
except
Exception
as
e
:
self
.
widget
.
previewBrowser
.
append
(
obj
.
path
)
self
.
widget
.
previewBrowser
.
append
(
repr
(
e
))
self
.
widget
.
previewBrowser
.
append
(
"
Storage resource might be down.
"
)
else
:
self
.
widget
.
previewBrowser
.
append
(
"
No preview for
"
+
obj
.
path
)
def
__fillMetadata
(
self
,
value
,
path
):
newPath
=
"
/
"
+
path
.
strip
(
"
/
"
)
+
"
/
"
+
value
.
strip
(
"
/
"
)
metadata
=
[]
if
value
.
endswith
(
"
/
"
)
and
self
.
ic
.
session
.
collections
.
exists
(
newPath
):
coll
=
self
.
ic
.
session
.
collections
.
get
(
"
/
"
+
path
.
strip
(
"
/
"
)
+
"
/
"
+
value
.
strip
(
"
/
"
)
)
metadata
=
coll
.
metadata
.
items
()
else
:
subcoll
=
self
.
ic
.
session
.
collections
.
get
(
path
)
obj
=
[
o
for
o
in
subcoll
.
data_objects
if
o
.
name
==
value
][
0
]
metadata
=
obj
.
metadata
.
items
()
self
.
widget
.
metadataTable
.
setRowCount
(
len
(
metadata
))
row
=
0
for
item
in
metadata
:
self
.
widget
.
metadataTable
.
setItem
(
row
,
0
,
QtWidgets
.
QTableWidgetItem
(
item
.
name
))
self
.
widget
.
metadataTable
.
setItem
(
row
,
1
,
QtWidgets
.
QTableWidgetItem
(
item
.
value
))
self
.
widget
.
metadataTable
.
setItem
(
row
,
2
,
QtWidgets
.
QTableWidgetItem
(
item
.
units
))
row
=
row
+
1
self
.
widget
.
metadataTable
.
resizeColumnsToContents
()
This diff is collapsed.
Click to expand it.
gui/ui-files/tabTicketAccess.ui
+
89
−
59
View file @
3dcd1cec
...
...
@@ -111,13 +111,10 @@ QLabel#infoLabel
</widget>
</item>
<item>
<spacer
name=
"verticalSpacer"
>
<spacer
name=
"verticalSpacer
_3
"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeType"
>
<enum>
QSizePolicy::Maximum
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
...
...
@@ -127,45 +124,76 @@ QLabel#infoLabel
</spacer>
</item>
<item>
<widget
class=
"QTableWidget"
name=
"collTable"
>
<property
name=
"sizeAdjustPolicy"
>
<enum>
QAbstractScrollArea::AdjustToContents
</enum>
</property>
<property
name=
"editTriggers"
>
<set>
QAbstractItemView::NoEditTriggers
</set>
</property>
<property
name=
"selectionMode"
>
<enum>
QAbstractItemView::MultiSelection
</enum>
</property>
<property
name=
"selectionBehavior"
>
<enum>
QAbstractItemView::SelectRows
</enum>
</property>
<column>
<property
name=
"text"
>
<string>
Path
</string>
</property>
</column>
<column>
<property
name=
"text"
>
<string>
Name
</string>
</property>
</column>
<column>
<property
name=
"text"
>
<string>
Size
</string>
</property>
</column>
<column>
<property
name=
"text"
>
<string>
Checksum
</string>
</property>
</column>
<column>
<property
name=
"text"
>
<string>
Last modified
</string>
</property>
</column>
</widget>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_3"
>
<item>
<widget
class=
"QTableWidget"
name=
"collTable"
>
<property
name=
"sizeAdjustPolicy"
>
<enum>
QAbstractScrollArea::AdjustToContents
</enum>
</property>
<property
name=
"editTriggers"
>
<set>
QAbstractItemView::NoEditTriggers
</set>
</property>
<property
name=
"selectionMode"
>
<enum>
QAbstractItemView::MultiSelection
</enum>
</property>
<property
name=
"selectionBehavior"
>
<enum>
QAbstractItemView::SelectRows
</enum>
</property>
<column>
<property
name=
"text"
>
<string>
Path
</string>
</property>
</column>
<column>
<property
name=
"text"
>
<string>
Name
</string>
</property>
</column>
<column>
<property
name=
"text"
>
<string>
Size
</string>
</property>
</column>
<column>
<property
name=
"text"
>
<string>
Checksum
</string>
</property>
</column>
<column>
<property
name=
"text"
>
<string>
Last modified
</string>
</property>
</column>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"downloadButton_2"
>
<property
name=
"text"
>
<string/>
</property>
<property
name=
"icon"
>
<iconset>
<normaloff>
../icons/arrow-right.png
</normaloff>
../icons/arrow-right.png
</iconset>
</property>
<property
name=
"iconSize"
>
<size>
<width>
30
</width>
<height>
30
</height>
</size>
</property>
</widget>
</item>
<item>
<widget
class=
"QTreeView"
name=
"localFsTreeView"
>
<property
name=
"selectionMode"
>
<enum>
QAbstractItemView::NoSelection
</enum>
</property>
<property
name=
"selectionBehavior"
>
<enum>
QAbstractItemView::SelectItems
</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
...
...
@@ -193,22 +221,24 @@ QLabel#infoLabel
</property>
</spacer>
</item>
<item>
<widget
class=
"QPushButton"
name=
"downloadButton"
>
<property
name=
"text"
>
<string>
Download all
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"downloadSelectionButton"
>
<property
name=
"text"
>
<string>
Download selected
</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeType"
>
<enum>
QSizePolicy::Maximum
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
<item>
<widget
class=
"QTabWidget"
name=
"tabWidget"
>
<property
name=
"currentIndex"
>
...
...
@@ -220,7 +250,7 @@ QLabel#infoLabel
</attribute>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_3"
>
<item>
<widget
class=
"QTextBrowser"
name=
"
text
Browser"
/>
<widget
class=
"QTextBrowser"
name=
"
preview
Browser"
/>
</item>
</layout>
</widget>
...
...
@@ -230,7 +260,7 @@ QLabel#infoLabel
</attribute>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_2"
>
<item>
<widget
class=
"QTableWidget"
name=
"
tableWidget_2
"
>
<widget
class=
"QTableWidget"
name=
"
metadataTable
"
>
<property
name=
"editTriggers"
>
<set>
QAbstractItemView::NoEditTriggers
</set>
</property>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment