Skip to content
Permalink
Browse files

[processing] return string from selection type setting when necessary

  • Loading branch information
alexbruy committed Jan 18, 2017
1 parent 90d233a commit 08e0eacfef39b0a054979e25b0b08651e932cfe1
Showing with 6 additions and 4 deletions.
  1. +3 −1 python/plugins/processing/core/ProcessingConfig.py
  2. +3 −3 python/plugins/processing/core/outputs.py
@@ -224,7 +224,7 @@ def readSettings():
setting.read()

@staticmethod
def getSetting(name):
def getSetting(name, readable=False):
if name in list(ProcessingConfig.settings.keys()):
v = ProcessingConfig.settings[name].value
try:
@@ -233,6 +233,8 @@ def getSetting(name):
except:
pass
if ProcessingConfig.settings[name].valuetype == Setting.SELECTION:
if readable:
return v
return ProcessingConfig.settings[name].options.index(v)
else:
return v
@@ -214,7 +214,7 @@ def getFileFilter(self, alg):
return ';;'.join(exts)

def getDefaultFileExtension(self):
return ProcessingConfig.getSetting(ProcessingConfig.DEFAULT_OUTPUT_RASTER_LAYER_EXT)
return ProcessingConfig.getSetting(ProcessingConfig.DEFAULT_OUTPUT_RASTER_LAYER_EXT, True)

def getCompatibleFileName(self, alg):
"""
@@ -232,7 +232,7 @@ def getCompatibleFileName(self, alg):
else:
if self.compatible is None:
supported = alg.provider.getSupportedOutputRasterLayerExtensions()
default = ProcessingConfig.getSetting(ProcessingConfig.DEFAULT_OUTPUT_RASTER_LAYER_EXT)
default = ProcessingConfig.getSetting(ProcessingConfig.DEFAULT_OUTPUT_RASTER_LAYER_EXT, True)
ext = default if default in supported else supported[0]
self.compatible = getTempFilenameInTempFolder(self.name + '.' + ext)
return self.compatible
@@ -329,7 +329,7 @@ def getFileFilter(self, alg):

def getDefaultFileExtension(self):
if self.hasGeometry():
default = ProcessingConfig.getSetting(ProcessingConfig.DEFAULT_OUTPUT_VECTOR_LAYER_EXT)
default = ProcessingConfig.getSetting(ProcessingConfig.DEFAULT_OUTPUT_VECTOR_LAYER_EXT, True)
else:
default = 'dbf'
return default

0 comments on commit 08e0eac

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