Skip to content

Commit

Permalink
[processing] return string from selection type setting when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Jan 18, 2017
1 parent 90d233a commit 08e0eac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion python/plugins/processing/core/ProcessingConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/core/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 08e0eac

Please sign in to comment.