Skip to content

Commit

Permalink
[processing] add enums support for fields and feature source parameters
Browse files Browse the repository at this point in the history
(follow up 068d74d)
  • Loading branch information
alexbruy committed Feb 11, 2018
1 parent 367aba1 commit 1785093
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions python/plugins/processing/core/parameters.py
Expand Up @@ -118,7 +118,10 @@ def getParameterFromString(s):
params[5] = True if params[5].lower() == 'true' else False
elif clazz == QgsProcessingParameterFeatureSource:
if len(params) > 2:
params[2] = [int(p) for p in params[2].split(';')]
try:
params[2] = [int(p) for p in params[2].split(';')]
except:
params[2] = [getattr(QgsProcessing, p.split(".")[1]) for p in params[2].split(';')]
if len(params) > 4:
params[4] = True if params[4].lower() == 'true' else False
elif clazz == QgsProcessingParameterMultipleLayers:
Expand All @@ -136,9 +139,14 @@ def getParameterFromString(s):
params[3] = True if params[3].lower() == 'true' else False
if len(params) > 4:
params[4] = params[4].split(';')
if len(params) > 6:
params[6] = True if params[6].lower() == 'true' else False
elif clazz == QgsProcessingParameterField:
if len(params) > 4:
params[4] = int(params[4])
try:
params[4] = int(params[4])
except:
params[4] = getattr(QgsProcessingParameterField, params[4].split(".")[1])
if len(params) > 5:
params[5] = True if params[5].lower() == 'true' else False
if len(params) > 6:
Expand Down

0 comments on commit 1785093

Please sign in to comment.