Skip to content
Permalink
Browse files

[sextante] moved SilentProgress to independent module

  • Loading branch information
volaya committed Apr 9, 2013
1 parent 487c424 commit c57a1a4b3f38cfb8bd545793d1f8267736f5a705
@@ -34,8 +34,8 @@
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)
@@ -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
@@ -185,7 +185,7 @@ def accept(self):
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]:
@@ -30,6 +30,7 @@
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 @@ def runalgIterating(alg,paramToIter,progress):

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

0 comments on commit c57a1a4

Please sign in to comment.
You can’t perform that action at this time.