Skip to content

Commit

Permalink
[processing] extension can now be specified for OutputFile
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed May 15, 2014
1 parent a7cb486 commit 60f7824
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/plugins/processing/outputs/Output.py
Expand Up @@ -45,7 +45,7 @@ def __init__(self, name='', description='', hidden=False):
# 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
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/outputs/OutputFactory.py
Expand Up @@ -53,4 +53,4 @@ def getFromString(s):
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])
12 changes: 10 additions & 2 deletions python/plugins/processing/outputs/OutputFile.py
Expand Up @@ -30,8 +30,16 @@

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'

0 comments on commit 60f7824

Please sign in to comment.