Skip to content

Commit

Permalink
[sextante] added file filters to input boxes in batch processing dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Mar 23, 2013
1 parent d0e5ce7 commit d5d2fe5
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 5 deletions.
4 changes: 2 additions & 2 deletions python/plugins/sextante/gui/BatchInputSelectionPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ def showSelectionDialog(self):
elif os.path.isdir(os.path.dirname(text)):
path = os.path.dirname(text)
elif settings.contains("/SextanteQGIS/LastInputPath"):
path = str(settings.value( "/SextanteQGIS/LastInputPath",QtCore.QVariant( "" ) ).toString())
path = str(settings.value( "/SextanteQGIS/LastInputPath",QtCore.QVariant("")).toString())
else:
path = ""

ret = QtGui.QFileDialog.getOpenFileNames(self, "Open file", path, "All files (*.*)")
ret = QtGui.QFileDialog.getOpenFileNames(self, "Open file", path, self.param.getFileFilter())
if ret:
files = list(ret)
if len(files) == 1:
Expand Down
3 changes: 1 addition & 2 deletions python/plugins/sextante/outputs/OutputRaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@
* *
***************************************************************************
"""
from sextante.core.QGisLayers import QGisLayers
from sextante.core.SextanteRasterWriter import SextanteRasterWriter

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

from sextante.core.QGisLayers import QGisLayers
from sextante.outputs.Output import Output
from sextante.core.SextanteUtils import SextanteUtils

Expand Down
9 changes: 8 additions & 1 deletion python/plugins/sextante/parameters/ParameterMultipleInput.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,14 @@ def getAsString(self,value):
return unicode(layer.source())
return s


def getFileFilter(self):
if self.datatype == ParameterMultipleInput.TYPE_RASTER:
exts = QGisLayers.getSupportedOutputRasterLayerExtensions()
else:
exts = QGisLayers.getSupportedOutputVectorLayerExtensions()
for i in range(len(exts)):
exts[i] = exts[i].upper() + " files(*." + exts[i].lower() + ")"
return ";;".join(exts)

def serialize(self):
return self.__module__.split(".")[-1] + "|" + self.name + "|" + self.description +\
Expand Down
6 changes: 6 additions & 0 deletions python/plugins/sextante/parameters/ParameterRaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ def setValue(self, obj):
self.value = unicode(layer.dataProvider().dataSourceUri())
return True
return os.path.exists(self.value)

def getFileFilter(self):
exts = QGisLayers.getSupportedOutputRasterLayerExtensions()
for i in range(len(exts)):
exts[i] = exts[i].upper() + " files(*." + exts[i].lower() + ")"
return ";;".join(exts)

def serialize(self):
return self.__module__.split(".")[-1] + "|" + self.name + "|" + self.description +\
Expand Down
6 changes: 6 additions & 0 deletions python/plugins/sextante/parameters/ParameterTable.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ def getSafeExportedTable(self):
else:
self.exported = self.value
return self.exported

def getFileFilter(self,alg):
exts = ['csv', 'dbf']
for i in range(len(exts)):
exts[i] = exts[i].upper() + " files(*." + exts[i].lower() + ")"
return ";;".join(exts)

def serialize(self):
return self.__module__.split(".")[-1] + "|" + self.name + "|" + self.description +\
Expand Down
6 changes: 6 additions & 0 deletions python/plugins/sextante/parameters/ParameterVector.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ def getSafeExportedLayer(self):
else:
self.exported = self.value
return self.exported

def getFileFilter(self):
exts = QGisLayers.getSupportedOutputVectorLayerExtensions()
for i in range(len(exts)):
exts[i] = exts[i].upper() + " files(*." + exts[i].lower() + ")"
return ";;".join(exts)

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

0 comments on commit d5d2fe5

Please sign in to comment.