mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-25 00:03:06 -04: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
python/plugins/processing
@ -49,13 +49,6 @@ class RandomSelection(GeoAlgorithm):
|
|||||||
|
|
||||||
METHODS = ['Number of selected features',
|
METHODS = ['Number of selected features',
|
||||||
'Percentage of selected features']
|
'Percentage of selected features']
|
||||||
|
|
||||||
# =========================================================================
|
|
||||||
# def getIcon(self):
|
|
||||||
# return QIcon(os.path.dirname(__file__) + \
|
|
||||||
# "/icons/random_selection.png")
|
|
||||||
# =========================================================================
|
|
||||||
|
|
||||||
def defineCharacteristics(self):
|
def defineCharacteristics(self):
|
||||||
self.allowOnlyOpenedLayers = True
|
self.allowOnlyOpenedLayers = True
|
||||||
self.name = 'Random selection'
|
self.name = 'Random selection'
|
||||||
|
@ -59,7 +59,7 @@ class GeoAlgorithm:
|
|||||||
# Outputs generated by the algorithm
|
# Outputs generated by the algorithm
|
||||||
self.outputs = list()
|
self.outputs = list()
|
||||||
|
|
||||||
# Mame and group for normal toolbox display
|
# Name and group for normal toolbox display
|
||||||
self.name = ''
|
self.name = ''
|
||||||
self.group = ''
|
self.group = ''
|
||||||
|
|
||||||
@ -71,8 +71,9 @@ class GeoAlgorithm:
|
|||||||
# appear in the toolbox or modeler
|
# appear in the toolbox or modeler
|
||||||
self.showInToolbox = True
|
self.showInToolbox = True
|
||||||
self.showInModeler = 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
|
self.allowOnlyOpenedLayers = False
|
||||||
|
|
||||||
# False if it should not be run a a batch process
|
# 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 = QAction(self.tr('Execute'), self.algorithmTree)
|
||||||
executeAction.triggered.connect(self.executeAlgorithm)
|
executeAction.triggered.connect(self.executeAlgorithm)
|
||||||
popupmenu.addAction(executeAction)
|
popupmenu.addAction(executeAction)
|
||||||
if alg.canRunInBatchMode:
|
if alg.canRunInBatchMode and not self.allowOnlyOpenedLayers:
|
||||||
executeBatchAction = QAction(
|
executeBatchAction = QAction(
|
||||||
self.tr('Execute as batch process'),
|
self.tr('Execute as batch process'),
|
||||||
self.algorithmTree)
|
self.algorithmTree)
|
||||||
|
@ -357,7 +357,7 @@ class ModelerDialog(QDialog, Ui_DlgModeler):
|
|||||||
|
|
||||||
# Add algorithms
|
# Add algorithms
|
||||||
for alg in algs:
|
for alg in algs:
|
||||||
if not alg.showInModeler:
|
if not alg.showInModeler or alg.allowOnlyOpenedLayers:
|
||||||
continue
|
continue
|
||||||
(altgroup, altsubgroup, altname) = \
|
(altgroup, altsubgroup, altname) = \
|
||||||
AlgorithmDecorator.getGroupsAndName(alg)
|
AlgorithmDecorator.getGroupsAndName(alg)
|
||||||
@ -406,7 +406,7 @@ class ModelerDialog(QDialog, Ui_DlgModeler):
|
|||||||
|
|
||||||
# Add algorithms
|
# Add algorithms
|
||||||
for alg in algs:
|
for alg in algs:
|
||||||
if not alg.showInModeler:
|
if not alg.showInModeler or alg.allowOnlyOpenedLayers:
|
||||||
continue
|
continue
|
||||||
if text == '' or text.lower() in alg.name.lower():
|
if text == '' or text.lower() in alg.name.lower():
|
||||||
if alg.group in groups:
|
if alg.group in groups:
|
||||||
@ -445,7 +445,7 @@ class ModelerDialog(QDialog, Ui_DlgModeler):
|
|||||||
|
|
||||||
# Add algorithms
|
# Add algorithms
|
||||||
for alg in algs:
|
for alg in algs:
|
||||||
if not alg.showInModeler:
|
if not alg.showInModeler or alg.allowOnlyOpenedLayers:
|
||||||
continue
|
continue
|
||||||
if text == '' or text.lower() in alg.name.lower():
|
if text == '' or text.lower() in alg.name.lower():
|
||||||
if alg.group in groups:
|
if alg.group in groups:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user