Skip to content

Commit 16da906

Browse files
committed
[processing] allow multiple selection of tables
1 parent 57d80a5 commit 16da906

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

python/plugins/processing/algs/qgis/Datasources2Vrt.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
from osgeo import ogr
3434

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

5455
self.addParameter(ParameterMultipleInput(self.DATASOURCES,
55-
self.tr('Input datasources')))
56+
self.tr('Input datasources'),
57+
dataobjects.TYPE_TABLE))
5658
self.addParameter(ParameterBoolean(self.UNIONED,
5759
self.tr('Create "unioned" VRT'),
5860
default=False))
@@ -66,7 +68,6 @@ def processAlgorithm(self, progress):
6668
input_layers = self.getParameterValue(self.DATASOURCES)
6769
unioned = self.getParameterValue(self.UNIONED)
6870
vrtPath = self.getOutputValue(self.VRT_FILE)
69-
vrtString = self.getOutputValue(self.VRT_STRING)
7071

7172
layers = input_layers.split(';')
7273

python/plugins/processing/gui/wrappers.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,8 @@ def _getOptions(self):
461461
[dataobjects.TYPE_VECTOR_POLYGON, dataobjects.TYPE_VECTOR_ANY])
462462
elif self.param.datatype == dataobjects.TYPE_RASTER:
463463
options = self.dialog.getAvailableValuesOfType(ParameterRaster, OutputRaster)
464+
elif self.param.datatype == dataobjects.TYPE_TABLE:
465+
options = self.dialog.getAvailableValuesOfType(ParameterTable, OutputTable)
464466
else:
465467
options = self.dialog.getAvailableValuesOfType(ParameterFile, OutputFile)
466468
options = sorted(options, key=lambda opt: self.dialog.resolveValueDescription(opt))
@@ -475,6 +477,8 @@ def createWidget(self):
475477
options = dataobjects.getRasterLayers(sorting=False)
476478
elif self.param.datatype == dataobjects.TYPE_VECTOR_ANY:
477479
options = dataobjects.getVectorLayers(sorting=False)
480+
elif self.param.datatype == dataobjects.TYPE_TABLE:
481+
options = dataobjects.getTables(sorting=False)
478482
else:
479483
options = dataobjects.getVectorLayers([self.param.datatype], sorting=False)
480484
opts = [getExtendedLayerName(opt) for opt in options]
@@ -493,6 +497,8 @@ def refresh(self):
493497
options = dataobjects.getRasterLayers(sorting=False)
494498
elif self.param.datatype == dataobjects.TYPE_VECTOR_ANY:
495499
options = dataobjects.getVectorLayers(sorting=False)
500+
elif self.param.datatype == dataobjects.TYPE_TABLE:
501+
options = dataobjects.getTables(sorting=False)
496502
else:
497503
options = dataobjects.getVectorLayers([self.param.datatype], sorting=False)
498504
opts = [self.getExtendedLayerName(opt) for opt in options]
@@ -520,6 +526,8 @@ def value(self):
520526
options = dataobjects.getRasterLayers(sorting=False)
521527
elif self.param.datatype == dataobjects.TYPE_VECTOR_ANY:
522528
options = dataobjects.getVectorLayers(sorting=False)
529+
elif self.param.datatype == dataobjects.TYPE_TABLE:
530+
options = dataobjects.getTables(sorting=False)
523531
else:
524532
options = dataobjects.getVectorLayers([self.param.datatype], sorting=False)
525533
return [options[i] for i in self.widget.selectedoptions]

python/plugins/processing/tools/dataobjects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
TYPE_VECTOR_POLYGON = 2
5959
TYPE_RASTER = 3
6060
TYPE_FILE = 4
61-
61+
TYPE_TABLE = 5
6262

6363
_loadedLayers = {}
6464

0 commit comments

Comments
 (0)