7 changes: 0 additions & 7 deletions python/plugins/processing/algs/ftools/RandomSelection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
7 changes: 4 additions & 3 deletions python/plugins/processing/core/GeoAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(self):
# 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 = ''

Expand All @@ -71,8 +71,9 @@ def __init__(self):
# 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
Expand Down
3 changes: 3 additions & 0 deletions python/plugins/processing/gdal/gdaladdo.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ class gdaladdo(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/raster-overview.png'
return QtGui.QIcon(filepath)

def commandLineName(self):
return "gdalogr:overviews"

def defineCharacteristics(self):
self.name = 'Build overviews (pyramids)'
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/gdal/information.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,10 @@

import os
from PyQt4 import QtGui

from processing.core.GeoAlgorithm import GeoAlgorithm

from processing.parameters.ParameterRaster import ParameterRaster
from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.outputs.OutputHTML import OutputHTML

from processing.gdal.GdalUtils import GdalUtils


Expand All @@ -47,6 +44,9 @@ class information(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/raster-info.png'
return QtGui.QIcon(filepath)

def commandLineName(self):
return "gdalorg:rasterinfo"

def defineCharacteristics(self):
self.name = 'Information'
Expand Down
4 changes: 4 additions & 0 deletions python/plugins/processing/gdal/ogr2ogr.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ def defineCharacteristics(self):
''))

self.addOutput(OutputVector(self.OUTPUT_LAYER, 'Output layer'))

def commandLineName(self):
return "gdalogr:ogr2ogr"


def processAlgorithm(self, progress):
if not gdalAvailable:
Expand Down
3 changes: 3 additions & 0 deletions python/plugins/processing/gdal/ogrinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def defineCharacteristics(self):
[ParameterVector.VECTOR_TYPE_ANY], False))

self.addOutput(OutputHTML(self.OUTPUT, 'Layer information'))

def commandLineName(self):
return "gdalogr:vectorinfo"

def processAlgorithm(self, progress):

Expand Down
7 changes: 3 additions & 4 deletions python/plugins/processing/gdal/polygonize.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,11 @@

__revision__ = '$Format:%H$'

import os
from PyQt4 import QtGui, QtCore

from processing.core.GeoAlgorithm import GeoAlgorithm

from processing.parameters.ParameterRaster import ParameterRaster
from processing.parameters.ParameterString import ParameterString
from processing.outputs.OutputVector import OutputVector

from processing.tools.system import *

from processing.gdal.GdalUtils import GdalUtils
Expand All @@ -48,6 +44,9 @@ class polygonize(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/polygonize.png'
return QtGui.QIcon(filepath)

def commandLineName(self):
return "gdalogr:polygonize"

def defineCharacteristics(self):
self.name = 'Polygonize (raster to vector)'
Expand Down
9 changes: 4 additions & 5 deletions python/plugins/processing/gdal/proximity.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,14 @@
__revision__ = '$Format:%H$'

import os
from PyQt4 import QtGui, QtCore

from PyQt4 import QtGui
from processing.core.GeoAlgorithm import GeoAlgorithm

from processing.parameters.ParameterRaster import ParameterRaster
from processing.parameters.ParameterString import ParameterString
from processing.parameters.ParameterSelection import ParameterSelection
from processing.parameters.ParameterNumber import ParameterNumber
from processing.outputs.OutputRaster import OutputRaster

from processing.tools.system import *

from processing.gdal.GdalUtils import GdalUtils


Expand All @@ -56,6 +52,9 @@ class proximity(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/proximity.png'
return QtGui.QIcon(filepath)

def commandLineName(self):
return "gdalogr:proximity"

def defineCharacteristics(self):
self.name = 'Proximity (raster distance)'
Expand Down
10 changes: 5 additions & 5 deletions python/plugins/processing/gdal/rasterize.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,16 @@

__revision__ = '$Format:%H$'

import os
from PyQt4 import QtGui, QtCore

from PyQt4 import QtGui

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.tools.system import *

from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterTableField import ParameterTableField
from processing.parameters.ParameterSelection import ParameterSelection
from processing.parameters.ParameterNumber import ParameterNumber

from processing.outputs.OutputRaster import OutputRaster

from processing.gdal.GdalUtils import GdalUtils


Expand All @@ -53,6 +50,9 @@ class rasterize(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/rasterize.png'
return QtGui.QIcon(filepath)

def commandLineName(self):
return "gdalogr:rasterize"

def defineCharacteristics(self):
self.name = 'Rasterize (vector to raster)'
Expand Down
3 changes: 3 additions & 0 deletions python/plugins/processing/gdal/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class translate(GeoAlgorithm):
def getIcon(self):
filepath = os.path.dirname(__file__) + '/icons/translate.png'
return QtGui.QIcon(filepath)

def commandLineName(self):
return "gdalogr:translate"

def defineCharacteristics(self):
self.name = 'Translate (convert format)'
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/gui/AlgorithmExecutionDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ def __init__(self, alg, mainWidget):
self.buttonBox.rejected.connect(self.close)
self.buttonBox.button(
QtGui.QDialogButtonBox.Cancel).clicked.connect(self.cancel)

self.showDebug = ProcessingConfig.getSetting(
ProcessingConfig.SHOW_DEBUG_IN_DIALOG)

def setParamValues(self):
params = self.alg.parameters
Expand Down Expand Up @@ -196,14 +199,11 @@ def setParamValue(self, param, widget):
else:
return param.setValue(unicode(widget.text()))

@pyqtSlot()
def accept(self):
checkCRS = ProcessingConfig.getSetting(
ProcessingConfig.WARN_UNMATCHING_CRS)
keepOpen = ProcessingConfig.getSetting(
ProcessingConfig.KEEP_DIALOG_OPEN)
self.showDebug = ProcessingConfig.getSetting(
ProcessingConfig.SHOW_DEBUG_IN_DIALOG)
try:
self.setParamValues()
if checkCRS and not self.alg.checkInputCRS():
Expand Down
1 change: 0 additions & 1 deletion python/plugins/processing/gui/EditScriptAction.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

from processing.gui.ContextAction import ContextAction
from processing.gui.ScriptEditorDialog import ScriptEditorDialog

from processing.r.RAlgorithm import RAlgorithm
from processing.script.ScriptAlgorithm import ScriptAlgorithm

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/gui/ExtentSelectionPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, dialog, alg, default):
canvas = interface.iface.mapCanvas()
self.prevMapTool = canvas.mapTool()
self.tool = RectangleMapTool(canvas)
self.connect(self.tool, SIGNAL('rectangleCreated()'), self.fillCoords)
self.tool.rectangleCreated.connect(self.fillCoords)

def canUseAutoExtent(self):
for param in self.params:
Expand Down
14 changes: 5 additions & 9 deletions python/plugins/processing/gui/FixedTableDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,10 @@ def setupUi(self):
self.horizontalLayout.addWidget(self.table)
self.horizontalLayout.addWidget(self.buttonBox)
self.setLayout(self.horizontalLayout)
QObject.connect(self.buttonBox, QtCore.SIGNAL('accepted()'),
self.okPressed)
QObject.connect(self.buttonBox, QtCore.SIGNAL('rejected()'),
self.cancelPressed)
QObject.connect(self.addRowButton, QtCore.SIGNAL('clicked()'),
self.addRow)
QObject.connect(self.removeRowButton, QtCore.SIGNAL('clicked()'),
self.removeRow)
self.buttonBox.accepted.connect(self.okPressed)
self.buttonBox.rejected.connect(self.cancelPressed)
self.addRowButton.clicked.connect(self.addRow)
self.removeRowButton.clicked.connect(self.removeRow)
QtCore.QMetaObject.connectSlotsByName(self)

def setTableContent(self):
Expand Down Expand Up @@ -112,4 +108,4 @@ def addRow(self):
self.table.setRowHeight(self.table.rowCount() - 1, 22)
for i in range(self.table.columnCount()):
self.table.setItem(self.table.rowCount() - 1, i,
QtGui.QTableWidgetItem('0'))
QtGui.QTableWidgetItem('0'))
2 changes: 1 addition & 1 deletion python/plugins/processing/gui/FixedTablePanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

__revision__ = '$Format:%H$'

from PyQt4 import QtCore, QtGui
from PyQt4 import QtGui
from processing.gui.FixedTableDialog import FixedTableDialog


Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/gui/MultipleInputDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ def toggleSelection(self):
break
for i in range(len(self.options)):
widget = self.tblLayers.cellWidget(i, 0)
widget.setChecked(checked)
widget.setChecked(checked)
15 changes: 1 addition & 14 deletions python/plugins/processing/gui/MultipleInputPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,7 @@ def setSelectedItems(self, selected):
+ ' elements selected')

def showSelectionDialog(self):
# =====================================================================
# #If there is a datatype, we use it to create the list of options
# if self.datatype is not None:
# if self.datatype == ParameterMultipleInput.TYPE_RASTER:
# options = dataobjects.getRasterLayers()
# elif self.datatype == ParameterMultipleInput.TYPE_VECTOR_ANY:
# options = dataobjects.getVectorLayers()
# else:
# options = dataobjects.getVectorLayers(self.datatype)
# opts = []
# for opt in options:
# opts.append(opt.name())
# self.options = opts
# =====================================================================

dlg = MultipleInputDialog(self.options, self.selectedoptions)
dlg.exec_()
if dlg.selectedoptions is not None:
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/gui/ProcessingToolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def showPopupMenu(self, point):
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)
Expand Down
12 changes: 6 additions & 6 deletions python/plugins/processing/gui/help/algclasssification.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
gdalogr:buildpyramidsoverviews,USE_ORIGINAL_NAME,Raster/Creation
gdalogr:overviews,USE_ORIGINAL_NAME,Raster/Creation
gdalogr:executesql,Execute SQL on vector layer,Vector/General tools
gdalogr:information,Raster layer information,Raster/General tools
gdalogr:rasterinfo,Raster layer information,Raster/General tools
gdalogr:merge,USE_ORIGINAL_NAME,Raster/General tools
gdalogr:nearblack,USE_ORIGINAL_NAME,Raster/Analysis
gdalogr:ogr2ogr,Export vector layer,Vector/General tools
gdalogr:ogrinfo,Vector layer information,Vector/Statistics
gdalogr:pct2rgb,PCT to RGB,Images/Image Manipulation
gdalogr:vectorinfo,Vector layer information,Vector/Statistics
gdalogr:pcttorgb,PCT to RGB,Images/Image Manipulation
gdalogr:proximity,USE_ORIGINAL_NAME,Raster/Analysis
gdalogr:rgb2pct,RGB to PCT,Images/Image Manipulation
gdalogr:rgbtopct,RGB to PCT,Images/Image Manipulation
gdalogr:sieve,Remove small pixel clumps (nearest neighbour),Raster/Edition
gdalogr:translateconvertformat,Export raster layer,Raster/General tools
gdalogr:translate,Export raster layer,Raster/General tools
gdalogr:warpreproject,Reproject raster layer,Raster/General tools
otb:bandmath,USE_ORIGINAL_NAME,Images/Miscellaneous
otb:binarymorphologicaloperation,USE_ORIGINAL_NAME,Images/Image Filtering
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/modeler/ModelerDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def fillAlgorithmTreeUsingCategories(self):

# Add algorithms
for alg in algs:
if not alg.showInModeler:
if not alg.showInModeler or alg.allowOnlyOpenedLayers:
continue
(altgroup, altsubgroup, altname) = \
AlgorithmDecorator.getGroupsAndName(alg)
Expand Down Expand Up @@ -406,7 +406,7 @@ def fillAlgorithmTreeUsingCategories(self):

# 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:
Expand Down Expand Up @@ -445,7 +445,7 @@ def fillAlgorithmTreeUsingProviders(self):

# 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:
Expand Down