get_user_inputs doesn't have retvals defaults
DMDComposer opened this issue · 0 comments
DMDComposer commented
Hi,
I was wondering why get_user_inputs within reapy doesn't have the retvals default params as a param in the function. From my understanding, simply adding it is a defaults="", and using csv string would be simpler but perhaps something more fitting could be fitted.
def get_user_inputs(title, captions, defaults="", retvals_size=1024):
"""Show text inputs to user and get values from them.
Parameters
----------
title : str
Popup title.
captions : List[str]
Names of input fields.
defaults: str
default retvals_csv
retvals_size : int, optional
Maximum number of characters that will be retrieved for each
field. User may enter more, but only the first `retvals_size`
will be returned. (default=1024)
Returns
-------
Dict[str,str]
Dictionary of pairs {caption: response}.
Raises
------
RuntimeError
When user clicked the Cancel button.
"""
success, _, _, _, retvals_csv, _ = RPR.GetUserInputs(
title, len(captions), ",".join(captions), defaults, retvals_size
)
if success:
return dict(zip(captions, retvals_csv.split(",")))
else:
raise RuntimeError("User clicked Cancel.")