Skip to content

Commit c57a1a4

Browse files
committed
[sextante] moved SilentProgress to independent module
1 parent 487c424 commit c57a1a4

File tree

4 files changed

+31
-26
lines changed

4 files changed

+31
-26
lines changed

python/plugins/sextante/core/Sextante.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
from sextante.gui.AlgorithmExecutor import AlgorithmExecutor
3535
from sextante.gui.RenderingStyles import RenderingStyles
3636
from sextante.gui.SextantePostprocessing import SextantePostprocessing
37-
from sextante.gui.UnthreadedAlgorithmExecutor import UnthreadedAlgorithmExecutor,\
38-
SilentProgress
37+
from sextante.gui.UnthreadedAlgorithmExecutor import UnthreadedAlgorithmExecutor
38+
from sextante.core.SilentProgress import SilentProgress
3939
from sextante.modeler.Providers import Providers
4040
from sextante.modeler.ModelerAlgorithmProvider import ModelerAlgorithmProvider
4141
from sextante.modeler.ModelerOnlyAlgorithmProvider import ModelerOnlyAlgorithmProvider
@@ -384,13 +384,15 @@ def runalg(algOrName, *args):
384384
return alg.getOutputValuesAsDictionary()
385385

386386
def runandload(name, *args):
387-
Sextante.runAlgorithm(name, SextantePostprocessing.handleAlgorithmResults, *args)
387+
return Sextante.runAlgorithm(name, SextantePostprocessing.handleAlgorithmResults, *args)
388388

389389
def extent(layers):
390390
first = True
391391
for layer in layers:
392392
if not isinstance(layer, (QgsRasterLayer, QgsVectorLayer)):
393393
layer = QGisLayers.getObjectFromUri(layer)
394+
if layer is None:
395+
continue
394396
if first:
395397
xmin = layer.extent().xMinimum()
396398
xmax = layer.extent().xMaximum()
@@ -402,7 +404,10 @@ def extent(layers):
402404
ymin = min(ymin, layer.extent().yMinimum())
403405
ymax = max(ymax, layer.extent().yMaximum())
404406
first = False
405-
return str(xmin) + "," + str(xmax) + "," + str(ymin) + "," + str(ymax)
407+
if first:
408+
return "0,0,0,0"
409+
else:
410+
return str(xmin) + "," + str(xmax) + "," + str(ymin) + "," + str(ymax)
406411

407412
def getObjectFromName(name):
408413
layers = QGisLayers.getAllLayers()
@@ -411,7 +416,7 @@ def getObjectFromName(name):
411416
return layer
412417

413418
def getObjectFromUri(uri):
414-
return QGisLayers.getObjectFromUri(uri, False)
419+
return QGisLayers.getObjectFromUri(uri, True)
415420

416421
def getobject(uriorname):
417422
ret = getObjectFromName(uriorname)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class SilentProgress():
2+
3+
def setText(self, text):
4+
pass
5+
6+
def setPercentage(self, i):
7+
pass
8+
9+
def setInfo(self, _):
10+
pass
11+
12+
def setCommand(self, _):
13+
pass
14+
15+
def setDebugInfo(self, _):
16+
pass
17+
18+
def setConsoleInfo(self, _):
19+
pass

python/plugins/sextante/gui/BatchProcessingDialog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def accept(self):
185185
self.progress.setMaximum(len(self.algs))
186186
for alg in self.algs:
187187
self.setBaseText("Processing algorithm " + str(i+1) + "/" + str(len(self.algs)) + "...")
188-
if UnthreadedAlgorithmExecutor.runalg(alg, self):#SilentProgress()):
188+
if UnthreadedAlgorithmExecutor.runalg(alg, self):
189189
#self.progress.setValue(i)
190190
#self.loadHTMLResults(alg, i)
191191
if self.load[i]:

python/plugins/sextante/gui/UnthreadedAlgorithmExecutor.py

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
from sextante.core.QGisLayers import QGisLayers
3131
from sextante.core.SextanteUtils import SextanteUtils
3232
from sextante.gui.SextantePostprocessing import SextantePostprocessing
33+
from sextante.core.SilentProgress import SilentProgress
3334
import traceback
3435

3536
class UnthreadedAlgorithmExecutor:
@@ -91,23 +92,3 @@ def runalgIterating(alg,paramToIter,progress):
9192

9293
return True
9394

94-
95-
class SilentProgress():
96-
97-
def setText(self, text):
98-
pass
99-
100-
def setPercentage(self, i):
101-
pass
102-
103-
def setInfo(self, _):
104-
pass
105-
106-
def setCommand(self, _):
107-
pass
108-
109-
def setDebugInfo(self, _):
110-
pass
111-
112-
def setConsoleInfo(self, _):
113-
pass

0 commit comments

Comments
 (0)