Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
made algorithms that require open layers (not just file paths) not to…
… appear in modeler ant batch processign interface
  • Loading branch information
volaya committed Oct 6, 2013
1 parent 1e41b81 commit 17f3f79
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
7 changes: 0 additions & 7 deletions python/plugins/processing/algs/ftools/RandomSelection.py
Expand Up @@ -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'
Expand Down
7 changes: 4 additions & 3 deletions python/plugins/processing/core/GeoAlgorithm.py
Expand Up @@ -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 = ''

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/gui/ProcessingToolbox.py
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/modeler/ModelerDialog.py
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 17f3f79

Please sign in to comment.