Showing with 18 additions and 4 deletions.
  1. +1 −1 python/plugins/sextante/gui/BatchProcessingDialog.py
  2. +11 −2 python/plugins/sextante/saga/SagaAlgorithm.py
  3. +6 −1 python/plugins/sextante/saga/SplitRGBBands.py
2 changes: 1 addition & 1 deletion python/plugins/sextante/gui/BatchProcessingDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def accept(self):
continue
widget = self.table.cellWidget(row, col)
if not self.setParameterValueFromWidget(param, widget, alg):
QMessageBox.critical(self.dialog, "Unable to execute batch process", "Wrong or missing parameter values")
QMessageBox.critical(self, "Unable to execute batch process", "Wrong or missing parameter values")
self.algs = None
return
col+=1
Expand Down
13 changes: 11 additions & 2 deletions python/plugins/sextante/saga/SagaAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@
from sextante.parameters.ParameterNumber import ParameterNumber
from sextante.parameters.ParameterSelection import ParameterSelection
from sextante.core.LayerExporter import LayerExporter
import subprocess
from sextante.parameters.ParameterExtent import ParameterExtent
from PyQt4 import QtGui
from sextante.parameters.ParameterFixedTable import ParameterFixedTable
from sextante.core.SextanteLog import SextanteLog

Expand Down Expand Up @@ -367,6 +365,17 @@ def exportRasterLayer(self, layer):

def checkBeforeOpeningParametersDialog(self):
return SagaUtils.checkSagaIsInstalled()


def checkParameterValuesBeforeExecuting(self):
'''We check that there are no multiband layers, which are not supported by SAGA'''
for param in self.parameters:
if isinstance(param, ParameterRaster):
value = param.value
layer = QGisLayers.getObjectFromUri(value)
if layer is not None and layer.bandCount() > 1:
return ("Input layer " + str(layer.name()) + " has more than one band.\n"
+ "Multiband layers are not supported by SAGA")


def helpFile(self):
Expand Down
7 changes: 6 additions & 1 deletion python/plugins/sextante/saga/SplitRGBBands.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ def defineCharacteristics(self):
def processAlgorithm(self, progress):
#TODO:check correct num of bands
input = self.getParameterValue(SplitRGBBands.INPUT)
temp = SextanteUtils.getTempFilename();
temp = SextanteUtils.getTempFilename(None).replace('.','');
basename = os.path.basename(temp)
validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
safeBasename = ''.join(c for c in basename if c in validChars)
temp = os.path.join(os.path.dirname(temp), safeBasename)

r = self.getOutputValue(SplitRGBBands.R)
g = self.getOutputValue(SplitRGBBands.G)
b = self.getOutputValue(SplitRGBBands.B)
Expand Down