Repository: psychopy/psychopy

Issue:
PsychoPy3 GUI returns list instead of string
In PsychoPy 3.0.0.10b on Windows, gui-DlgFromDict returns a list of characters instead of a string when presenting options. Minimal example:

    from psychopy import gui
    vars = {'gender': ['male', 'female']}
    gui.DlgFromDict(vars)
    print(vars)

Returns either ``['m','a','l','e']`` or ``['f','e','m','a','l','e']`` when it should return either ``'male'`` or ``'female'``.

This is also true of the ``inputs --> GUI.py`` demo.
PsychoPy3 GUI returns list instead of string
In PsychoPy 3.0.0.10b on Windows, gui-DlgFromDict returns a list of characters instead of a string when presenting options. Minimal example:

    from psychopy import gui
    vars = {'gender': ['male', 'female']}
    gui.DlgFromDict(vars)
    print(vars)

Returns either ``['m','a','l','e']`` or ``['f','e','m','a','l','e']`` when it should return either ``'male'`` or ``'female'``.

This is also true of the ``inputs --> GUI.py`` demo.


Discussion:

Resolving patch:
diff --git a/psychopy/__init__.py b/psychopy/__init__.py
--- a/psychopy/__init__.py
+++ b/psychopy/__init__.py
@@ -12,7 +12,7 @@
 import os
 import sys
 
-__version__ = '3.0.0b10'
+__version__ = '3.0.0b11'
 __license__ = 'GNU GPLv3 (or more recent equivalent)'
 __author__ = 'Jonathan Peirce'
 __author_email__ = 'jon.peirce@gmail.com'
diff --git a/psychopy/gui/qtgui.py b/psychopy/gui/qtgui.py
--- a/psychopy/gui/qtgui.py
+++ b/psychopy/gui/qtgui.py
@@ -79,7 +79,7 @@ def __init__(self, title=_translate('PsychoPy Dialog'),
         QtWidgets.QDialog.__init__(self, None, Qt.WindowTitleHint)
 
         self.inputFields = []
-        self.inputFieldTypes = []
+        self.inputFieldTypes = {}
         self.inputFieldNames = []
         self.data = []
         self.irow = 0
@@ -147,9 +147,9 @@ def addField(self, label='', initial='', color='', choices=None, tip='',
         """
         self.inputFieldNames.append(label)
         if choices:
-            self.inputFieldTypes.append(str)
+            self.inputFieldTypes[label] = str
         else:
-            self.inputFieldTypes.append(type(initial))
+            self.inputFieldTypes[label] = type(initial)
         if type(initial) == np.ndarray:
             initial = initial.tolist()
 
@@ -436,7 +436,6 @@ def __init__(self, dictionary, title='', fixed=None, order=None,
             self.dictionary = dictionary
 
         self._keys = list(self.dictionary.keys())
-        self.types = dict()
 
         if order:
             self._keys = list(order) + list(set(self._keys).difference(set(order)))
@@ -444,7 +443,6 @@ def __init__(self, dictionary, title='', fixed=None, order=None,
             self._keys.sort()
 
         for field in self._keys:
-            self.types[field] = type(self.dictionary[field])
             label = labels[field] if field in labels else field
             tooltip = ''
             if field in tip:
@@ -467,7 +465,7 @@ def show(self):
         if ok_data:
             for n, thisKey in enumerate(self._keys):
                 try:
-                    self.dictionary[thisKey] = self.types[thisKey](self.data[n])
+                    self.dictionary[thisKey] = self.inputFieldTypes[thisKey](self.data[n])
                 except ValueError:
                     self.dictionary[thisKey] = self.data[n]
 
diff --git a/setupApp.py b/setupApp.py
--- a/setupApp.py
+++ b/setupApp.py
@@ -133,7 +133,8 @@ def dyld_find(name, loader=None, **kwargs):
                   CFBundleLicense            = "GNU GPLv3+",
                   CFBundleDocumentTypes=[dict(CFBundleTypeExtensions=['*'],
                                               CFBundleTypeRole='Editor')],
-                  LSEnvironment=dict(PATH="/usr/local/git/bin:/usr/local/bin:/usr/local:/usr/bin"),
+                  LSEnvironment=dict(PATH="/usr/local/git/bin:/usr/local/bin:"
+                                          "/usr/local:/usr/bin:/usr/sbin"),
             ),
     ))  # end of the options dict
 )


Test patch: