Skip to content

Commit db916bc

Browse files
committedMay 31, 2018
[processing] Show accepted data types for parameters in processing.algorithmHelp
1 parent 0bbaa3b commit db916bc

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed
 

‎python/plugins/processing/tools/general.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,16 @@ def algorithmHelp(id):
6464
if isinstance(p, QgsProcessingParameterEnum):
6565
opts = []
6666
for i, o in enumerate(p.options()):
67-
opts.append('\t\t{} - {}'.format(i, o))
67+
opts.append('\t\t- {}: {}'.format(i, o))
68+
print('\n\tAvailable values:\n{}'.format('\n'.join(opts)))
69+
70+
parameter_type = QgsApplication.processingRegistry().parameterType(p.type())
71+
accepted_types = parameter_type.acceptedPythonTypes() if parameter_type is not None else []
72+
if accepted_types:
73+
opts = []
74+
for t in accepted_types:
75+
opts.append('\t\t- {}'.format(t))
76+
print('\n\tAccepted data types:')
6877
print('\n'.join(opts))
6978

7079
print('\n----------------')

0 commit comments

Comments
 (0)
Please sign in to comment.