mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-04 00:04:25 -05:00 
			
		
		
		
	[processing] cleaned up options (threaded execution and table-like parameters dialog
This commit is contained in:
		
							parent
							
								
									a5f0e4b18a
								
							
						
					
					
						commit
						048c26a1f3
					
				@ -159,7 +159,7 @@ class GeoAlgorithm:
 | 
			
		||||
        except GeoAlgorithmExecutionException, gaee:
 | 
			
		||||
            ProcessingLog.addToLog(ProcessingLog.LOG_ERROR, gaee.msg)
 | 
			
		||||
            raise gaee
 | 
			
		||||
        except:
 | 
			
		||||
        except Exception, e:
 | 
			
		||||
            #if something goes wrong and is not caught in the algorithm,
 | 
			
		||||
            #we catch it here and wrap it
 | 
			
		||||
            lines = ["Uncaught error while executing algorithm"]
 | 
			
		||||
@ -171,7 +171,7 @@ class GeoAlgorithm:
 | 
			
		||||
                lines.append(errstring)
 | 
			
		||||
            lines.append(errstring.replace("\n", "|"))
 | 
			
		||||
            ProcessingLog.addToLog(ProcessingLog.LOG_ERROR, lines)
 | 
			
		||||
            raise GeoAlgorithmExecutionException(errstring)
 | 
			
		||||
            raise GeoAlgorithmExecutionException(str(e))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    def runPostExecutionScript(self, progress):
 | 
			
		||||
 | 
			
		||||
@ -34,11 +34,9 @@ from processing.core.ProcessingConfig import ProcessingConfig
 | 
			
		||||
from processing.core.GeoAlgorithm import GeoAlgorithm
 | 
			
		||||
from processing.core.ProcessingLog import ProcessingLog
 | 
			
		||||
from processing.gui.AlgorithmClassification import AlgorithmDecorator
 | 
			
		||||
from processing.gui.AlgorithmExecutor import AlgorithmExecutor
 | 
			
		||||
from processing.gui.RenderingStyles import RenderingStyles
 | 
			
		||||
from processing.gui.Postprocessing import Postprocessing
 | 
			
		||||
from processing.gui.UnthreadedAlgorithmExecutor import UnthreadedAlgorithmExecutor
 | 
			
		||||
from processing.core.SilentProgress import SilentProgress
 | 
			
		||||
from processing.modeler.Providers import Providers
 | 
			
		||||
from processing.modeler.ModelerAlgorithmProvider import ModelerAlgorithmProvider
 | 
			
		||||
from processing.modeler.ModelerOnlyAlgorithmProvider import ModelerOnlyAlgorithmProvider
 | 
			
		||||
@ -310,45 +308,12 @@ class Processing:
 | 
			
		||||
        elif cursor.shape() != Qt.WaitCursor:
 | 
			
		||||
            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
 | 
			
		||||
 | 
			
		||||
        useThreads = ProcessingConfig.getSetting(ProcessingConfig.USE_THREADS)
 | 
			
		||||
 | 
			
		||||
        #this is doing strange things, so temporarily the thread execution is disabled from the console
 | 
			
		||||
        useThreads = False
 | 
			
		||||
 | 
			
		||||
        if useThreads:
 | 
			
		||||
            algEx = AlgorithmExecutor(alg)
 | 
			
		||||
            progress = QProgressDialog()
 | 
			
		||||
            progress.setWindowTitle(alg.name)
 | 
			
		||||
            progress.setLabelText("Executing %s..." % alg.name)
 | 
			
		||||
            def finish():
 | 
			
		||||
                QApplication.restoreOverrideCursor()
 | 
			
		||||
                if onFinish is not None:
 | 
			
		||||
                    onFinish(alg, SilentProgress())
 | 
			
		||||
                progress.close()
 | 
			
		||||
            def error(msg):
 | 
			
		||||
                QApplication.restoreOverrideCursor()
 | 
			
		||||
                print msg
 | 
			
		||||
                ProcessingLog.addToLog(ProcessingLog.LOG_ERROR, msg)
 | 
			
		||||
            def cancel():
 | 
			
		||||
                try:
 | 
			
		||||
                    algEx.finished.disconnect()
 | 
			
		||||
                    algEx.terminate()
 | 
			
		||||
                    QApplication.restoreOverrideCursor()
 | 
			
		||||
                    progress.close()
 | 
			
		||||
                except:
 | 
			
		||||
                    pass
 | 
			
		||||
            algEx.error.connect(error)
 | 
			
		||||
            algEx.finished.connect(finish)
 | 
			
		||||
            algEx.start()
 | 
			
		||||
            algEx.wait()
 | 
			
		||||
        else:
 | 
			
		||||
            #progress = SilentProgress()
 | 
			
		||||
            progress = MessageBarProgress()
 | 
			
		||||
            ret = UnthreadedAlgorithmExecutor.runalg(alg, progress)
 | 
			
		||||
            if onFinish is not None and ret:
 | 
			
		||||
                onFinish(alg, progress)
 | 
			
		||||
            QApplication.restoreOverrideCursor()
 | 
			
		||||
            progress.close()
 | 
			
		||||
        progress = MessageBarProgress()
 | 
			
		||||
        ret = UnthreadedAlgorithmExecutor.runalg(alg, progress)
 | 
			
		||||
        if onFinish is not None and ret:
 | 
			
		||||
            onFinish(alg, progress)
 | 
			
		||||
        QApplication.restoreOverrideCursor()
 | 
			
		||||
        progress.close()
 | 
			
		||||
        return alg
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -29,7 +29,6 @@ from PyQt4 import QtGui
 | 
			
		||||
 | 
			
		||||
class ProcessingConfig():
 | 
			
		||||
 | 
			
		||||
    TABLE_LIKE_PARAM_PANEL = "TABLE_LIKE_PARAM_PANEL"
 | 
			
		||||
    OUTPUT_FOLDER = "OUTPUT_FOLDER"
 | 
			
		||||
    RASTER_STYLE = "RASTER_STYLE"
 | 
			
		||||
    VECTOR_POINT_STYLE = "VECTOR_POINT_STYLE"
 | 
			
		||||
@ -39,7 +38,6 @@ class ProcessingConfig():
 | 
			
		||||
    USE_SELECTED = "USE_SELECTED"
 | 
			
		||||
    USE_FILENAME_AS_LAYER_NAME = "USE_FILENAME_AS_LAYER_NAME"
 | 
			
		||||
    KEEP_DIALOG_OPEN = "KEEP_DIALOG_OPEN"
 | 
			
		||||
    USE_THREADS = "USE_THREADS"
 | 
			
		||||
    SHOW_DEBUG_IN_DIALOG = "SHOW_DEBUG_IN_DIALOG"
 | 
			
		||||
    RECENT_ALGORITHMS = "RECENT_ALGORITHMS"
 | 
			
		||||
    PRE_EXECUTION_SCRIPT = "PRE_EXECUTION_SCRIPT"
 | 
			
		||||
@ -54,11 +52,9 @@ class ProcessingConfig():
 | 
			
		||||
    def initialize():
 | 
			
		||||
        icon =  QtGui.QIcon(os.path.dirname(__file__) + "/../images/alg.png")
 | 
			
		||||
        ProcessingConfig.settingIcons["General"] = icon
 | 
			
		||||
        ProcessingConfig.addSetting(Setting("General", ProcessingConfig.USE_THREADS, "Run algorithms in a new thread (unstable)", False))
 | 
			
		||||
        ProcessingConfig.addSetting(Setting("General", ProcessingConfig.SHOW_DEBUG_IN_DIALOG, "Show extra info in Log panel", True))
 | 
			
		||||
        ProcessingConfig.addSetting(Setting("General", ProcessingConfig.KEEP_DIALOG_OPEN, "Keep dialog open after running an algorithm", False))
 | 
			
		||||
        ProcessingConfig.addSetting(Setting("General", ProcessingConfig.USE_SELECTED, "Use only selected features", True))
 | 
			
		||||
        ProcessingConfig.addSetting(Setting("General", ProcessingConfig.TABLE_LIKE_PARAM_PANEL, "Show table-like parameter panels", False))
 | 
			
		||||
        ProcessingConfig.addSetting(Setting("General", ProcessingConfig.USE_SELECTED, "Use only selected features", True))        
 | 
			
		||||
        ProcessingConfig.addSetting(Setting("General", ProcessingConfig.USE_FILENAME_AS_LAYER_NAME, "Use filename as layer name", False))
 | 
			
		||||
        ProcessingConfig.addSetting(Setting("General", ProcessingConfig.SHOW_RECENT_ALGORITHMS, "Show recently executed algorithms", True))
 | 
			
		||||
        ProcessingConfig.addSetting(Setting("General", ProcessingConfig.OUTPUT_FOLDER, "Output folder", tempFolder()))
 | 
			
		||||
 | 
			
		||||
@ -37,12 +37,10 @@ from processing.parameters.ParameterMultipleInput import ParameterMultipleInput
 | 
			
		||||
from processing.parameters.ParameterFixedTable import ParameterFixedTable
 | 
			
		||||
from processing.parameters.ParameterTableField import ParameterTableField
 | 
			
		||||
from processing.parameters.ParameterTable import ParameterTable
 | 
			
		||||
from processing.gui.AlgorithmExecutor import AlgorithmExecutor
 | 
			
		||||
from processing.core.ProcessingLog import ProcessingLog
 | 
			
		||||
from processing.gui.Postprocessing import Postprocessing
 | 
			
		||||
from processing.parameters.ParameterRange import ParameterRange
 | 
			
		||||
from processing.parameters.ParameterNumber import ParameterNumber
 | 
			
		||||
 | 
			
		||||
from processing.parameters.ParameterFile import ParameterFile
 | 
			
		||||
from processing.parameters.ParameterCrs import ParameterCrs
 | 
			
		||||
from processing.core.ProcessingConfig import ProcessingConfig
 | 
			
		||||
@ -75,11 +73,7 @@ class AlgorithmExecutionDialog(QtGui.QDialog):
 | 
			
		||||
        self.runButton = QtGui.QPushButton()
 | 
			
		||||
        self.runButton.setText("Run")
 | 
			
		||||
        self.buttonBox.addButton(self.runButton, QtGui.QDialogButtonBox.ActionRole)
 | 
			
		||||
        self.runButton.clicked.connect(self.accept)
 | 
			
		||||
        self.scrollArea = QtGui.QScrollArea()
 | 
			
		||||
        if self.mainWidget:
 | 
			
		||||
            self.scrollArea.setWidget(self.mainWidget)
 | 
			
		||||
        self.scrollArea.setWidgetResizable(True)
 | 
			
		||||
        self.runButton.clicked.connect(self.accept)        
 | 
			
		||||
        self.setWindowTitle(self.alg.name)
 | 
			
		||||
        self.progressLabel = QtGui.QLabel()
 | 
			
		||||
        self.progress = QtGui.QProgressBar()
 | 
			
		||||
@ -91,7 +85,7 @@ class AlgorithmExecutionDialog(QtGui.QDialog):
 | 
			
		||||
        self.verticalLayout.setMargin(0)
 | 
			
		||||
        self.tabWidget = QtGui.QTabWidget()
 | 
			
		||||
        self.tabWidget.setMinimumWidth(300)
 | 
			
		||||
        self.tabWidget.addTab(self.scrollArea, "Parameters")
 | 
			
		||||
        self.tabWidget.addTab(self.mainWidget, "Parameters")
 | 
			
		||||
        self.verticalLayout.addWidget(self.tabWidget)
 | 
			
		||||
        self.logText = QTextEdit()
 | 
			
		||||
        self.logText.readOnly = True
 | 
			
		||||
@ -146,9 +140,8 @@ class AlgorithmExecutionDialog(QtGui.QDialog):
 | 
			
		||||
            if output.hidden:
 | 
			
		||||
                continue
 | 
			
		||||
            output.value = self.paramTable.valueItems[output.name].getValue()
 | 
			
		||||
            if not ProcessingConfig.getSetting(ProcessingConfig.TABLE_LIKE_PARAM_PANEL):
 | 
			
		||||
                if isinstance(output, (OutputRaster, OutputVector, OutputTable)):
 | 
			
		||||
                    output.open = self.paramTable.checkBoxes[output.name].isChecked()
 | 
			
		||||
            if isinstance(output, (OutputRaster, OutputVector, OutputTable)):
 | 
			
		||||
                output.open = self.paramTable.checkBoxes[output.name].isChecked()
 | 
			
		||||
 | 
			
		||||
        return True
 | 
			
		||||
 | 
			
		||||
@ -192,8 +185,7 @@ class AlgorithmExecutionDialog(QtGui.QDialog):
 | 
			
		||||
    @pyqtSlot()
 | 
			
		||||
    def accept(self):
 | 
			
		||||
        checkCRS = ProcessingConfig.getSetting(ProcessingConfig.WARN_UNMATCHING_CRS)
 | 
			
		||||
        keepOpen = ProcessingConfig.getSetting(ProcessingConfig.KEEP_DIALOG_OPEN)
 | 
			
		||||
        useThread = ProcessingConfig.getSetting(ProcessingConfig.USE_THREADS)
 | 
			
		||||
        keepOpen = ProcessingConfig.getSetting(ProcessingConfig.KEEP_DIALOG_OPEN)        
 | 
			
		||||
        self.showDebug = ProcessingConfig.getSetting(ProcessingConfig.SHOW_DEBUG_IN_DIALOG)
 | 
			
		||||
        try:
 | 
			
		||||
            self.setParamValues()
 | 
			
		||||
@ -224,46 +216,29 @@ class AlgorithmExecutionDialog(QtGui.QDialog):
 | 
			
		||||
            self.progress.setMaximum(0)
 | 
			
		||||
            self.progressLabel.setText("Processing algorithm...")
 | 
			
		||||
            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
 | 
			
		||||
            if useThread and not self.iterateParam: #iterative execution on separate thread is still not working fine...
 | 
			
		||||
              
 | 
			
		||||
            self.setInfo("<b>Algorithm %s starting...</b>" % self.alg.name)
 | 
			
		||||
            if self.iterateParam:
 | 
			
		||||
                if UnthreadedAlgorithmExecutor.runalgIterating(self.alg, self.iterateParam, self):
 | 
			
		||||
                    self.finish()
 | 
			
		||||
                else:
 | 
			
		||||
                    QApplication.restoreOverrideCursor()
 | 
			
		||||
                    if not keepOpen:
 | 
			
		||||
                        self.close()
 | 
			
		||||
                    else:
 | 
			
		||||
                        self.resetGUI()
 | 
			
		||||
            else:
 | 
			
		||||
                command = self.alg.getAsCommand()
 | 
			
		||||
                if command:
 | 
			
		||||
                    ProcessingLog.addToLog(ProcessingLog.LOG_ALGORITHM, command)
 | 
			
		||||
                self.algEx = AlgorithmExecutor(self.alg)
 | 
			
		||||
                self.algEx.algExecuted.connect(self.finish)
 | 
			
		||||
                self.algEx.error.connect(self.error)
 | 
			
		||||
                self.algEx.percentageChanged.connect(self.setPercentage)
 | 
			
		||||
                self.algEx.textChanged.connect(self.setText)
 | 
			
		||||
                self.algEx.iterated.connect(self.iterate)
 | 
			
		||||
                self.algEx.infoSet.connect(self.setInfo)                
 | 
			
		||||
                self.algEx.commandSet.connect(self.setCommand)
 | 
			
		||||
                self.algEx.debugInfoSet.connect(self.setDebugInfo)
 | 
			
		||||
                self.algEx.consoleInfoSet.connect(self.setConsoleInfo)
 | 
			
		||||
                self.algEx.start()
 | 
			
		||||
                self.setInfo("<b>Algorithm %s started</b>" % self.alg.name)
 | 
			
		||||
                self.buttonBox.button(QtGui.QDialogButtonBox.Cancel).setEnabled(True)
 | 
			
		||||
            else:                
 | 
			
		||||
                self.setInfo("<b>Algorithm %s starting...</b>" % self.alg.name)
 | 
			
		||||
                if self.iterateParam:
 | 
			
		||||
                    if UnthreadedAlgorithmExecutor.runalgIterating(self.alg, self.iterateParam, self):
 | 
			
		||||
                        self.finish()
 | 
			
		||||
                    else:
 | 
			
		||||
                        QApplication.restoreOverrideCursor()
 | 
			
		||||
                        if not keepOpen:
 | 
			
		||||
                            self.close()
 | 
			
		||||
                        else:
 | 
			
		||||
                            self.resetGUI()
 | 
			
		||||
                if UnthreadedAlgorithmExecutor.runalg(self.alg, self):
 | 
			
		||||
                    self.finish()
 | 
			
		||||
                else:
 | 
			
		||||
                    command = self.alg.getAsCommand()
 | 
			
		||||
                    if command:
 | 
			
		||||
                        ProcessingLog.addToLog(ProcessingLog.LOG_ALGORITHM, command)
 | 
			
		||||
                    if UnthreadedAlgorithmExecutor.runalg(self.alg, self):
 | 
			
		||||
                        self.finish()
 | 
			
		||||
                    QApplication.restoreOverrideCursor()
 | 
			
		||||
                    if not keepOpen:
 | 
			
		||||
                        self.close()
 | 
			
		||||
                    else:
 | 
			
		||||
                        QApplication.restoreOverrideCursor()
 | 
			
		||||
                        if not keepOpen:
 | 
			
		||||
                            self.close()
 | 
			
		||||
                        else:
 | 
			
		||||
                            self.resetGUI()            
 | 
			
		||||
                        self.resetGUI()            
 | 
			
		||||
        except AlgorithmExecutionDialog.InvalidParameterValue as ex:
 | 
			
		||||
            try:
 | 
			
		||||
                self.buttonBox.accepted.connect(lambda: ex.widget.setPalette(QPalette()))
 | 
			
		||||
 | 
			
		||||
@ -1,141 +0,0 @@
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
 | 
			
		||||
"""
 | 
			
		||||
***************************************************************************
 | 
			
		||||
    AlgorithmExecutor.py
 | 
			
		||||
    ---------------------
 | 
			
		||||
    Date                 : August 2012
 | 
			
		||||
    Copyright            : (C) 2012 by Victor Olaya
 | 
			
		||||
    Email                : volayaf at gmail dot com
 | 
			
		||||
***************************************************************************
 | 
			
		||||
*                                                                         *
 | 
			
		||||
*   This program is free software; you can redistribute it and/or modify  *
 | 
			
		||||
*   it under the terms of the GNU General Public License as published by  *
 | 
			
		||||
*   the Free Software Foundation; either version 2 of the License, or     *
 | 
			
		||||
*   (at your option) any later version.                                   *
 | 
			
		||||
*                                                                         *
 | 
			
		||||
***************************************************************************
 | 
			
		||||
"""
 | 
			
		||||
from processing.core.SilentProgress import SilentProgress
 | 
			
		||||
from processing.core.ProcessingLog import ProcessingLog
 | 
			
		||||
 | 
			
		||||
__author__ = 'Victor Olaya'
 | 
			
		||||
__date__ = 'August 2012'
 | 
			
		||||
__copyright__ = '(C) 2012, Victor Olaya'
 | 
			
		||||
# This will get replaced with a git SHA1 when you do a git archive
 | 
			
		||||
__revision__ = '$Format:%H$'
 | 
			
		||||
 | 
			
		||||
from PyQt4.QtGui import *
 | 
			
		||||
from PyQt4.QtCore import *
 | 
			
		||||
from qgis.core import *
 | 
			
		||||
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
 | 
			
		||||
from processing.tools import dataobjects
 | 
			
		||||
from processing.tools.system import *
 | 
			
		||||
from processing.tools.vector import *
 | 
			
		||||
from processing.gui.Postprocessing import Postprocessing
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
class AlgorithmExecutor(QThread):
 | 
			
		||||
    percentageChanged = pyqtSignal(int)
 | 
			
		||||
    textChanged = pyqtSignal(str)
 | 
			
		||||
    error = pyqtSignal(str)
 | 
			
		||||
    internalError = pyqtSignal(BaseException)
 | 
			
		||||
    iterated = pyqtSignal(int)
 | 
			
		||||
    infoSet = pyqtSignal(str)
 | 
			
		||||
    commandSet = pyqtSignal(str)
 | 
			
		||||
    debugInfoSet = pyqtSignal(str)
 | 
			
		||||
    consoleInfoSet = pyqtSignal(str)
 | 
			
		||||
    algExecuted = pyqtSignal()
 | 
			
		||||
    #started & finished inherited from QThread
 | 
			
		||||
 | 
			
		||||
    def __init__(self, alg, iterParam = None, parent = None):
 | 
			
		||||
        QThread.__init__(self, parent)
 | 
			
		||||
        self.algorithm = alg
 | 
			
		||||
        self.parameterToIterate = iterParam
 | 
			
		||||
 | 
			
		||||
        class Progress:
 | 
			
		||||
            def __init__(self, algex):
 | 
			
		||||
                self.algorithmExecutor = algex
 | 
			
		||||
            def setText(self, text):
 | 
			
		||||
                self.algorithmExecutor.textChanged.emit(text)
 | 
			
		||||
            def setPercentage(self, p):
 | 
			
		||||
                self.algorithmExecutor.percentageChanged.emit(p)
 | 
			
		||||
            def setInfo(self, info):
 | 
			
		||||
                self.algorithmExecutor.infoSet.emit(info)
 | 
			
		||||
            def setCommand(self, cmd):
 | 
			
		||||
                self.algorithmExecutor.commandSet.emit(cmd)
 | 
			
		||||
            def setDebugInfo(self, info):
 | 
			
		||||
                self.algorithmExecutor.debugInfoSet.emit(info)
 | 
			
		||||
            def setConsoleInfo(self, info):
 | 
			
		||||
                self.algorithmExecutor.consoleInfoSet.emit(info)
 | 
			
		||||
        self.progress = Progress(self)
 | 
			
		||||
        if self.parameterToIterate:
 | 
			
		||||
            self.run = self.runalgIterating
 | 
			
		||||
 | 
			
		||||
            #generate all single-feature layers
 | 
			
		||||
            settings = QSettings()
 | 
			
		||||
            systemEncoding = settings.value( "/UI/encoding", "System" )
 | 
			
		||||
            layerfile = alg.getParameterValue(self.parameterToIterate)
 | 
			
		||||
            layer = dataobjects.getObjectFromUri(layerfile, False)
 | 
			
		||||
            provider = layer.dataProvider()
 | 
			
		||||
            features = features(layer)
 | 
			
		||||
            self.filelist = []
 | 
			
		||||
            for feat in features:
 | 
			
		||||
                output = getTempFilename("shp")
 | 
			
		||||
                self.filelist.append(output)
 | 
			
		||||
                writer = QgsVectorFileWriter(output, systemEncoding,provider.fields(), provider.geometryType(), layer.crs() )
 | 
			
		||||
                writer.addFeature(feat)
 | 
			
		||||
                del writer
 | 
			
		||||
        else:
 | 
			
		||||
            self.run = self.runalg
 | 
			
		||||
        self.internalError.connect(self.raiseInternalError)
 | 
			
		||||
 | 
			
		||||
    def raiseInternalError(self, error):
 | 
			
		||||
        raise error
 | 
			
		||||
 | 
			
		||||
    def runalg(self):
 | 
			
		||||
        try:
 | 
			
		||||
            self.algorithm.execute(self.progress)
 | 
			
		||||
            if not self.parameterToIterate:
 | 
			
		||||
                self.algExecuted.emit()
 | 
			
		||||
        except GeoAlgorithmExecutionException, e :
 | 
			
		||||
            self.error.emit(e.msg)
 | 
			
		||||
            ProcessingLog.addToLog(sys.exc_info()[0], ProcessingLog.LOG_ERROR)
 | 
			
		||||
        #=======================================================================
 | 
			
		||||
        # except BaseException, e:
 | 
			
		||||
        #    self.error.emit(str(e))
 | 
			
		||||
        #=======================================================================
 | 
			
		||||
            # catch *all* errors, because QGIS tries to handle them in the GUI, which is fatal, this
 | 
			
		||||
            # being a separate thread.
 | 
			
		||||
        except:
 | 
			
		||||
            msg = "Error executing " + str(self.alg.name) + "\nSee log for more information"
 | 
			
		||||
            ProcessingLog.addToLog(sys.exc_info()[0], ProcessingLog.LOG_ERROR)
 | 
			
		||||
            print msg
 | 
			
		||||
            self.error.emit(msg)
 | 
			
		||||
 | 
			
		||||
    def runalgIterating(self):
 | 
			
		||||
        try:
 | 
			
		||||
            outputs = {}
 | 
			
		||||
            #store output values to use them later as basenames for all outputs
 | 
			
		||||
            for out in self.algorithm.outputs:
 | 
			
		||||
                outputs[out.name] = out.value
 | 
			
		||||
            i = 1
 | 
			
		||||
            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
 | 
			
		||||
                self.progress.setText("Executing iteration " + str(i) + "/" + str(len(self.filelist)) + "...")
 | 
			
		||||
                self.progress.setPercentage((i * 100) / len(self.filelist))
 | 
			
		||||
                self.runalg()
 | 
			
		||||
                Postprocessing.handleAlgorithmResults(self.algorithm, SilentProgress().progress, False)
 | 
			
		||||
                self.iterated.emit(i)
 | 
			
		||||
                i += 1
 | 
			
		||||
            self.algExecuted.emit()
 | 
			
		||||
        except BaseException, e:
 | 
			
		||||
            self.error.emit(str(e))
 | 
			
		||||
            print "Error iterating " + str(e)
 | 
			
		||||
        except:
 | 
			
		||||
            print "Error iterating " + str(self)
 | 
			
		||||
@ -46,11 +46,8 @@ from processing.parameters.ParameterFixedTable import ParameterFixedTable
 | 
			
		||||
from processing.gui.FixedTablePanel import FixedTablePanel
 | 
			
		||||
from processing.parameters.ParameterMultipleInput import ParameterMultipleInput
 | 
			
		||||
from processing.gui.BatchOutputSelectionPanel import BatchOutputSelectionPanel
 | 
			
		||||
from processing.gui.AlgorithmExecutor import AlgorithmExecutor
 | 
			
		||||
from processing.outputs.OutputHTML import OutputHTML
 | 
			
		||||
from processing.core.ProcessingResults import ProcessingResults
 | 
			
		||||
from processing.core.ProcessingLog import ProcessingLog
 | 
			
		||||
from processing.core.ProcessingConfig import ProcessingConfig
 | 
			
		||||
from processing.gui.UnthreadedAlgorithmExecutor import UnthreadedAlgorithmExecutor
 | 
			
		||||
 | 
			
		||||
class BatchProcessingDialog(AlgorithmExecutionDialog):
 | 
			
		||||
@ -144,10 +141,11 @@ class BatchProcessingDialog(AlgorithmExecutionDialog):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    def accept(self):
 | 
			
		||||
        self.canceled = False
 | 
			
		||||
        self.algs = []
 | 
			
		||||
        self.load = []
 | 
			
		||||
        for row in range(self.table.rowCount()):
 | 
			
		||||
            alg = self.alg.getCopy()#copy.deepcopy(self.alg)
 | 
			
		||||
            alg = self.alg.getCopy()
 | 
			
		||||
            col = 0
 | 
			
		||||
            for param in alg.parameters:
 | 
			
		||||
                if param.hidden:
 | 
			
		||||
@ -176,23 +174,18 @@ class BatchProcessingDialog(AlgorithmExecutionDialog):
 | 
			
		||||
 | 
			
		||||
        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
 | 
			
		||||
        self.table.setEnabled(False)
 | 
			
		||||
        if ProcessingConfig.getSetting(ProcessingConfig.USE_THREADS):
 | 
			
		||||
            self.tabWidget.setCurrentIndex(1)
 | 
			
		||||
            self.nextAlg(0)
 | 
			
		||||
        else:
 | 
			
		||||
            i=0
 | 
			
		||||
            self.progress.setMaximum(len(self.algs))
 | 
			
		||||
            for alg in self.algs:
 | 
			
		||||
                self.setBaseText("Processing algorithm " + str(i+1) + "/" + str(len(self.algs)) + "...")
 | 
			
		||||
                if UnthreadedAlgorithmExecutor.runalg(alg, self):
 | 
			
		||||
                    if self.load[i]:
 | 
			
		||||
                        Postprocessing.handleAlgorithmResults(alg, self, False)
 | 
			
		||||
                    i+=1
 | 
			
		||||
                else:
 | 
			
		||||
                    QApplication.restoreOverrideCursor()
 | 
			
		||||
                    return
 | 
			
		||||
        self.tabWidget.setCurrentIndex(1)        
 | 
			
		||||
        self.progress.setMaximum(len(self.algs))
 | 
			
		||||
        for i, alg in enumerate(self.algs):
 | 
			
		||||
            self.setBaseText("Processing algorithm " + str(i+1) + "/" + str(len(self.algs)) + "...")
 | 
			
		||||
            if UnthreadedAlgorithmExecutor.runalg(alg, self) and not self.canceled:
 | 
			
		||||
                if self.load[i]:
 | 
			
		||||
                    Postprocessing.handleAlgorithmResults(alg, self, False)                
 | 
			
		||||
            else:
 | 
			
		||||
                QApplication.restoreOverrideCursor()
 | 
			
		||||
                return
 | 
			
		||||
 | 
			
		||||
            self.finishAll()
 | 
			
		||||
        self.finishAll()
 | 
			
		||||
 | 
			
		||||
    def loadHTMLResults(self, alg, i):
 | 
			
		||||
        for out in alg.outputs:
 | 
			
		||||
@ -202,48 +195,9 @@ class BatchProcessingDialog(AlgorithmExecutionDialog):
 | 
			
		||||
                ProcessingResults.addResult(out.description + "[" + str(i) + "]", out.value)
 | 
			
		||||
 | 
			
		||||
    def cancel(self):
 | 
			
		||||
        self.algs = None
 | 
			
		||||
        if self.algEx:
 | 
			
		||||
            self.algEx.terminate()
 | 
			
		||||
        self.canceled = True
 | 
			
		||||
        self.table.setEnabled(True)
 | 
			
		||||
 | 
			
		||||
    @pyqtSlot()
 | 
			
		||||
    def finish(self, i):
 | 
			
		||||
        if not self.stop:
 | 
			
		||||
            if self.load[i]:
 | 
			
		||||
                Postprocessing.handleAlgorithmResults(self.algs[i], self, False)
 | 
			
		||||
            i += 1
 | 
			
		||||
            if len(self.algs) == i:
 | 
			
		||||
                self.finishAll()
 | 
			
		||||
                self.algEx = None
 | 
			
		||||
            else:
 | 
			
		||||
                self.nextAlg(i)
 | 
			
		||||
 | 
			
		||||
    @pyqtSlot(str)
 | 
			
		||||
    def error(self, msg):
 | 
			
		||||
        QApplication.restoreOverrideCursor()
 | 
			
		||||
        QMessageBox.critical(self, "Error", msg)
 | 
			
		||||
        ProcessingLog.addToLog(ProcessingLog.LOG_ERROR, msg)
 | 
			
		||||
        if self.algEx:
 | 
			
		||||
            self.algEx.terminate()
 | 
			
		||||
        self.table.setEnabled(True)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    def nextAlg(self, i):
 | 
			
		||||
        self.stop = False
 | 
			
		||||
        self.setBaseText("Processing algorithm " + str(i + 1) + "/" + str(len(self.algs)) + "...")
 | 
			
		||||
        self.algEx = AlgorithmExecutor(self.algs[i]);
 | 
			
		||||
        self.algEx.percentageChanged.connect(self.setPercentage)
 | 
			
		||||
        self.algEx.textChanged.connect(self.setText)
 | 
			
		||||
        self.algEx.error.connect(self.error)
 | 
			
		||||
        self.algEx.finished.connect(lambda: self.finish(i))
 | 
			
		||||
        self.algEx.infoSet.connect(self.setInfo)
 | 
			
		||||
        if ProcessingConfig.getSetting(ProcessingConfig.SHOW_DEBUG_IN_DIALOG):
 | 
			
		||||
            self.algEx.commandSet.connect(self.setCommand)
 | 
			
		||||
            self.algEx.debugInfoSet.connect(self.setDebugInfo)
 | 
			
		||||
            self.algEx.consoleInfoSet.connect(self.setConsoleInfo)
 | 
			
		||||
        self.algEx.start()
 | 
			
		||||
 | 
			
		||||
    def createSummaryTable(self):
 | 
			
		||||
        createTable = False
 | 
			
		||||
        for out in self.algs[0].outputs:
 | 
			
		||||
 | 
			
		||||
@ -24,10 +24,9 @@ __copyright__ = '(C) 2012, Victor Olaya'
 | 
			
		||||
# This will get replaced with a git SHA1 when you do a git archive
 | 
			
		||||
__revision__ = '$Format:%H$'
 | 
			
		||||
 | 
			
		||||
# -*- coding: latin-1 -*-
 | 
			
		||||
from PyQt4 import QtGui
 | 
			
		||||
from processing.gui.ParametersPanel import ParametersPanel
 | 
			
		||||
from processing.gui.AlgorithmExecutionDialog import AlgorithmExecutionDialog
 | 
			
		||||
from PyQt4 import QtCore
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ParametersDialog(AlgorithmExecutionDialog):
 | 
			
		||||
@ -36,5 +35,8 @@ class ParametersDialog(AlgorithmExecutionDialog):
 | 
			
		||||
    '''the default parameters dialog, to be used when an algorithm is called from the toolbox'''
 | 
			
		||||
    def __init__(self, alg):
 | 
			
		||||
        self.paramTable = ParametersPanel(self, alg)
 | 
			
		||||
        AlgorithmExecutionDialog.__init__(self, alg, self.paramTable)
 | 
			
		||||
        self.scrollArea = QtGui.QScrollArea()        
 | 
			
		||||
        self.scrollArea.setWidget(self.paramTable)
 | 
			
		||||
        self.scrollArea.setWidgetResizable(True)
 | 
			
		||||
        AlgorithmExecutionDialog.__init__(self, alg, self.scrollArea)
 | 
			
		||||
        self.executed = False
 | 
			
		||||
 | 
			
		||||
@ -79,93 +79,75 @@ class ParametersPanel(QtGui.QWidget):
 | 
			
		||||
 | 
			
		||||
    def initGUI(self):
 | 
			
		||||
        tooltips = self.alg.getParameterDescriptions()
 | 
			
		||||
        tableLike = ProcessingConfig.getSetting(ProcessingConfig.TABLE_LIKE_PARAM_PANEL)
 | 
			
		||||
        if tableLike:
 | 
			
		||||
            self.tableWidget = QtGui.QTableWidget()
 | 
			
		||||
            self.tableWidget.setSelectionMode(QtGui.QAbstractItemView.NoSelection)
 | 
			
		||||
            self.tableWidget.setColumnCount(2)
 | 
			
		||||
            self.tableWidget.setColumnWidth(0,300)
 | 
			
		||||
            self.tableWidget.setColumnWidth(1,300)
 | 
			
		||||
            self.tableWidget.setHorizontalHeaderItem(0, QtGui.QTableWidgetItem("Parameter"))
 | 
			
		||||
            self.tableWidget.setHorizontalHeaderItem(1, QtGui.QTableWidgetItem("Value"))
 | 
			
		||||
            self.tableWidget.verticalHeader().setVisible(False)
 | 
			
		||||
            self.tableWidget.horizontalHeader().setResizeMode(QtGui.QHeaderView.Stretch)
 | 
			
		||||
            self.setTableContent()
 | 
			
		||||
            self.verticalLayout = QtGui.QVBoxLayout()
 | 
			
		||||
            self.verticalLayout.setSpacing(0)
 | 
			
		||||
            self.verticalLayout.setMargin(0)
 | 
			
		||||
            self.verticalLayout.addWidget(self.tableWidget)
 | 
			
		||||
            self.setLayout(self.verticalLayout)
 | 
			
		||||
        else:
 | 
			
		||||
            self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
 | 
			
		||||
            self.verticalLayout = QtGui.QVBoxLayout()
 | 
			
		||||
            self.verticalLayout.setSpacing(5)
 | 
			
		||||
            self.verticalLayout.setMargin(20)
 | 
			
		||||
            for param in self.alg.parameters:
 | 
			
		||||
                if param.isAdvanced:
 | 
			
		||||
                    self.advancedButton = QtGui.QPushButton()
 | 
			
		||||
                    self.advancedButton.setText("Show advanced parameters")
 | 
			
		||||
                    self.advancedButton.setMaximumWidth(250)
 | 
			
		||||
                    QtCore.QObject.connect(self.advancedButton, QtCore.SIGNAL("clicked()"), self.showAdvancedParametersClicked)
 | 
			
		||||
                    self.verticalLayout.addWidget(self.advancedButton)
 | 
			
		||||
                    break
 | 
			
		||||
            for param in self.alg.parameters:
 | 
			
		||||
                if param.hidden:
 | 
			
		||||
                    continue
 | 
			
		||||
                desc = param.description
 | 
			
		||||
                if isinstance(param, ParameterExtent):
 | 
			
		||||
                    desc += "(xmin, xmax, ymin, ymax)"
 | 
			
		||||
                label = QtGui.QLabel(desc)
 | 
			
		||||
                self.labels[param.name] = label
 | 
			
		||||
                widget = self.getWidgetFromParameter(param)
 | 
			
		||||
                self.valueItems[param.name] = widget
 | 
			
		||||
                if isinstance(param, ParameterVector) and not self.alg.allowOnlyOpenedLayers:
 | 
			
		||||
                    layout = QtGui.QHBoxLayout()
 | 
			
		||||
                    layout.setSpacing(2)
 | 
			
		||||
                    layout.setMargin(0)
 | 
			
		||||
                    layout.addWidget(widget)
 | 
			
		||||
                    button = QtGui.QToolButton()
 | 
			
		||||
                    icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/iterate.png")
 | 
			
		||||
                    button.setIcon(icon)
 | 
			
		||||
                    button.setToolTip("Iterate over this layer")
 | 
			
		||||
                    button.setCheckable(True)
 | 
			
		||||
                    button.setMaximumWidth(30)
 | 
			
		||||
                    button.setMaximumHeight(30)
 | 
			
		||||
                    layout.addWidget(button)
 | 
			
		||||
                    self.iterateButtons[param.name] = button
 | 
			
		||||
                    QtCore.QObject.connect(button, QtCore.SIGNAL("toggled(bool)"), self.buttonToggled)
 | 
			
		||||
                    widget = QtGui.QWidget()
 | 
			
		||||
                    widget.setLayout(layout)
 | 
			
		||||
                if param.name in tooltips.keys():
 | 
			
		||||
                    tooltip = tooltips[param.name]
 | 
			
		||||
                else:
 | 
			
		||||
                    tooltip = param.description
 | 
			
		||||
                label.setToolTip(tooltip)
 | 
			
		||||
                widget.setToolTip(tooltip)
 | 
			
		||||
                if param.isAdvanced:
 | 
			
		||||
                    label.setVisible(self.showAdvanced)
 | 
			
		||||
                    widget.setVisible(self.showAdvanced)
 | 
			
		||||
                    self.widgets[param.name] = widget
 | 
			
		||||
                self.verticalLayout.addWidget(label)
 | 
			
		||||
                self.verticalLayout.addWidget(widget)
 | 
			
		||||
        self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
 | 
			
		||||
        self.verticalLayout = QtGui.QVBoxLayout()
 | 
			
		||||
        self.verticalLayout.setSpacing(5)
 | 
			
		||||
        self.verticalLayout.setMargin(20)
 | 
			
		||||
        for param in self.alg.parameters:
 | 
			
		||||
            if param.isAdvanced:
 | 
			
		||||
                self.advancedButton = QtGui.QPushButton()
 | 
			
		||||
                self.advancedButton.setText("Show advanced parameters")
 | 
			
		||||
                self.advancedButton.setMaximumWidth(250)
 | 
			
		||||
                QtCore.QObject.connect(self.advancedButton, QtCore.SIGNAL("clicked()"), self.showAdvancedParametersClicked)
 | 
			
		||||
                self.verticalLayout.addWidget(self.advancedButton)
 | 
			
		||||
                break
 | 
			
		||||
        for param in self.alg.parameters:
 | 
			
		||||
            if param.hidden:
 | 
			
		||||
                continue
 | 
			
		||||
            desc = param.description
 | 
			
		||||
            if isinstance(param, ParameterExtent):
 | 
			
		||||
                desc += "(xmin, xmax, ymin, ymax)"
 | 
			
		||||
            label = QtGui.QLabel(desc)
 | 
			
		||||
            self.labels[param.name] = label
 | 
			
		||||
            widget = self.getWidgetFromParameter(param)
 | 
			
		||||
            self.valueItems[param.name] = widget
 | 
			
		||||
            if isinstance(param, ParameterVector) and not self.alg.allowOnlyOpenedLayers:
 | 
			
		||||
                layout = QtGui.QHBoxLayout()
 | 
			
		||||
                layout.setSpacing(2)
 | 
			
		||||
                layout.setMargin(0)
 | 
			
		||||
                layout.addWidget(widget)
 | 
			
		||||
                button = QtGui.QToolButton()
 | 
			
		||||
                icon = QtGui.QIcon(os.path.dirname(__file__) + "/../images/iterate.png")
 | 
			
		||||
                button.setIcon(icon)
 | 
			
		||||
                button.setToolTip("Iterate over this layer")
 | 
			
		||||
                button.setCheckable(True)
 | 
			
		||||
                button.setMaximumWidth(30)
 | 
			
		||||
                button.setMaximumHeight(30)
 | 
			
		||||
                layout.addWidget(button)
 | 
			
		||||
                self.iterateButtons[param.name] = button
 | 
			
		||||
                QtCore.QObject.connect(button, QtCore.SIGNAL("toggled(bool)"), self.buttonToggled)
 | 
			
		||||
                widget = QtGui.QWidget()
 | 
			
		||||
                widget.setLayout(layout)
 | 
			
		||||
            if param.name in tooltips.keys():
 | 
			
		||||
                tooltip = tooltips[param.name]
 | 
			
		||||
            else:
 | 
			
		||||
                tooltip = param.description
 | 
			
		||||
            label.setToolTip(tooltip)
 | 
			
		||||
            widget.setToolTip(tooltip)
 | 
			
		||||
            if param.isAdvanced:
 | 
			
		||||
                label.setVisible(self.showAdvanced)
 | 
			
		||||
                widget.setVisible(self.showAdvanced)
 | 
			
		||||
                self.widgets[param.name] = widget
 | 
			
		||||
            self.verticalLayout.addWidget(label)
 | 
			
		||||
            self.verticalLayout.addWidget(widget)
 | 
			
		||||
 | 
			
		||||
            for output in self.alg.outputs:
 | 
			
		||||
                if output.hidden:
 | 
			
		||||
                    continue
 | 
			
		||||
                label = QtGui.QLabel(output.description)
 | 
			
		||||
                widget = OutputSelectionPanel(output,self.alg)
 | 
			
		||||
                self.verticalLayout.addWidget(label)
 | 
			
		||||
                self.verticalLayout.addWidget(widget)
 | 
			
		||||
                if isinstance(output, (OutputRaster, OutputVector, OutputTable)):
 | 
			
		||||
                    check = QtGui.QCheckBox()
 | 
			
		||||
                    check.setText("Open output file after running algorithm")
 | 
			
		||||
                    check.setChecked(True)
 | 
			
		||||
                    self.verticalLayout.addWidget(check)
 | 
			
		||||
                    self.checkBoxes[output.name] = check
 | 
			
		||||
                self.valueItems[output.name] = widget
 | 
			
		||||
        for output in self.alg.outputs:
 | 
			
		||||
            if output.hidden:
 | 
			
		||||
                continue
 | 
			
		||||
            label = QtGui.QLabel(output.description)
 | 
			
		||||
            widget = OutputSelectionPanel(output,self.alg)
 | 
			
		||||
            self.verticalLayout.addWidget(label)
 | 
			
		||||
            self.verticalLayout.addWidget(widget)
 | 
			
		||||
            if isinstance(output, (OutputRaster, OutputVector, OutputTable)):
 | 
			
		||||
                check = QtGui.QCheckBox()
 | 
			
		||||
                check.setText("Open output file after running algorithm")
 | 
			
		||||
                check.setChecked(True)
 | 
			
		||||
                self.verticalLayout.addWidget(check)
 | 
			
		||||
                self.checkBoxes[output.name] = check
 | 
			
		||||
            self.valueItems[output.name] = widget
 | 
			
		||||
 | 
			
		||||
            self.verticalLayout.addStretch(1000)
 | 
			
		||||
            self.setLayout(self.verticalLayout)
 | 
			
		||||
        self.verticalLayout.addStretch(1000)
 | 
			
		||||
        self.setLayout(self.verticalLayout)
 | 
			
		||||
 | 
			
		||||
    def showAdvancedParametersClicked(self):
 | 
			
		||||
        self.showAdvanced = not self.showAdvanced
 | 
			
		||||
 | 
			
		||||
@ -138,7 +138,6 @@ class ProcessingToolbox(QDockWidget, Ui_ProcessingToolbox):
 | 
			
		||||
            if message:
 | 
			
		||||
                dlg = MissingDependencyDialog(message)
 | 
			
		||||
                dlg.exec_()
 | 
			
		||||
                #QMessageBox.warning(self, self.tr("Warning"), message)
 | 
			
		||||
                return
 | 
			
		||||
            alg = alg.getCopy()
 | 
			
		||||
            dlg = alg.getCustomParametersDialog()
 | 
			
		||||
 | 
			
		||||
@ -34,7 +34,6 @@ from processing.tools import vector
 | 
			
		||||
from processing.core.ProcessingLog import ProcessingLog
 | 
			
		||||
from processing.gui.Postprocessing import Postprocessing
 | 
			
		||||
from processing.core.SilentProgress import SilentProgress
 | 
			
		||||
import traceback
 | 
			
		||||
 | 
			
		||||
class UnthreadedAlgorithmExecutor:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -16,6 +16,7 @@
 | 
			
		||||
*                                                                         *
 | 
			
		||||
***************************************************************************
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
__author__ = 'Victor Olaya'
 | 
			
		||||
__date__ = 'August 2012'
 | 
			
		||||
__copyright__ = '(C) 2012, Victor Olaya'
 | 
			
		||||
@ -33,6 +34,7 @@ from processing.parameters.ParameterFactory import ParameterFactory
 | 
			
		||||
from processing.modeler.WrongModelException import WrongModelException
 | 
			
		||||
from processing.modeler.ModelerUtils import ModelerUtils
 | 
			
		||||
from processing.parameters.ParameterRaster import ParameterRaster
 | 
			
		||||
from processing.parameters.ParameterDataObject import ParameterDataObject
 | 
			
		||||
from processing.tools import dataobjects
 | 
			
		||||
from processing.parameters.ParameterExtent import ParameterExtent
 | 
			
		||||
from PyQt4 import QtCore, QtGui
 | 
			
		||||
@ -461,12 +463,14 @@ class ModelerAlgorithm(GeoAlgorithm):
 | 
			
		||||
                    value = self.getValueFromAlgorithmAndParameter(aap)
 | 
			
		||||
                    layerslist.append(str(value))
 | 
			
		||||
                value = ";".join(layerslist)
 | 
			
		||||
                if not param.setValue(value):
 | 
			
		||||
                    raise GeoAlgorithmExecutionException("Wrong value: " + str(value))
 | 
			
		||||
                
 | 
			
		||||
                #if not param.setValue(value):
 | 
			
		||||
                    #raise GeoAlgorithmExecutionException("Wrong value: " + str(value))
 | 
			
		||||
 | 
			
		||||
            else:
 | 
			
		||||
                value = self.getValueFromAlgorithmAndParameter(aap)
 | 
			
		||||
                if not param.setValue(value):
 | 
			
		||||
                #we allow unexistent filepaths, since that allows algorithms to skip some conversion routines
 | 
			
		||||
                if not param.setValue(value) and not isinstance(param, ParameterDataObject):
 | 
			
		||||
                    raise GeoAlgorithmExecutionException("Wrong value: " + str(value))
 | 
			
		||||
        for out in alg.outputs:
 | 
			
		||||
            val = self.algOutputs[iAlg][out.name]
 | 
			
		||||
@ -557,7 +561,7 @@ class ModelerAlgorithm(GeoAlgorithm):
 | 
			
		||||
                            progress.setDebugInfo("Parameters: " +
 | 
			
		||||
                                ', '.join([unicode(p).strip() + "=" + unicode(p.value) for p in alg.parameters]))
 | 
			
		||||
                            t0 = time.time()
 | 
			
		||||
                            alg.execute(progress)
 | 
			
		||||
                            alg.execute(progress, self)
 | 
			
		||||
                            dt = time.time() - t0
 | 
			
		||||
                            for out in alg.outputs:
 | 
			
		||||
                                outputs[out.name] = out.value
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,6 @@
 | 
			
		||||
*                                                                         *
 | 
			
		||||
***************************************************************************
 | 
			
		||||
"""
 | 
			
		||||
import os
 | 
			
		||||
 | 
			
		||||
__author__ = 'Victor Olaya'
 | 
			
		||||
__date__ = 'August 2012'
 | 
			
		||||
@ -24,10 +23,10 @@ __copyright__ = '(C) 2012, Victor Olaya'
 | 
			
		||||
# This will get replaced with a git SHA1 when you do a git archive
 | 
			
		||||
__revision__ = '$Format:%H$'
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
from processing.parameters.ParameterDataObject import ParameterDataObject
 | 
			
		||||
from processing.tools import dataobjects
 | 
			
		||||
from qgis.core import *
 | 
			
		||||
from processing.tools import dataobjects
 | 
			
		||||
 | 
			
		||||
class ParameterRaster(ParameterDataObject):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -129,7 +129,7 @@ class ProcessingProviderTestCase(unittest.TestCase):
 | 
			
		||||
                yield
 | 
			
		||||
 | 
			
		||||
    def setUp(self):
 | 
			
		||||
        ProcessingConfig.setSettingValue(ProcessingConfig.USE_THREADS, self.threaded)
 | 
			
		||||
        #ProcessingConfig.setSettingValue(ProcessingConfig.USE_THREADS, self.threaded)
 | 
			
		||||
        print
 | 
			
		||||
        print bcolors.INFO, self.msg, bcolors.ENDC,
 | 
			
		||||
        print "Parameters: ", self.alg.parameters,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user