Skip to content

Commit

Permalink
[processing] more work on parameter wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Oct 5, 2016
1 parent e353d22 commit bc06600
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
15 changes: 13 additions & 2 deletions python/plugins/processing/core/parameters.py
Expand Up @@ -106,8 +106,10 @@ class Parameter:
take as input.
"""

default_metadata = {}

default_metadata = {
'widget_wrapper': 'processing.gui.wrappers.BasicWidgetWrapper'
}

def __init__(self, name='', description='', default=None, optional=False,
metadata={}):
self.name = name
Expand Down Expand Up @@ -870,6 +872,11 @@ def getValueAsCommandLineParameter(self):


class ParameterRange(Parameter):

default_metadata = {
'widget_wrapper': 'processing.gui.wrappers.BasicWidgetWrapper'
}


def __init__(self, name='', description='', default=None, optional=False):
Parameter.__init__(self, name, description, default, optional)
Expand Down Expand Up @@ -1461,6 +1468,10 @@ def fromScriptCode(self, line):

class ParameterGeometryPredicate(Parameter):

default_metadata = {
'widget_wrapper': 'processing.gui.wrappers.BasicWidgetWrapper'
}

predicates = ('intersects',
'contains',
'disjoint',
Expand Down
23 changes: 23 additions & 0 deletions python/plugins/processing/gui/wrappers.py
Expand Up @@ -17,6 +17,7 @@
* *
***************************************************************************
"""
from gui.GeometryPredicateSelectionPanel import GeometryPredicateSelectionPanel

__author__ = 'Arnaud Morvan'
__date__ = 'May 2016'
Expand Down Expand Up @@ -131,6 +132,17 @@ def postInitialize(self, wrappers):
def refresh(self):
pass

class BasicWidgetWrapper(WidgetWrapper):

def createWidget(self):
return QLineEdit()

def setValue(self, value):
self.widget.setText(value)

def value(self):
return self.widget.text()


class BooleanWidgetWrapper(WidgetWrapper):

Expand Down Expand Up @@ -792,3 +804,14 @@ def anotherParameterWidgetHasChanged(self,wrapper):
self.widget.addItem(self.tr(self.NOT_SET))
self.widget.addItems(self.getFields(layer, wrapper.param.datatype))


def GeometryPredicateWidgetWrapper(WidgetWrapper):

def createWidget(self):
return GeometryPredicateSelectionPanel()

def setValue(self, value):
self.widget.setValue(value)

def value(self):
return self.widget.value()

0 comments on commit bc06600

Please sign in to comment.