Skip to content

Commit

Permalink
Merge 6fd0613 into b78e821
Browse files Browse the repository at this point in the history
  • Loading branch information
TEParsons committed Oct 20, 2020
2 parents b78e821 + 6fd0613 commit 094183f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions psychopy/app/builder/dialogs/__init__.py
Expand Up @@ -155,7 +155,8 @@ def __init__(self, dlg, label, param, parent, fieldName,
elif param.valType == 'fileList':
self.valueCtrl = FileListCtrl(parent,
choices=param.val,
size=wx.Size(self.valueWidth, 100)
size=wx.Size(self.valueWidth, 100),
pathtype="rel"
)
elif len(param.allowedVals) > 1:
# there are limited options - use a Choice control
Expand Down Expand Up @@ -1932,9 +1933,10 @@ def show(self):
return wx.ID_OK

class FileListCtrl(wx.ListBox):
def __init__(self, parent, choices=[], size=None):
def __init__(self, parent, choices=[], size=None, pathtype="rel"):
wx.ListBox.__init__(self)
parent.Bind(wx.EVT_DROP_FILES, self.addItem)
self.app = parent.app
if type(choices) == str:
choices = data.utils.listFromString(choices)
self.Create(id=wx.ID_ANY, parent=parent, choices=choices, size=size, style=wx.LB_EXTENDED | wx.LB_HSCROLL)
Expand All @@ -1956,8 +1958,12 @@ def addItem(self, event):
wildcard=_translate(_wld))
if dlg.ShowModal() != wx.ID_OK:
return 0
filename = dlg.GetPaths()
self.InsertItems(filename, 0)
filenames = dlg.GetPaths()
relname = []
for filename in filenames:
relname.append(
os.path.relpath(filename, self.GetTopLevelParent().frame.filename))
self.InsertItems(relname, 0)
else:
fileList = event.GetFiles()
for filename in fileList:
Expand Down

0 comments on commit 094183f

Please sign in to comment.