mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
made algorithms that require open layers (not just file paths) not to appear in modeler ant batch processign interface
This commit is contained in:
parent
1e41b81cb8
commit
17f3f79fc6
@ -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 @@ class GeoAlgorithm:
|
||||
# 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 @@ class GeoAlgorithm:
|
||||
# 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 @@ class ProcessingToolbox(QDockWidget, Ui_ProcessingToolbox):
|
||||
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 @@ class ModelerDialog(QDialog, Ui_DlgModeler):
|
||||
|
||||
# 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 @@ class ModelerDialog(QDialog, Ui_DlgModeler):
|
||||
|
||||
# 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 @@ class ModelerDialog(QDialog, Ui_DlgModeler):
|
||||
|
||||
# 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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user