Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] improved saga/grass/otb installation checks
  • Loading branch information
volaya committed Sep 24, 2013
1 parent 983066a commit 75ba3be
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
13 changes: 7 additions & 6 deletions python/plugins/processing/grass/GrassUtils.py
Expand Up @@ -50,6 +50,8 @@ class GrassUtils:
sessionRunning = False
sessionLayers = {}
projectionSet = False

isGrassInstalled = False


@staticmethod
Expand Down Expand Up @@ -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 == "":
Expand All @@ -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
Expand All @@ -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



Expand Down
6 changes: 6 additions & 0 deletions python/plugins/processing/otb/OTBAlgorithm.py
Expand Up @@ -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()
Expand Down
14 changes: 7 additions & 7 deletions python/plugins/processing/saga/SagaUtils.py
Expand Up @@ -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
Expand Down Expand Up @@ -132,7 +134,7 @@ def executeSaga(progress):


@staticmethod
def checkSagaIsInstalled(ignoreRegistrySettings=False):
def checkSagaIsInstalled(ignorePreviousState=False):
if isWindows():
path = SagaUtils.sagaPath()
if path == "":
Expand All @@ -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:
Expand All @@ -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.