Index: src/sextante/gui/BatchProcessingDialog.py
===================================================================
--- src/sextante/gui/BatchProcessingDialog.py	(revision 188)
+++ src/sextante/gui/BatchProcessingDialog.py	(working copy)
@@ -12,7 +12,7 @@
 from sextante.parameters.ParameterMultipleInput import ParameterMultipleInput
 import copy
 from sextante.gui.BatchOutputSelectionPanel import BatchOutputSelectionPanel
-from sextante.gui.AlgorithmExecutor import AlgorithmExecutor, SilentProgress
+from sextante.gui.AlgorithmExecutor import AlgorithmExecutor
 from sextante.outputs.OutputHTML import OutputHTML
 from sextante.core.SextanteResults import SextanteResults
 from sextante.gui.ResultsDialog import ResultsDialog
@@ -102,13 +102,9 @@
         i=1
         self.progress.setMaximum(len(self.algs))
         for alg in self.algs:
-            if AlgorithmExecutor.runalg(alg, SilentProgress()):
-                self.progress.setValue(i)
-                self.loadHTMLResults(alg, i)
-                i+=1
-            else:
-                QApplication.restoreOverrideCursor()
-                return
+            algEx = AlgorithmExecutor(alg);
+            algEx.start()
+
         QApplication.restoreOverrideCursor()
         QMessageBox.information(self, "Batch processing", "Batch processing successfully completed!")
         self.close()
Index: src/sextante/gui/ParametersDialog.py
===================================================================
--- src/sextante/gui/ParametersDialog.py	(revision 188)
+++ src/sextante/gui/ParametersDialog.py	(working copy)
@@ -155,17 +155,19 @@
                 self.progressLabel.setText("Processing algorithm...")
                 if iterateParam:
                     QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
-                    AlgorithmExecutor.runalgIterating(self.alg, iterateParam, self)
+                    algEx = AlgorithmExecutor(self.alg, self, iterateParam)
+                    algEx.start()
                     QApplication.restoreOverrideCursor()
                 else:
                     QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
                     command = self.alg.getAsCommand()
                     if command:
                         SextanteLog.addToLog(SextanteLog.LOG_ALGORITHM, command)
-                    ret = AlgorithmExecutor.runalg(self.alg, self)
+                    algEx = AlgorithmExecutor(self.alg, self)
+                    algEx.start()
                     QApplication.restoreOverrideCursor()
-                    if ret:
-                        SextantePostprocessing.handleAlgorithmResults(self.alg, not keepOpen)
+                    #~ if ret:
+                        #~ SextantePostprocessing.handleAlgorithmResults(self.alg, not keepOpen)
 
                 self.dialog.executed = True
                 if not keepOpen:
Index: src/sextante/gui/AlgorithmExecutor.py
===================================================================
--- src/sextante/gui/AlgorithmExecutor.py	(revision 188)
+++ src/sextante/gui/AlgorithmExecutor.py	(working copy)
@@ -7,71 +7,69 @@
 from sextante.gui.SextantePostprocessing import SextantePostprocessing
 import traceback
 
-class AlgorithmExecutor:
+class AlgorithmExecutor(QThread):
+    def __init__(self, alg, progress, iterParam = None, parent = None):
+        QThread.__init__(self, parent)
+        self.algorithm = alg
+        self.parameterToIterate = iterParam
+        self.progress = progress
+        if self.parameterToIterate:
+            self.run = self.runalgIterating
 
-    @staticmethod
-    def runalg(alg, progress):
-        '''executes a given algorithm, showing its progress in the progress object passed along.
-        Return true if everything went OK, false if the algorithm was canceled or there was
-        any problem and could not be completed'''
+            #generate all single-feature layers
+            settings = QSettings()
+            systemEncoding = settings.value( "/UI/encoding", "System" ).toString()
+            layerfile = alg.getParameterValue(paramToIter)
+            layer = QGisLayers.getObjectFromUri(layerfile, False)
+            provider = layer.dataProvider()
+            allAttrs = provider.attributeIndexes()
+            provider.select( allAttrs )
+            feat = QgsFeature()
+            self.filelist = []
+            outputs = {}
+            while provider.nextFeature(feat):
+                output = SextanteUtils.getTempFilename("shp")
+                self.filelist.append(output)
+                writer = QgsVectorFileWriter(output, systemEncoding,provider.fields(), provider.geometryType(), provider.crs() )
+                writer.addFeature(feat)
+                del writer
+
+            #store output values to use them later as basenames for all outputs
+            for out in self.algorithm.outputs:
+                outputs[out.name] = out.value
+        else:
+            self.run = self.runalg
+
+    def runalg():
+        progress = object()
+        progress.setText = lambda _, msg: self.emit(SIGNAL("textChanged"), text),
+        progress.setPercentage = lambda _, i: self.emit(SIGNAL("percentageChanged"), text)
         try:
-            alg.execute(progress)
-            return not alg.canceled
+            self.algorithm.execute(Progress(self))
+            if self.algorithm.canceled:
+                self.emit(SIGNAL("canceled()"))
         except GeoAlgorithmExecutionException, e :
-            QMessageBox.critical(None, "Error", e.msg)
-            return False
+            self.emit(SIGNAL("error()"))
         except Exception:
-            QMessageBox.critical(None, "Error", traceback.format_exc())
+            self.emit(SIGNAL("error()"))
             return False
+        return True
 
-    @staticmethod
-    def runalgIterating(alg,paramToIter,progress):
-        #generate all single-feature layers
-        settings = QSettings()
-        systemEncoding = settings.value( "/UI/encoding", "System" ).toString()
-        layerfile = alg.getParameterValue(paramToIter)
-        layer = QGisLayers.getObjectFromUri(layerfile, False)
-        provider = layer.dataProvider()
-        allAttrs = provider.attributeIndexes()
-        provider.select( allAttrs )
-        feat = QgsFeature()
-        filelist = []
-        outputs = {}
-        while provider.nextFeature(feat):
-            output = SextanteUtils.getTempFilename("shp")
-            filelist.append(output)
-            writer = QgsVectorFileWriter(output, systemEncoding,provider.fields(), provider.geometryType(), provider.crs() )
-            writer.addFeature(feat)
-            del writer
-
-        #store output values to use them later as basenames for all outputs
-        for out in alg.outputs:
-            outputs[out.name] = out.value
-
+    def runalgIterating():
         #now run all the algorithms
         i = 1
-        for f in filelist:
-            alg.setParameterValue(paramToIter, f)
-            for out in alg.outputs:
+        for f in self.filelist:
+            self.algorithm.setParameterValue(self.parameterToIterate, f)
+            for out in self.algorithm.outputs:
                 filename = outputs[out.name]
                 if filename:
                     filename = filename[:filename.rfind(".")] + "_" + str(i) + filename[filename.rfind("."):]
                 out.value = filename
-            progress.setText("Executing iteration " + str(i) + "/" + str(len(filelist)) + "...")
-            progress.setPercentage((i * 100) / len(filelist))
-            if AlgorithmExecutor.runalg(alg, SilentProgress()):
-                SextantePostprocessing.handleAlgorithmResults(alg, False)
-                i+=1
+            #~ progress.setText("Executing iteration " + str(i) + "/" + str(len(filelist)) + "...")
+            #~ progress.setPercentage((i * 100) / len(filelist))
+            if runalg():
+                SextantePostprocessing.handleAlgorithmResults(self.algorithm, False)
+                i += 1
             else:
-                return False;
-
-        return True
-
-
-class SilentProgress():
-
-    def setText(self, text):
-        pass
-
-    def setPercentage(self, i):
-        pass
+                self.emit(SIGNAL("error()"))
+                return
Index: src/sextante/core/Sextante.py
===================================================================
--- src/sextante/core/Sextante.py	(revision 188)
+++ src/sextante/core/Sextante.py	(working copy)
@@ -3,7 +3,7 @@
 from sextante.saga.SagaAlgorithmProvider import SagaAlgorithmProvider
 from sextante.script.ScriptAlgorithmProvider import ScriptAlgorithmProvider
 from sextante.core.QGisLayers import QGisLayers
-from sextante.gui.AlgorithmExecutor import AlgorithmExecutor, SilentProgress
+from sextante.gui.AlgorithmExecutor import AlgorithmExecutor
 from sextante.core.SextanteConfig import SextanteConfig
 from sextante.core.SextanteLog import SextanteLog
 from sextante.modeler.ModelerAlgorithmProvider import ModelerAlgorithmProvider
@@ -279,7 +279,8 @@
         SextanteLog.addToLog(SextanteLog.LOG_ALGORITHM, alg.getAsCommand())
 
         QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
-        AlgorithmExecutor.runalg(alg, SilentProgress())
+        algEx = AlgorithmExecutor(alg)
+        algEx.start()
         QApplication.restoreOverrideCursor()
         return alg.getOutputValuesAsDictionary()
 
