Skip to content

Commit 17f3f79

Browse files
committedOct 6, 2013
made algorithms that require open layers (not just file paths) not to appear in modeler ant batch processign interface
1 parent 1e41b81 commit 17f3f79

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed
 

‎python/plugins/processing/algs/ftools/RandomSelection.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ class RandomSelection(GeoAlgorithm):
4949

5050
METHODS = ['Number of selected features',
5151
'Percentage of selected features']
52-
53-
# =========================================================================
54-
# def getIcon(self):
55-
# return QIcon(os.path.dirname(__file__) + \
56-
# "/icons/random_selection.png")
57-
# =========================================================================
58-
5952
def defineCharacteristics(self):
6053
self.allowOnlyOpenedLayers = True
6154
self.name = 'Random selection'

‎python/plugins/processing/core/GeoAlgorithm.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def __init__(self):
5959
# Outputs generated by the algorithm
6060
self.outputs = list()
6161

62-
# Mame and group for normal toolbox display
62+
# Name and group for normal toolbox display
6363
self.name = ''
6464
self.group = ''
6565

@@ -71,8 +71,9 @@ def __init__(self):
7171
# appear in the toolbox or modeler
7272
self.showInToolbox = True
7373
self.showInModeler = True
74-
75-
# If True, will show only loaded layers in parameters dialog
74+
#if true, will show only loaded layers in parameters dialog.
75+
#Also, if True, the algorithm does not run on the modeler
76+
#or batch ptocessing interface
7677
self.allowOnlyOpenedLayers = False
7778

7879
# False if it should not be run a a batch process

‎python/plugins/processing/gui/ProcessingToolbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def showPopupMenu(self, point):
9999
executeAction = QAction(self.tr('Execute'), self.algorithmTree)
100100
executeAction.triggered.connect(self.executeAlgorithm)
101101
popupmenu.addAction(executeAction)
102-
if alg.canRunInBatchMode:
102+
if alg.canRunInBatchMode and not self.allowOnlyOpenedLayers:
103103
executeBatchAction = QAction(
104104
self.tr('Execute as batch process'),
105105
self.algorithmTree)

‎python/plugins/processing/modeler/ModelerDialog.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def fillAlgorithmTreeUsingCategories(self):
357357

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

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

446446
# Add algorithms
447447
for alg in algs:
448-
if not alg.showInModeler:
448+
if not alg.showInModeler or alg.allowOnlyOpenedLayers:
449449
continue
450450
if text == '' or text.lower() in alg.name.lower():
451451
if alg.group in groups:

0 commit comments

Comments
 (0)
Please sign in to comment.