Skip to content
Permalink
Browse files

added optional logging for SAGA and GRASS

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@278 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf
volayaf committed Jul 1, 2012
1 parent 655bd11 commit 9ceb1cc4a29aecb716f82af69455c9cc485fec80
@@ -254,7 +254,8 @@ def processAlgorithm(self, progress):
loglines.append("GRASS execution commands")
for line in commands:
loglines.append(line)
SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)
if SextanteConfig.getSetting(GrassUtils.GRASS_LOG_COMMANDS):
SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)
GrassUtils.executeGrass(commands, progress);


@@ -8,7 +8,6 @@
from sextante.grass.GrassAlgorithm import GrassAlgorithm
from sextante.core.SextanteUtils import SextanteUtils
from sextante.grass.DefineGrassRegionAction import DefineGrassRegionAction
from sextante.grass.nviz import nviz

class GrassAlgorithmProvider(AlgorithmProvider):

@@ -22,6 +21,8 @@ def initializeSettings(self):
if SextanteUtils.isWindows():
SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_FOLDER, "GRASS folder", GrassUtils.grassPath()))
SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_WIN_SHELL, "Msys folder", GrassUtils.grassWinShell()))
SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_LOG_COMMANDS, "Log execution commands", False))
SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_LOG_CONSOLE, "Log console output", False))
SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_AUTO_REGION, "Use min covering region", True))
SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_LATLON, "Coordinates are lat/lon", False))
SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_REGION_XMIN, "GRASS Region min x", 0))
@@ -44,6 +45,8 @@ def unload(self):
SextanteConfig.removeSetting(GrassUtils.GRASS_REGION_YMAX)
SextanteConfig.removeSetting(GrassUtils.GRASS_REGION_CELLSIZE)
SextanteConfig.removeSetting(GrassUtils.GRASS_HELP_FOLDER)
SextanteConfig.removeSetting(GrassUtils.GRASS_LOG_COMMANDS)
SextanteConfig.removeSetting(GrassUtils.GRASS_LOG_CONSOLE)

def createAlgsList(self):
self.preloadedAlgs = []
@@ -19,6 +19,8 @@ class GrassUtils:
GRASS_FOLDER = "GRASS_FOLDER"
GRASS_HELP_FOLDER = "GRASS_HELP_FOLDER"
GRASS_WIN_SHELL = "GRASS_WIN_SHELL"
GRASS_LOG_COMMANDS = "GRASS_LOG_COMMANDS"
GRASS_LOG_CONSOLE = "GRASS_LOG_CONSOLE"

@staticmethod
def grassBatchJobFilename():
@@ -257,7 +259,8 @@ def executeGrass(commands, progress):
pass
else:
loglines.append(line)
SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)
if SextanteConfig.getSetting(GrassUtils.GRASS_LOG_CONSOLE):
SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)
shutil.rmtree(GrassUtils.grassMapsetFolder(), True)

@staticmethod
@@ -279,7 +279,8 @@ def processAlgorithm(self, progress):
loglines.append("SAGA execution commands")
for line in commands:
loglines.append(line)
SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)
if SextanteConfig.getSetting(SagaUtils.SAGA_LOG_COMMANDS):
SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)
SagaUtils.executeSaga(progress);


@@ -21,6 +21,8 @@ def initializeSettings(self):
if SextanteUtils.isWindows():
SextanteConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_FOLDER, "SAGA folder", SagaUtils.sagaPath()))
SextanteConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_AUTO_RESAMPLING, "Use min covering grid system for resampling", True))
SextanteConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_LOG_COMMANDS, "Log execution commands", False))
SextanteConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_LOG_CONSOLE, "Log console output", False))
SextanteConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_RESAMPLING_REGION_XMIN, "Resampling region min x", 0))
SextanteConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_RESAMPLING_REGION_YMIN, "Resampling region min y", 0))
SextanteConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_RESAMPLING_REGION_XMAX, "Resampling region max x", 1000))
@@ -37,6 +39,8 @@ def unload(self):
SextanteConfig.removeSetting(SagaUtils.SAGA_RESAMPLING_REGION_XMAX)
SextanteConfig.removeSetting(SagaUtils.SAGA_RESAMPLING_REGION_YMAX)
SextanteConfig.removeSetting(SagaUtils.SAGA_RESAMPLING_REGION_CELLSIZE)
SextanteConfig.removeSetting(SagaUtils.SAGA_LOG_CONSOLE)
SextanteConfig.removeSetting(SagaUtils.SAGA_LOG_COMMANDS)

def createAlgsList(self):
self.preloadedAlgs = []
@@ -7,7 +7,8 @@

class SagaUtils:

#SAGA_USE_SELECTED = "SAGA_USE_SELECTED"
SAGA_LOG_COMMANDS = "SAGA_LOG_COMMANDS"
SAGA_LOG_CONSOLE = "SAGA_LOG_CONSOLE"
SAGA_AUTO_RESAMPLING = "SAGA_AUTO_RESAMPLING"
SAGA_RESAMPLING_REGION_XMIN = "SAGA_RESAMPLING_REGION_XMIN"
SAGA_RESAMPLING_REGION_YMIN = "SAGA_RESAMPLING_REGION_YMIN"
@@ -78,7 +79,8 @@ def executeSaga(progress):
line = line.strip()
if line!="/" and line!="-" and line !="\\" and line!="|":
loglines.append(line)
SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)
if SextanteConfig.getSetting(SagaUtils.SAGA_LOG_CONSOLE):
SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)



0 comments on commit 9ceb1cc

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