Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] allow multiple selection of tables
  • Loading branch information
volaya committed Dec 5, 2016
1 parent 57d80a5 commit 16da906
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions python/plugins/processing/algs/qgis/Datasources2Vrt.py
Expand Up @@ -32,6 +32,7 @@

from osgeo import ogr

from processing.tools import dataobjects
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.core.parameters import ParameterMultipleInput
Expand All @@ -52,7 +53,8 @@ def defineCharacteristics(self):
self.group, self.i18n_group = self.trAlgorithm('Vector general tools')

self.addParameter(ParameterMultipleInput(self.DATASOURCES,
self.tr('Input datasources')))
self.tr('Input datasources'),
dataobjects.TYPE_TABLE))
self.addParameter(ParameterBoolean(self.UNIONED,
self.tr('Create "unioned" VRT'),
default=False))
Expand All @@ -66,7 +68,6 @@ def processAlgorithm(self, progress):
input_layers = self.getParameterValue(self.DATASOURCES)
unioned = self.getParameterValue(self.UNIONED)
vrtPath = self.getOutputValue(self.VRT_FILE)
vrtString = self.getOutputValue(self.VRT_STRING)

layers = input_layers.split(';')

Expand Down
8 changes: 8 additions & 0 deletions python/plugins/processing/gui/wrappers.py
Expand Up @@ -461,6 +461,8 @@ def _getOptions(self):
[dataobjects.TYPE_VECTOR_POLYGON, dataobjects.TYPE_VECTOR_ANY])
elif self.param.datatype == dataobjects.TYPE_RASTER:
options = self.dialog.getAvailableValuesOfType(ParameterRaster, OutputRaster)
elif self.param.datatype == dataobjects.TYPE_TABLE:
options = self.dialog.getAvailableValuesOfType(ParameterTable, OutputTable)
else:
options = self.dialog.getAvailableValuesOfType(ParameterFile, OutputFile)
options = sorted(options, key=lambda opt: self.dialog.resolveValueDescription(opt))
Expand All @@ -475,6 +477,8 @@ def createWidget(self):
options = dataobjects.getRasterLayers(sorting=False)
elif self.param.datatype == dataobjects.TYPE_VECTOR_ANY:
options = dataobjects.getVectorLayers(sorting=False)
elif self.param.datatype == dataobjects.TYPE_TABLE:
options = dataobjects.getTables(sorting=False)
else:
options = dataobjects.getVectorLayers([self.param.datatype], sorting=False)
opts = [getExtendedLayerName(opt) for opt in options]
Expand All @@ -493,6 +497,8 @@ def refresh(self):
options = dataobjects.getRasterLayers(sorting=False)
elif self.param.datatype == dataobjects.TYPE_VECTOR_ANY:
options = dataobjects.getVectorLayers(sorting=False)
elif self.param.datatype == dataobjects.TYPE_TABLE:
options = dataobjects.getTables(sorting=False)
else:
options = dataobjects.getVectorLayers([self.param.datatype], sorting=False)
opts = [self.getExtendedLayerName(opt) for opt in options]
Expand Down Expand Up @@ -520,6 +526,8 @@ def value(self):
options = dataobjects.getRasterLayers(sorting=False)
elif self.param.datatype == dataobjects.TYPE_VECTOR_ANY:
options = dataobjects.getVectorLayers(sorting=False)
elif self.param.datatype == dataobjects.TYPE_TABLE:
options = dataobjects.getTables(sorting=False)
else:
options = dataobjects.getVectorLayers([self.param.datatype], sorting=False)
return [options[i] for i in self.widget.selectedoptions]
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/tools/dataobjects.py
Expand Up @@ -58,7 +58,7 @@
TYPE_VECTOR_POLYGON = 2
TYPE_RASTER = 3
TYPE_FILE = 4

TYPE_TABLE = 5

_loadedLayers = {}

Expand Down

0 comments on commit 16da906

Please sign in to comment.