Skip to content
Permalink
Browse files

[sextante] added file filters to input boxes in batch processing dialog

  • Loading branch information
volaya committed Mar 23, 2013
1 parent d0e5ce7 commit d5d2fe56b99c7418a8e80e19a03bb0add7c7fc93
@@ -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:
@@ -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

@@ -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 +\
@@ -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 +\
@@ -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 +\
@@ -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 +\

0 comments on commit d5d2fe5

Please sign in to comment.
You can’t perform that action at this time.