Support of python arguments type with annotations
In a python script, the user can ask for options, with their type and their default value, such as:
def run_on(context, *, number:int=0, file_to_write:(open, 'w')='out.txt', list_of_elements:['banana', 'peach']='peach'):
...
The following option types are expected to be found:
-
int: to get a natural number -
float: to get a float -
bool: a checkbox -
str: to get some text. When the default value have multiple lines, the widget must provide support for multilines. -
[...] (list/tuple of elements): a combobox, to choose one of the given elements -
{...} (set of elements): a "multi combobox" ? to choose a subset of the given elements -
open: a file (should be received as a filename, not a handler) -
(open, 'r'): an (existing) readable file (idem) -
(open, 'w'): a writable file (idem) -
range(X, Y, Z): to get any number belonging to given range
@dridk just check the box when the support is successful. The script test_option_types.py
is here to help.