Skip to content
Permalink
Browse files

made algorithms that require open layers (not just file paths) not to…

… appear in modeler ant batch processign interface
  • Loading branch information
volaya committed Sep 26, 2013
1 parent 1e41b81 commit 17f3f79fc6989cf18bc42a06ffb390dcdb2e5a8f
@@ -49,13 +49,6 @@ class RandomSelection(GeoAlgorithm):

METHODS = ['Number of selected features',
'Percentage of selected features']

# =========================================================================
# def getIcon(self):
# return QIcon(os.path.dirname(__file__) + \
# "/icons/random_selection.png")
# =========================================================================

def defineCharacteristics(self):
self.allowOnlyOpenedLayers = True
self.name = 'Random selection'
@@ -59,7 +59,7 @@ def __init__(self):
# Outputs generated by the algorithm
self.outputs = list()

# Mame and group for normal toolbox display
# Name and group for normal toolbox display
self.name = ''
self.group = ''

@@ -71,8 +71,9 @@ def __init__(self):
# appear in the toolbox or modeler
self.showInToolbox = True
self.showInModeler = True

# If True, will show only loaded layers in parameters dialog
#if true, will show only loaded layers in parameters dialog.
#Also, if True, the algorithm does not run on the modeler
#or batch ptocessing interface
self.allowOnlyOpenedLayers = False

# False if it should not be run a a batch process
@@ -99,7 +99,7 @@ def showPopupMenu(self, point):
executeAction = QAction(self.tr('Execute'), self.algorithmTree)
executeAction.triggered.connect(self.executeAlgorithm)
popupmenu.addAction(executeAction)
if alg.canRunInBatchMode:
if alg.canRunInBatchMode and not self.allowOnlyOpenedLayers:
executeBatchAction = QAction(
self.tr('Execute as batch process'),
self.algorithmTree)
@@ -357,7 +357,7 @@ def fillAlgorithmTreeUsingCategories(self):

# Add algorithms
for alg in algs:
if not alg.showInModeler:
if not alg.showInModeler or alg.allowOnlyOpenedLayers:
continue
(altgroup, altsubgroup, altname) = \
AlgorithmDecorator.getGroupsAndName(alg)
@@ -406,7 +406,7 @@ def fillAlgorithmTreeUsingCategories(self):

# Add algorithms
for alg in algs:
if not alg.showInModeler:
if not alg.showInModeler or alg.allowOnlyOpenedLayers:
continue
if text == '' or text.lower() in alg.name.lower():
if alg.group in groups:
@@ -445,7 +445,7 @@ def fillAlgorithmTreeUsingProviders(self):

# Add algorithms
for alg in algs:
if not alg.showInModeler:
if not alg.showInModeler or alg.allowOnlyOpenedLayers:
continue
if text == '' or text.lower() in alg.name.lower():
if alg.group in groups:

0 comments on commit 17f3f79

Please sign in to comment.
You can’t perform that action at this time.