[processing] extension can now be specified for OutputFile

This commit is contained in:
Victor Olaya 2014-05-15 16:33:46 +02:00
parent a7cb486f61
commit 60f782441a
3 changed files with 12 additions and 4 deletions

View File

@ -45,7 +45,7 @@ class Output(object):
# in a vector layer). In the case of layers, hidden outputs are
# not loaded into QGIS after the algorithm is executed. Other
# outputs not representing layers or tables should always be hidden.
self.hidden = hidden
self.hidden = str(hidden).lower() == str(True).lower()
# This value indicates whether the output has to be opened
# after being produced by the algorithm or not

View File

@ -53,4 +53,4 @@ class OutputFactory:
if len(tokens) == 2:
return clazz(tokens[0], tokens[1])
else:
return clazz(tokens[0], tokens[1], tokens[2] == str(True))
return clazz(tokens[0], tokens[1], tokens[2])

View File

@ -30,8 +30,16 @@ from processing.outputs.Output import Output
class OutputFile(Output):
def __init__(self, name='', description='', ext = None):
self.name = name
self.description = description
self.ext = ext
def getFileFilter(self, alg):
return 'All files(*.*)'
if self.ext is None:
return 'All files(*.*)'
else:
return '%s files(*.%s)' % self.ext
def getDefaultFileExtension(self, alg):
return 'file'
return self.ext or 'file'