File tree Expand file tree Collapse file tree 4 files changed +8
-14
lines changed
python/plugins/processing Expand file tree Collapse file tree 4 files changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -49,13 +49,6 @@ class RandomSelection(GeoAlgorithm):
49
49
50
50
METHODS = ['Number of selected features' ,
51
51
'Percentage of selected features' ]
52
-
53
- # =========================================================================
54
- # def getIcon(self):
55
- # return QIcon(os.path.dirname(__file__) + \
56
- # "/icons/random_selection.png")
57
- # =========================================================================
58
-
59
52
def defineCharacteristics (self ):
60
53
self .allowOnlyOpenedLayers = True
61
54
self .name = 'Random selection'
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ def __init__(self):
59
59
# Outputs generated by the algorithm
60
60
self .outputs = list ()
61
61
62
- # Mame and group for normal toolbox display
62
+ # Name and group for normal toolbox display
63
63
self .name = ''
64
64
self .group = ''
65
65
@@ -71,8 +71,9 @@ def __init__(self):
71
71
# appear in the toolbox or modeler
72
72
self .showInToolbox = True
73
73
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
76
77
self .allowOnlyOpenedLayers = False
77
78
78
79
# False if it should not be run a a batch process
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ def showPopupMenu(self, point):
99
99
executeAction = QAction (self .tr ('Execute' ), self .algorithmTree )
100
100
executeAction .triggered .connect (self .executeAlgorithm )
101
101
popupmenu .addAction (executeAction )
102
- if alg .canRunInBatchMode :
102
+ if alg .canRunInBatchMode and not self . allowOnlyOpenedLayers :
103
103
executeBatchAction = QAction (
104
104
self .tr ('Execute as batch process' ),
105
105
self .algorithmTree )
Original file line number Diff line number Diff line change @@ -357,7 +357,7 @@ def fillAlgorithmTreeUsingCategories(self):
357
357
358
358
# Add algorithms
359
359
for alg in algs :
360
- if not alg .showInModeler :
360
+ if not alg .showInModeler or alg . allowOnlyOpenedLayers :
361
361
continue
362
362
(altgroup , altsubgroup , altname ) = \
363
363
AlgorithmDecorator .getGroupsAndName (alg )
@@ -406,7 +406,7 @@ def fillAlgorithmTreeUsingCategories(self):
406
406
407
407
# Add algorithms
408
408
for alg in algs :
409
- if not alg .showInModeler :
409
+ if not alg .showInModeler or alg . allowOnlyOpenedLayers :
410
410
continue
411
411
if text == '' or text .lower () in alg .name .lower ():
412
412
if alg .group in groups :
@@ -445,7 +445,7 @@ def fillAlgorithmTreeUsingProviders(self):
445
445
446
446
# Add algorithms
447
447
for alg in algs :
448
- if not alg .showInModeler :
448
+ if not alg .showInModeler or alg . allowOnlyOpenedLayers :
449
449
continue
450
450
if text == '' or text .lower () in alg .name .lower ():
451
451
if alg .group in groups :
You can’t perform that action at this time.
0 commit comments