Skip to content

Commit

Permalink
[processing] some SAGA fixes
Browse files Browse the repository at this point in the history
-fixed raster export
-fixed version numbering when no saga installation is found
  • Loading branch information
volaya committed Jan 20, 2015
1 parent 5511c86 commit e9228b6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
8 changes: 6 additions & 2 deletions python/plugins/processing/algs/saga/SagaAlgorithm212.py
Expand Up @@ -304,8 +304,12 @@ def getOutputCellsize(self):
def exportRasterLayer(self, source):
global sessionExportedLayers
if source in sessionExportedLayers:
self.exportedLayers[source] = sessionExportedLayers[source]
return None
exportedLayer = sessionExportedLayers[source]
if os.path.exists(exportedLayer):
self.exportedLayers[source] = exportedLayer
return None
else:
del sessionExportedLayers[source]
layer = dataobjects.getObjectFromUri(source, False)
if layer:
filename = str(layer.name())
Expand Down
11 changes: 7 additions & 4 deletions python/plugins/processing/algs/saga/SagaAlgorithm213.py
Expand Up @@ -42,7 +42,6 @@

sessionExportedLayers = {}


class SagaAlgorithm213(SagaAlgorithm212):

OUTPUT_EXTENT = 'OUTPUT_EXTENT'
Expand Down Expand Up @@ -225,11 +224,15 @@ def processAlgorithm(self, progress):
def exportRasterLayer(self, source):
global sessionExportedLayers
if source in sessionExportedLayers:
self.exportedLayers[source] = sessionExportedLayers[source]
return None
exportedLayer = sessionExportedLayers[source]
if os.path.exists(exportedLayer):
self.exportedLayers[source] = exportedLayer
return None
else:
del sessionExportedLayers[source]
layer = dataobjects.getObjectFromUri(source, False)
if layer:
filename = str(layer.name())
filename = layer.name()
else:
filename = os.path.basename(source)
validChars = \
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/saga/SagaAlgorithmProvider.py
Expand Up @@ -102,7 +102,8 @@ def _loadAlgorithm(self, descriptionFile):
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
self.tr('Could not open SAGA algorithm: %s\n%s' % (descriptionFile, str(e))))
def getDescription(self):
return 'SAGA (%s)' % SagaUtils.getSagaInstalledVersion()
version = SagaUtils.getSagaInstalledVersion()
return 'SAGA (%s)' % version if version is not None else 'SAGA'

def getName(self):
return 'saga'
Expand Down
1 change: 0 additions & 1 deletion python/plugins/processing/algs/saga/SagaUtils.py
Expand Up @@ -27,7 +27,6 @@

import os
import stat
import traceback
import subprocess
from PyQt4.QtCore import *
from qgis.core import *
Expand Down

0 comments on commit e9228b6

Please sign in to comment.