[sextante] moved SilentProgress to independent module

This commit is contained in:
Victor Olaya 2013-04-09 22:22:55 +02:00
parent 487c4243c8
commit c57a1a4b3f
4 changed files with 31 additions and 26 deletions

View File

@ -34,8 +34,8 @@ from sextante.gui.AlgorithmClassification import AlgorithmDecorator
from sextante.gui.AlgorithmExecutor import AlgorithmExecutor
from sextante.gui.RenderingStyles import RenderingStyles
from sextante.gui.SextantePostprocessing import SextantePostprocessing
from sextante.gui.UnthreadedAlgorithmExecutor import UnthreadedAlgorithmExecutor,\
SilentProgress
from sextante.gui.UnthreadedAlgorithmExecutor import UnthreadedAlgorithmExecutor
from sextante.core.SilentProgress import SilentProgress
from sextante.modeler.Providers import Providers
from sextante.modeler.ModelerAlgorithmProvider import ModelerAlgorithmProvider
from sextante.modeler.ModelerOnlyAlgorithmProvider import ModelerOnlyAlgorithmProvider
@ -384,13 +384,15 @@ def runalg(algOrName, *args):
return alg.getOutputValuesAsDictionary()
def runandload(name, *args):
Sextante.runAlgorithm(name, SextantePostprocessing.handleAlgorithmResults, *args)
return Sextante.runAlgorithm(name, SextantePostprocessing.handleAlgorithmResults, *args)
def extent(layers):
first = True
for layer in layers:
if not isinstance(layer, (QgsRasterLayer, QgsVectorLayer)):
layer = QGisLayers.getObjectFromUri(layer)
if layer is None:
continue
if first:
xmin = layer.extent().xMinimum()
xmax = layer.extent().xMaximum()
@ -402,7 +404,10 @@ def extent(layers):
ymin = min(ymin, layer.extent().yMinimum())
ymax = max(ymax, layer.extent().yMaximum())
first = False
return str(xmin) + "," + str(xmax) + "," + str(ymin) + "," + str(ymax)
if first:
return "0,0,0,0"
else:
return str(xmin) + "," + str(xmax) + "," + str(ymin) + "," + str(ymax)
def getObjectFromName(name):
layers = QGisLayers.getAllLayers()
@ -411,7 +416,7 @@ def getObjectFromName(name):
return layer
def getObjectFromUri(uri):
return QGisLayers.getObjectFromUri(uri, False)
return QGisLayers.getObjectFromUri(uri, True)
def getobject(uriorname):
ret = getObjectFromName(uriorname)

View File

@ -0,0 +1,19 @@
class SilentProgress():
def setText(self, text):
pass
def setPercentage(self, i):
pass
def setInfo(self, _):
pass
def setCommand(self, _):
pass
def setDebugInfo(self, _):
pass
def setConsoleInfo(self, _):
pass

View File

@ -185,7 +185,7 @@ class BatchProcessingDialog(AlgorithmExecutionDialog):
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):#SilentProgress()):
if UnthreadedAlgorithmExecutor.runalg(alg, self):
#self.progress.setValue(i)
#self.loadHTMLResults(alg, i)
if self.load[i]:

View File

@ -30,6 +30,7 @@ from sextante.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionEx
from sextante.core.QGisLayers import QGisLayers
from sextante.core.SextanteUtils import SextanteUtils
from sextante.gui.SextantePostprocessing import SextantePostprocessing
from sextante.core.SilentProgress import SilentProgress
import traceback
class UnthreadedAlgorithmExecutor:
@ -91,23 +92,3 @@ class UnthreadedAlgorithmExecutor:
return True
class SilentProgress():
def setText(self, text):
pass
def setPercentage(self, i):
pass
def setInfo(self, _):
pass
def setCommand(self, _):
pass
def setDebugInfo(self, _):
pass
def setConsoleInfo(self, _):
pass