Skip to content

Commit 60f7824

Browse files
committed
[processing] extension can now be specified for OutputFile
1 parent a7cb486 commit 60f7824

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

python/plugins/processing/outputs/Output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(self, name='', description='', hidden=False):
4545
# in a vector layer). In the case of layers, hidden outputs are
4646
# not loaded into QGIS after the algorithm is executed. Other
4747
# outputs not representing layers or tables should always be hidden.
48-
self.hidden = hidden
48+
self.hidden = str(hidden).lower() == str(True).lower()
4949

5050
# This value indicates whether the output has to be opened
5151
# after being produced by the algorithm or not

python/plugins/processing/outputs/OutputFactory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ def getFromString(s):
5353
if len(tokens) == 2:
5454
return clazz(tokens[0], tokens[1])
5555
else:
56-
return clazz(tokens[0], tokens[1], tokens[2] == str(True))
56+
return clazz(tokens[0], tokens[1], tokens[2])

python/plugins/processing/outputs/OutputFile.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,16 @@
3030

3131
class OutputFile(Output):
3232

33+
def __init__(self, name='', description='', ext = None):
34+
self.name = name
35+
self.description = description
36+
self.ext = ext
37+
3338
def getFileFilter(self, alg):
34-
return 'All files(*.*)'
39+
if self.ext is None:
40+
return 'All files(*.*)'
41+
else:
42+
return '%s files(*.%s)' % self.ext
3543

3644
def getDefaultFileExtension(self, alg):
37-
return 'file'
45+
return self.ext or 'file'

0 commit comments

Comments
 (0)