1
0
mirror of https://github.com/qgis/QGIS.git synced 2025-04-25 00:03:06 -04:00

[processing] Make ParameterFixedTable scriptable

This commit is contained in:
Matthias Kuhn 2016-12-21 13:44:00 +01:00
parent 2af00beddc
commit 0a686c4fca

@ -561,12 +561,19 @@ class ParameterFixedTable(Parameter):
tablestring = tablestring[:-1] tablestring = tablestring[:-1]
return tablestring return tablestring
def getAsScriptCode(self):
param_type = ''
if self.optional:
param_type += 'optional '
param_type += 'fixedtable'
return '##' + self.name + '=' + param_type
@classmethod @classmethod
def fromScriptCode(self, line): def fromScriptCode(self, line):
isOptional, name, definition = _splitParameterOptions(line) isOptional, name, definition = _splitParameterOptions(line)
if definition.startswith("point"): if definition.startswith("fixedtable"):
descName = _createDescriptiveName(name) descName = _createDescriptiveName(name)
default = definition.strip()[len('point') + 1:] or None default = definition.strip()[len('fixedtable') + 1:] or None
return ParameterFixedTable(name, descName, default, isOptional) return ParameterFixedTable(name, descName, default, isOptional)