Skip to content
Browse files
[processing] move custom parameter definition inside corresponding
  • Loading branch information
alexbruy committed Nov 18, 2016
1 parent fc18fd9 commit f70a3b9e1d8bb5a55aaa0aff4c923b2156916d06
@@ -16,6 +16,7 @@
* *
from __future__ import print_function
from builtins import str
from builtins import range

@@ -33,11 +34,10 @@
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.core.parameters import ParameterTable
from processing.core.parameters import Parameter
from processing.core.outputs import OutputVector
from import dataobjects, vector

from .fieldsmapping import ParameterFieldsMapping

class FieldsMapper(GeoAlgorithm):

@@ -55,6 +55,38 @@ def defineCharacteristics(self):
self.addParameter(ParameterTable(self.INPUT_LAYER,'Input layer'),

class ParameterFieldsMapping(Parameter):

default_metadata = {
'widget_wrapper': 'processing.algs.qgis.ui.FieldsMappingPanel.FieldsMappingWidgetWrapper'

def __init__(self, name='', description='', parent=None):
Parameter.__init__(self, name, description)
self.parent = parent
self.value = []

def getValueAsCommandLineParameter(self):
return '"' + str(self.value) + '"'

def setValue(self, value):
if value is None:
return False
if isinstance(value, list):
self.value = value
return True
if isinstance(value, str):
self.value = eval(value)
return True
except Exception as e:
# fix_print_with_import
print(str(e)) # display error in console
return False
return False

self.addParameter(ParameterFieldsMapping(self.FIELDS_MAPPING,'Fields mapping'),

This file was deleted.

0 comments on commit f70a3b9

Please sign in to comment.