Skip to content
Permalink
Browse files
Log console output (SAGA; OTB; GRASS).
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@339 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
cpolymeris@gmail.com committed Aug 7, 2012
1 parent 4bb5e36 commit ec1424b
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 1 deletion.
@@ -274,7 +274,7 @@ def processAlgorithm(self, progress):
loglines = []
loglines.append("GRASS execution commands")
for line in commands:
progress.setInfo(line)
progress.setCommand(line)
loglines.append(line)
if SextanteConfig.getSetting(GrassUtils.GRASS_LOG_COMMANDS):
SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)
@@ -265,6 +265,7 @@ def executeGrass(commands, progress):
pass
else:
loglines.append(line)
progress.setConsoleInfo(line)
if SextanteConfig.getSetting(GrassUtils.GRASS_LOG_CONSOLE):
SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)
shutil.rmtree(GrassUtils.grassMapsetFolder(), True)
@@ -209,6 +209,7 @@ def accept(self):
if SextanteConfig.getSetting(SextanteConfig.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()
self.setInfo("<b>Algorithm %s started</b>" % self.alg.name)
self.buttonBox.button(QtGui.QDialogButtonBox.Cancel).setEnabled(True)
@@ -304,6 +305,10 @@ def setCommand(self, cmd):
def setDebugInfo(self, msg):
self.setInfo('<span style="color:blue">' + msg + '</span>')

@pyqtSlot(str)
def setConsoleInfo(self, msg):
self.setCommand('<span style="color:darkgray">' + msg + '</span>')

def setPercentage(self, i):
if self.progress.maximum() == 0:
self.progress.setMaximum(100)
@@ -14,6 +14,7 @@ class AlgorithmExecutor(QThread):
infoSet = pyqtSignal(str)
commandSet = pyqtSignal(str)
debugInfoSet = pyqtSignal(str)
consoleInfoSet = pyqtSignal(str)
#started & finished inherited from QThread

def __init__(self, alg, iterParam = None, parent = None):
@@ -34,6 +35,8 @@ 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
@@ -83,3 +83,6 @@ def setCommand(self, _):

def setDebugInfo(self, _):
pass

def setConsoleInfo(self, _):
pass
@@ -65,6 +65,7 @@ def executeOtb(commands, progress):
progress.setPercentage(perc)
else:
loglines.append(line)
progress.setConsoleInfo(line)
SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)


@@ -79,6 +79,7 @@ def executeSaga(progress):
line = line.strip()
if line!="/" and line!="-" and line !="\\" and line!="|":
loglines.append(line)
progress.setConsoleInfo(line)
if SextanteConfig.getSetting(SagaUtils.SAGA_LOG_CONSOLE):
SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)

0 comments on commit ec1424b

Please sign in to comment.