Skip to content

Commit

Permalink
[sextante] moved SilentProgress to independent module
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Apr 9, 2013
1 parent 487c424 commit c57a1a4
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
15 changes: 10 additions & 5 deletions python/plugins/sextante/core/Sextante.py
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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)
Expand Down
19 changes: 19 additions & 0 deletions python/plugins/sextante/core/SilentProgress.py
@@ -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
2 changes: 1 addition & 1 deletion python/plugins/sextante/gui/BatchProcessingDialog.py
Expand Up @@ -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]:
Expand Down
21 changes: 1 addition & 20 deletions python/plugins/sextante/gui/UnthreadedAlgorithmExecutor.py
Expand Up @@ -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:
Expand Down Expand Up @@ -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.