Skip to content

Commit

Permalink
FF: Added getDeviceParamsFlattenned function
Browse files Browse the repository at this point in the history
returns flat version of getDeviceParams.
  • Loading branch information
isolver committed Apr 12, 2021
1 parent 2498b9b commit 70bf4c9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions psychopy/iohub/util/__init__.py
Expand Up @@ -398,6 +398,20 @@ def settings2Params(parent_list, settings):
settings2Params([], device_params)
return device_params

def getDeviceParamsFlattenned(device_name):
flattenned = {}
dconf = getDeviceParams(device_name)
def flatten_dict(d):
for k, v in d.items():
if isinstance(v, dict):
if v.get('inputType'):
flattenned[v.get('label')] = v
else:
flatten_dict(v)
flatten_dict(dconf)
return flattenned


if sys.platform == 'win32':
import pythoncom

Expand Down

0 comments on commit 70bf4c9

Please sign in to comment.