Skip to content
Permalink
Browse files

[processing] improved saga/grass/otb installation checks

  • Loading branch information
volaya committed Sep 24, 2013
1 parent 983066a commit 75ba3be823d60a1f8ec62b9384397dca31688e6d
@@ -50,6 +50,8 @@ class GrassUtils:
sessionRunning = False
sessionLayers = {}
projectionSet = False

isGrassInstalled = False


@staticmethod
@@ -309,7 +311,7 @@ def addSessionLayers(exportedLayers):
GrassUtils.sessionLayers = dict(GrassUtils.sessionLayers.items() + exportedLayers.items())

@staticmethod
def checkGrassIsInstalled(ignoreRegistrySettings=False):
def checkGrassIsInstalled(ignorePreviousState=False):
if isWindows():
path = GrassUtils.grassPath()
if path == "":
@@ -320,10 +322,9 @@ def checkGrassIsInstalled(ignoreRegistrySettings=False):
+ "Please, go to the processing settings dialog, and check that the GRASS\n"
+ "folder is correctly configured")

settings = QSettings()
GRASS_INSTALLED = "/ProcessingQGIS/GrassInstalled"
if not ignoreRegistrySettings:
if settings.contains(GRASS_INSTALLED):

if not ignorePreviousState:
if GrassUtils.isGrassInstalled:
return
try:
from processing import runalg
@@ -334,7 +335,7 @@ def checkGrassIsInstalled(ignoreRegistrySettings=False):
s = traceback.format_exc()
return "Error while checking GRASS installation. GRASS might not be correctly configured.\n" + s;

settings.setValue(GRASS_INSTALLED, True)
GrassUtils.isGrassInstalled = True



@@ -107,6 +107,12 @@ def defineCharacteristicsFromFile(self):
lines.close()


def checkBeforeOpeningParametersDialog(self):
path = OTBUtils.otbPath()
libpath = OTBUtils.otbLibPath()
if path == "" or libpath == "":
return "OTB folder is not configured.\nPlease configure it before running OTB algorithms."

def processAlgorithm(self, progress):
path = OTBUtils.otbPath()
libpath = OTBUtils.otbLibPath()
@@ -47,6 +47,8 @@ class SagaUtils:
SAGA_RESAMPLING_REGION_CELLSIZE = "SAGA_RESAMPLING_REGION_CELLSIZE"
SAGA_FOLDER = "SAGA_FOLDER"
SAGA_IMPORT_EXPORT_OPTIMIZATION = "SAGA_IMPORT_EXPORT_OPTIMIZATION"

isSagaInstalled = False


@staticmethod
@@ -132,7 +134,7 @@ def executeSaga(progress):


@staticmethod
def checkSagaIsInstalled(ignoreRegistrySettings=False):
def checkSagaIsInstalled(ignorePreviousState=False):
if isWindows():
path = SagaUtils.sagaPath()
if path == "":
@@ -142,11 +144,9 @@ def checkSagaIsInstalled(ignoreRegistrySettings=False):
return ("The specified SAGA folder does not contain a valid SAGA executable.\n"
+ "Please, go to the processing settings dialog, and check that the SAGA\n"
+ "folder is correctly configured")

settings = QSettings()
SAGA_INSTALLED = "/ProcessingQGIS/SagaInstalled"
if not ignoreRegistrySettings:
if settings.contains(SAGA_INSTALLED):

if not ignorePreviousState:
if SagaUtils.isSagaInstalled:
return

try:
@@ -158,4 +158,4 @@ def checkSagaIsInstalled(ignoreRegistrySettings=False):
s = traceback.format_exc()
return "Error while checking SAGA installation. SAGA might not be correctly configured.\n" + s;

settings.setValue(SAGA_INSTALLED, True)
SagaUtils.isSagaInstalled = True

0 comments on commit 75ba3be

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