made algorithms that require open layers (not just file paths) not to appear in modeler ant batch processign interface

This commit is contained in:
Victor Olaya 2013-09-27 00:31:20 +02:00
parent 1e41b81cb8
commit 17f3f79fc6
4 changed files with 8 additions and 14 deletions

View File

@ -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'

View File

@ -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

View File

@ -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)

View File

@ -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: