mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
[processing] fixes for SAGA folder configuration
This tries to address some problem with previously set SAGA paths, by always showing the SAGA path config value, and by trying to ruin a built in copy of SAGA if the current SAGA folder is wrong (as it usually happens when updating QGIS)
This commit is contained in:
parent
7028eee198
commit
f852603f07
@ -58,7 +58,7 @@ class SagaAlgorithmProvider(AlgorithmProvider):
|
||||
self.activate = True
|
||||
|
||||
def initializeSettings(self):
|
||||
if (isWindows() or isMac()) and SagaUtils.findSagaFolder() is None:
|
||||
if (isWindows() or isMac()):
|
||||
ProcessingConfig.addSetting(Setting("SAGA",
|
||||
SagaUtils.SAGA_FOLDER, self.tr('SAGA folder'),
|
||||
'',
|
||||
@ -78,7 +78,7 @@ class SagaAlgorithmProvider(AlgorithmProvider):
|
||||
|
||||
def unload(self):
|
||||
AlgorithmProvider.unload(self)
|
||||
if (isWindows() or isMac()) and SagaUtils.findSagaFolder() is None:
|
||||
if (isWindows() or isMac()):
|
||||
ProcessingConfig.removeSetting(SagaUtils.SAGA_FOLDER)
|
||||
|
||||
ProcessingConfig.removeSetting(SagaUtils.SAGA_LOG_CONSOLE)
|
||||
|
@ -72,10 +72,13 @@ def findSagaFolder():
|
||||
|
||||
def sagaPath():
|
||||
folder = ProcessingConfig.getSetting(SAGA_FOLDER)
|
||||
if not os.path.isdir(folder):
|
||||
folder = None
|
||||
ProcessingLog.addToLog(ProcessingLog.LOG_WARNING,
|
||||
'Specified SAGA folder does not exist. Will try to find built-in binaries.')
|
||||
if folder is None or folder == '':
|
||||
folder = findSagaFolder()
|
||||
if folder is not None:
|
||||
ProcessingConfig.setSettingValue(SAGA_FOLDER, folder)
|
||||
|
||||
return folder or ''
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user