Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
Bump to v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dschreij committed Mar 2, 2017
1 parent 92b5798 commit 84ee93d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -950,19 +950,32 @@ def __inject_context_menu_items(self, item, context_menu):
data = item.data(0,QtCore.Qt.UserRole)
kind = data["attributes"]["kind"]

user_has_write_permissions = False
try:
user_has_write_permissions = "write" in \
data["attributes"]["current_user_permissions"]
except AttributeError as e:
raise osf.OSFInvalidResponse('Could not retrieve permission info: '
'{}'.format(e))

firstAction = context_menu.actions()[0]
if kind == 'folder':
# Sync experiment entry
sync_experiment = QtWidgets.QAction(QtGui.QIcon.fromTheme('gcolor2'),
_(u"Link experiment here"),
context_menu)
sync_experiment.triggered.connect(self.__link_experiment_to_osf)
if not user_has_write_permissions:
sync_experiment.setDisabled(True)
context_menu.insertAction(firstAction, sync_experiment)

# Sync data entry
sync_data = QtWidgets.QAction(QtGui.QIcon.fromTheme('mail-outbox'),
_(u"Link as data folder"),
context_menu)
sync_data.triggered.connect(self.__link_data_to_osf)
if not user_has_write_permissions:
sync_data.setDisabled(True)
context_menu.insertAction(firstAction, sync_data)
context_menu.insertSeparator(firstAction)
elif kind == "file":
Expand Down Expand Up @@ -1196,7 +1209,15 @@ def __set_button_availabilty(self, tree_widget_item, col):

# The save button should only be present when a folder
# or an OpenSesame file is selected.
if kind == "folder":
user_has_write_permissions = False
try:
user_has_write_permissions = "write" in \
data["attributes"]["current_user_permissions"]
except AttributeError as e:
raise osf.OSFInvalidResponse('Could not retrieve permission info: '
'{}'.format(e))

if kind == "folder" and user_has_write_permissions:
self.button_link_exp_to_osf.setDisabled(False)
self.button_link_data_to_osf.setDisabled(False)
else:
Expand Down
2 changes: 1 addition & 1 deletion opensesame_extensions/OpenScienceFramework/info.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
label: OSF
version: 1.0.12
version: 1.1.0
author: Daniel Schreij
link : https://github.com/dschreij/opensesame-osf

0 comments on commit 84ee93d

Please sign in to comment.