Skip to content

Commit

Permalink
[processing] remove explicit outputs definitions
Browse files Browse the repository at this point in the history
(cherry picked from commit 22fea14)
  • Loading branch information
alexbruy committed Mar 2, 2018
1 parent 511fa36 commit c39e2a4
Show file tree
Hide file tree
Showing 16 changed files with 11 additions and 49 deletions.
5 changes: 2 additions & 3 deletions python/plugins/processing/algs/gdal/gdal2xyz.py
Expand Up @@ -29,8 +29,8 @@
QgsProcessingParameterRasterLayer,
QgsProcessingParameterBand,
QgsProcessingParameterBoolean,
QgsProcessingParameterFileDestination,
QgsProcessingOutputFile)
QgsProcessingParameterFileDestination
)
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
from processing.algs.gdal.GdalUtils import GdalUtils
from processing.tools.system import isWindows
Expand Down Expand Up @@ -58,7 +58,6 @@ def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT,
self.tr('XYZ ASCII file'),
self.tr('CSV files (*.csv)')))
self.addOutput(QgsProcessingOutputFile(self.OUTPUT, self.tr('XYZ ASCII file')))

def name(self):
return 'gdal2xyz'
Expand Down
4 changes: 1 addition & 3 deletions python/plugins/processing/algs/gdal/gdalinfo.py
Expand Up @@ -30,8 +30,7 @@
from qgis.PyQt.QtGui import QIcon
from qgis.core import (QgsProcessingParameterRasterLayer,
QgsProcessingParameterBoolean,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
from processing.algs.gdal.GdalUtils import GdalUtils

Expand Down Expand Up @@ -69,7 +68,6 @@ def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT,
self.tr('Layer information'),
self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Layer information')))

def name(self):
return 'gdalinfo'
Expand Down
4 changes: 1 addition & 3 deletions python/plugins/processing/algs/gdal/ogrinfo.py
Expand Up @@ -28,8 +28,7 @@

from qgis.core import (QgsProcessingParameterVectorLayer,
QgsProcessingParameterBoolean,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
from processing.algs.gdal.GdalUtils import GdalUtils

Expand Down Expand Up @@ -57,7 +56,6 @@ def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT,
self.tr('Layer information'),
self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Layer information')))

def name(self):
return 'ogrinfo'
Expand Down
8 changes: 0 additions & 8 deletions python/plugins/processing/algs/grass7/Grass7Algorithm.py
Expand Up @@ -59,10 +59,6 @@
QgsProcessingParameterFileDestination,
QgsProcessingParameterFile,
QgsProcessingParameterFolderDestination,
QgsProcessingOutputFolder,
QgsProcessingOutputVectorLayer,
QgsProcessingOutputRasterLayer,
QgsProcessingOutputHtml,
QgsProcessingUtils)
from qgis.utils import iface

Expand Down Expand Up @@ -178,10 +174,6 @@ def initAlgorithm(self, config=None):
for p in self.params:
# We use createOutput argument for automatic output creation
res = self.addParameter(p, True)
# File destinations are not automatically added as outputs
if (isinstance(p, QgsProcessingParameterFileDestination)
and p.defaultFileExtension().lower() == 'html'):
self.addOutput(QgsProcessingOutputHtml(p.name(), p.description()))

def defineCharacteristicsFromFile(self):
"""
Expand Down
5 changes: 1 addition & 4 deletions python/plugins/processing/algs/qgis/BarPlot.py
Expand Up @@ -31,8 +31,7 @@

from qgis.core import (QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.tools import vector

Expand Down Expand Up @@ -65,8 +64,6 @@ def initAlgorithm(self, config=None):

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Bar plot'), self.tr('HTML files (*.html)')))

self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Bar plot')))

def name(self):
return 'barplot'

Expand Down
2 changes: 0 additions & 2 deletions python/plugins/processing/algs/qgis/BasicStatistics.py
Expand Up @@ -38,7 +38,6 @@
QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml,
QgsProcessingOutputNumber)

from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
Expand Down Expand Up @@ -98,7 +97,6 @@ def initAlgorithm(self, config=None):
None, self.INPUT_LAYER, QgsProcessingParameterField.Any))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT_HTML_FILE, self.tr('Statistics'), self.tr('HTML files (*.html)'), None, True))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT_HTML_FILE, self.tr('Statistics')))

self.addOutput(QgsProcessingOutputNumber(self.COUNT, self.tr('Count')))
self.addOutput(QgsProcessingOutputNumber(self.UNIQUE, self.tr('Number of unique values')))
Expand Down
2 changes: 0 additions & 2 deletions python/plugins/processing/algs/qgis/BoxPlot.py
Expand Up @@ -32,7 +32,6 @@
QgsProcessingParameterField,
QgsProcessingParameterEnum,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml,
QgsFeatureRequest)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.tools import vector
Expand Down Expand Up @@ -76,7 +75,6 @@ def initAlgorithm(self, config=None):
options=msd, defaultValue=0))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Box plot'), self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Box plot')))

def name(self):
return 'boxplot'
Expand Down
4 changes: 1 addition & 3 deletions python/plugins/processing/algs/qgis/MeanAndStdDevPlot.py
Expand Up @@ -31,8 +31,7 @@
from qgis.core import (QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingUtils,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm

from processing.tools import vector
Expand Down Expand Up @@ -64,7 +63,6 @@ def initAlgorithm(self, config=None):
self.tr('Value field'), parentLayerParameterName=self.INPUT))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Plot'), self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Plot')))

def name(self):
return 'meanandstandarddeviationplot'
Expand Down
Expand Up @@ -37,7 +37,6 @@
QgsProcessing,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml,
QgsProcessingOutputNumber,
QgsSpatialIndex)

Expand Down Expand Up @@ -73,7 +72,6 @@ def initAlgorithm(self, config=None):
self.tr('Input layer'), [QgsProcessing.TypeVectorPoint]))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT_HTML_FILE, self.tr('Nearest neighbour'), self.tr('HTML files (*.html)'), None, True))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT_HTML_FILE, self.tr('Nearest neighbour')))

self.addOutput(QgsProcessingOutputNumber(self.OBSERVED_MD,
self.tr('Observed mean distance')))
Expand Down
4 changes: 1 addition & 3 deletions python/plugins/processing/algs/qgis/PolarPlot.py
Expand Up @@ -31,8 +31,7 @@

from qgis.core import (QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.tools import vector

Expand Down Expand Up @@ -62,7 +61,6 @@ def initAlgorithm(self, config=None):
self.tr('Value field'), parentLayerParameterName=self.INPUT))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Polar plot'), self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Polar plot')))

def name(self):
return 'polarplot'
Expand Down
4 changes: 1 addition & 3 deletions python/plugins/processing/algs/qgis/RasterLayerHistogram.py
Expand Up @@ -31,8 +31,7 @@
from qgis.core import (QgsProcessingParameterRasterLayer,
QgsProcessingParameterBand,
QgsProcessingParameterNumber,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.tools import raster

Expand Down Expand Up @@ -64,7 +63,6 @@ def initAlgorithm(self, config=None):
self.tr('number of bins'), minValue=2, defaultValue=10))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Histogram'), self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Histogram')))

def name(self):
return 'rasterlayerhistogram'
Expand Down
2 changes: 0 additions & 2 deletions python/plugins/processing/algs/qgis/RasterLayerStatistics.py
Expand Up @@ -32,7 +32,6 @@
QgsProcessingParameterRasterLayer,
QgsProcessingParameterBand,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml,
QgsProcessingOutputNumber)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm

Expand Down Expand Up @@ -68,7 +67,6 @@ def initAlgorithm(self, config=None):
1,
self.INPUT))
self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT_HTML_FILE, self.tr('Statistics'), self.tr('HTML files (*.html)'), None, True))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT_HTML_FILE, self.tr('Statistics')))

self.addOutput(QgsProcessingOutputNumber(self.MIN, self.tr('Minimum value')))
self.addOutput(QgsProcessingOutputNumber(self.MAX, self.tr('Maximum value')))
Expand Down
4 changes: 1 addition & 3 deletions python/plugins/processing/algs/qgis/UniqueValues.py
Expand Up @@ -42,8 +42,7 @@
QgsProcessingParameterFeatureSink,
QgsProcessingOutputNumber,
QgsProcessingOutputString,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)

from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm

Expand Down Expand Up @@ -81,7 +80,6 @@ def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSink(self.OUTPUT, self.tr('Unique values'), optional=True, defaultValue=''))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT_HTML_FILE, self.tr('HTML report'), self.tr('HTML files (*.html)'), None, True))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT_HTML_FILE, self.tr('HTML report')))
self.addOutput(QgsProcessingOutputNumber(self.TOTAL_VALUES, self.tr('Total unique values')))
self.addOutput(QgsProcessingOutputString(self.UNIQUE_VALUES, self.tr('Unique values')))

Expand Down
4 changes: 1 addition & 3 deletions python/plugins/processing/algs/qgis/VectorLayerHistogram.py
Expand Up @@ -31,8 +31,7 @@
from qgis.core import (QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterNumber,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.tools import vector

Expand Down Expand Up @@ -63,7 +62,6 @@ def initAlgorithm(self, config=None):
self.tr('number of bins'), minValue=2, defaultValue=10))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Histogram'), self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Histogram')))

def name(self):
return 'vectorlayerhistogram'
Expand Down
Expand Up @@ -31,8 +31,7 @@
from qgis.core import (QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingUtils,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml)
QgsProcessingParameterFileDestination)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm
from processing.tools import vector

Expand Down Expand Up @@ -66,7 +65,6 @@ def initAlgorithm(self, config=None):
type=QgsProcessingParameterField.Numeric))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Scatterplot'), self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Scatterplot')))

def name(self):
return 'vectorlayerscatterplot'
Expand Down
Expand Up @@ -31,7 +31,6 @@
from qgis.core import (QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterFileDestination,
QgsProcessingOutputHtml,
QgsProcessingUtils)
from processing.algs.qgis.QgisAlgorithm import QgisAlgorithm

Expand Down Expand Up @@ -72,7 +71,6 @@ def initAlgorithm(self, config=None):
type=QgsProcessingParameterField.Numeric))

self.addParameter(QgsProcessingParameterFileDestination(self.OUTPUT, self.tr('Histogram'), self.tr('HTML files (*.html)')))
self.addOutput(QgsProcessingOutputHtml(self.OUTPUT, self.tr('Histogram')))

def name(self):
return 'scatter3dplot'
Expand Down

0 comments on commit c39e2a4

Please sign in to comment.