From db916bc238082db27d1771a0d55839f40dd86edd Mon Sep 17 00:00:00 2001 From: Nyall Dawson <nyall.dawson@gmail.com> Date: Wed, 30 May 2018 07:54:20 +1000 Subject: [PATCH] [processing] Show accepted data types for parameters in processing.algorithmHelp --- python/plugins/processing/tools/general.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/python/plugins/processing/tools/general.py b/python/plugins/processing/tools/general.py index 8066c93256c..7011cb02f2d 100644 --- a/python/plugins/processing/tools/general.py +++ b/python/plugins/processing/tools/general.py @@ -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----------------')