Skip to content
Permalink
Browse files
[sextante] file selector and iterator buttons can be hidden now in pa…
…rameters dialog if algorithm does not support them
  • Loading branch information
volaya committed Jul 23, 2013
1 parent 4c39d27 commit 6bcf10f0f61001f3b6c29711b026473ec8b9df94
@@ -56,6 +56,7 @@ class RandomSelection(GeoAlgorithm):
#===========================================================================

def defineCharacteristics(self):
self.allowOnlyOpenedLayers = True
self.name = "Random selection"
self.group = "Vector selection tools"

@@ -55,6 +55,7 @@ class RandomSelectionWithinSubsets(GeoAlgorithm):
#===========================================================================

def defineCharacteristics(self):
self.allowOnlyOpenedLayers = True
self.name = "Random selection within subsets"
self.group = "Vector selection tools"

@@ -51,6 +51,7 @@ class SelectByLocation(GeoAlgorithm):
#===========================================================================

def defineCharacteristics(self):
self.allowOnlyOpenedLayers = True
self.name = "Select by location"
self.group = "Vector selection tools"
self.addParameter(ParameterVector(self.INPUT, "Layer to select from", ParameterVector.VECTOR_TYPE_ANY))
@@ -1030,6 +1030,7 @@ class mmqgisx_select_algorithm(GeoAlgorithm):
RESULT = "RESULT"

def defineCharacteristics(self):
self.allowOnlyOpenedLayers = True
self.name = "Select by attribute"
self.group = "Vector selection tools"

@@ -59,6 +59,9 @@ def __init__(self):
#change any of the following if your algorithm should not appear in the toolbox or modeler
self.showInToolbox = True
self.showInModeler = True
#if true, will show only loaded layers in parameters dialog
self.allowOnlyOpenedLayers = False
#False if it should not be run a a batch process
self.canRunInBatchMode = True
#to be set by the provider when it loads the algorithm
self.provider = None
@@ -119,7 +119,7 @@ def initGUI(self):
self.labels[param.name] = label
widget = self.getWidgetFromParameter(param)
self.valueItems[param.name] = widget
if isinstance(param, ParameterVector):
if isinstance(param, ParameterVector) and not self.alg.allowOnlyOpenedLayers:
layout = QtGui.QHBoxLayout()
layout.setSpacing(2)
layout.setMargin(0)
@@ -202,7 +202,7 @@ def getWidgetFromParameter(self, param):
items.append((self.getExtendedLayerName(layer), layer))
item = InputLayerSelectorPanel(items)
elif isinstance(param, ParameterVector):
if self.somethingDependsOnThisParameter(param):
if self.somethingDependsOnThisParameter(param) or self.alg.allowOnlyOpenedLayers:
item = QtGui.QComboBox()
layers = QGisLayers.getVectorLayers(param.shapetype)
if (param.optional):

0 comments on commit 6bcf10f

Please sign in to comment.