Skip to content

Commit

Permalink
[processing] Show accepted data types for parameters in processing.al…
Browse files Browse the repository at this point in the history
…gorithmHelp
  • Loading branch information
nyalldawson committed May 31, 2018
1 parent 0bbaa3b commit db916bc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion python/plugins/processing/tools/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,16 @@ def algorithmHelp(id):
if isinstance(p, QgsProcessingParameterEnum):
opts = []
for i, o in enumerate(p.options()):
opts.append('\t\t{} - {}'.format(i, o))
opts.append('\t\t- {}: {}'.format(i, o))
print('\n\tAvailable values:\n{}'.format('\n'.join(opts)))

parameter_type = QgsApplication.processingRegistry().parameterType(p.type())
accepted_types = parameter_type.acceptedPythonTypes() if parameter_type is not None else []
if accepted_types:
opts = []
for t in accepted_types:
opts.append('\t\t- {}'.format(t))
print('\n\tAccepted data types:')
print('\n'.join(opts))

print('\n----------------')
Expand Down

0 comments on commit db916bc

Please sign in to comment.