Skip to content

Commit d5d2fe5

Browse files
committedMar 23, 2013
[sextante] added file filters to input boxes in batch processing dialog
1 parent d0e5ce7 commit d5d2fe5

File tree

6 files changed

+29
-5
lines changed

6 files changed

+29
-5
lines changed
 

‎python/plugins/sextante/gui/BatchInputSelectionPanel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ def showSelectionDialog(self):
5757
elif os.path.isdir(os.path.dirname(text)):
5858
path = os.path.dirname(text)
5959
elif settings.contains("/SextanteQGIS/LastInputPath"):
60-
path = str(settings.value( "/SextanteQGIS/LastInputPath",QtCore.QVariant( "" ) ).toString())
60+
path = str(settings.value( "/SextanteQGIS/LastInputPath",QtCore.QVariant("")).toString())
6161
else:
6262
path = ""
6363

64-
ret = QtGui.QFileDialog.getOpenFileNames(self, "Open file", path, "All files (*.*)")
64+
ret = QtGui.QFileDialog.getOpenFileNames(self, "Open file", path, self.param.getFileFilter())
6565
if ret:
6666
files = list(ret)
6767
if len(files) == 1:

‎python/plugins/sextante/outputs/OutputRaster.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@
1616
* *
1717
***************************************************************************
1818
"""
19-
from sextante.core.QGisLayers import QGisLayers
20-
from sextante.core.SextanteRasterWriter import SextanteRasterWriter
2119

2220
__author__ = 'Victor Olaya'
2321
__date__ = 'August 2012'
2422
__copyright__ = '(C) 2012, Victor Olaya'
2523
# This will get replaced with a git SHA1 when you do a git archive
2624
__revision__ = '$Format:%H$'
2725

26+
from sextante.core.QGisLayers import QGisLayers
2827
from sextante.outputs.Output import Output
2928
from sextante.core.SextanteUtils import SextanteUtils
3029

‎python/plugins/sextante/parameters/ParameterMultipleInput.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,14 @@ def getAsString(self,value):
135135
return unicode(layer.source())
136136
return s
137137

138-
138+
def getFileFilter(self):
139+
if self.datatype == ParameterMultipleInput.TYPE_RASTER:
140+
exts = QGisLayers.getSupportedOutputRasterLayerExtensions()
141+
else:
142+
exts = QGisLayers.getSupportedOutputVectorLayerExtensions()
143+
for i in range(len(exts)):
144+
exts[i] = exts[i].upper() + " files(*." + exts[i].lower() + ")"
145+
return ";;".join(exts)
139146

140147
def serialize(self):
141148
return self.__module__.split(".")[-1] + "|" + self.name + "|" + self.description +\

‎python/plugins/sextante/parameters/ParameterRaster.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ def setValue(self, obj):
7575
self.value = unicode(layer.dataProvider().dataSourceUri())
7676
return True
7777
return os.path.exists(self.value)
78+
79+
def getFileFilter(self):
80+
exts = QGisLayers.getSupportedOutputRasterLayerExtensions()
81+
for i in range(len(exts)):
82+
exts[i] = exts[i].upper() + " files(*." + exts[i].lower() + ")"
83+
return ";;".join(exts)
7884

7985
def serialize(self):
8086
return self.__module__.split(".")[-1] + "|" + self.name + "|" + self.description +\

‎python/plugins/sextante/parameters/ParameterTable.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ def getSafeExportedTable(self):
7878
else:
7979
self.exported = self.value
8080
return self.exported
81+
82+
def getFileFilter(self,alg):
83+
exts = ['csv', 'dbf']
84+
for i in range(len(exts)):
85+
exts[i] = exts[i].upper() + " files(*." + exts[i].lower() + ")"
86+
return ";;".join(exts)
8187

8288
def serialize(self):
8389
return self.__module__.split(".")[-1] + "|" + self.name + "|" + self.description +\

‎python/plugins/sextante/parameters/ParameterVector.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ def getSafeExportedLayer(self):
8383
else:
8484
self.exported = self.value
8585
return self.exported
86+
87+
def getFileFilter(self):
88+
exts = QGisLayers.getSupportedOutputVectorLayerExtensions()
89+
for i in range(len(exts)):
90+
exts[i] = exts[i].upper() + " files(*." + exts[i].lower() + ")"
91+
return ";;".join(exts)
8692

8793
def serialize(self):
8894
return self.__module__.split(".")[-1] + "|" + self.name + "|" + self.description +\

0 commit comments

Comments
 (0)
Please sign in to comment.