Skip to content

Commit

Permalink
[needs-docs][processing] Add tooltips to input types in modeler
Browse files Browse the repository at this point in the history
...to help clarify for users what the different input types mean.

Fixes #17671, which is a result of unclear distinction between
the uses of vector features vs vector layer inputs.

Tagged as needs-docs, as it may help with documentation for 3.0
  • Loading branch information
nyalldawson committed Jan 16, 2018
1 parent 5a7da09 commit 5da28ed
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
1 change: 1 addition & 0 deletions python/plugins/processing/modeler/ModelerDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,7 @@ def fillInputsTree(self):
paramItem.setText(0, paramType)
paramItem.setIcon(0, icon)
paramItem.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsDragEnabled)
paramItem.setToolTip(0, ModelerParameterDefinitionDialog.inputTooltip(paramType))
parametersItem.addChild(paramItem)
self.inputsTree.addTopLevelItem(parametersItem)
parametersItem.setExpanded(True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
QgsProcessingParameterFeatureSource,
QgsProcessingParameterBand)
from qgis.PyQt.QtCore import (Qt,
QByteArray)
QByteArray,
QCoreApplication)
from qgis.PyQt.QtWidgets import (QDialog,
QVBoxLayout,
QLabel,
Expand Down Expand Up @@ -441,3 +442,24 @@ def reject(self):
settings.setValue("/Processing/modelParametersDefinitionDialogGeometry", self.saveGeometry())

QDialog.reject(self)

@staticmethod
def inputTooltip(input_type):
tooltips = {
ModelerParameterDefinitionDialog.PARAMETER_NUMBER: QCoreApplication.translate('Processing', 'A numeric parameter, including float or integer values.'),
ModelerParameterDefinitionDialog.PARAMETER_RASTER: QCoreApplication.translate('Processing', 'A raster layer parameter.'),
ModelerParameterDefinitionDialog.PARAMETER_TABLE: QCoreApplication.translate('Processing', 'A vector layer parameter, e.g. for algorithms which change layer styles, edit layers in place, or other operations which affect an entire layer.'),
ModelerParameterDefinitionDialog.PARAMETER_VECTOR: QCoreApplication.translate('Processing', 'A vector feature parameter, e.g. for algorithms which operate on the features within a layer.'),
ModelerParameterDefinitionDialog.PARAMETER_STRING: QCoreApplication.translate('Processing', 'A freeform string parameter.'),
ModelerParameterDefinitionDialog.PARAMETER_EXPRESSION: QCoreApplication.translate('Processing', 'A QGIS expression parameter, which presents an expression builder widget to users.'),
ModelerParameterDefinitionDialog.PARAMETER_BOOLEAN: QCoreApplication.translate('Processing', 'A boolean parameter, for true/false values.'),
ModelerParameterDefinitionDialog.PARAMETER_TABLE_FIELD: QCoreApplication.translate('Processing', 'A vector field parameter, for selecting an existing field from a vector source.'),
ModelerParameterDefinitionDialog.PARAMETER_EXTENT: QCoreApplication.translate('Processing', 'A map extent parameter.'),
ModelerParameterDefinitionDialog.PARAMETER_FILE: QCoreApplication.translate('Processing', 'A file parameter, for use with non-map layer file sources.'),
ModelerParameterDefinitionDialog.PARAMETER_POINT: QCoreApplication.translate('Processing', 'A geographic point parameter.'),
ModelerParameterDefinitionDialog.PARAMETER_CRS: QCoreApplication.translate('Processing', 'A coordinate reference system (CRS) input parameter.'),
ModelerParameterDefinitionDialog.PARAMETER_MULTIPLE: QCoreApplication.translate('Processing', 'An input allowing selection of multiple sources, including multiple map layers or file sources.'),
ModelerParameterDefinitionDialog.PARAMETER_BAND: QCoreApplication.translate('Processing', 'A raster band parameter, for selecting an existing band from a raster source.'),
ModelerParameterDefinitionDialog.PARAMETER_MAP_LAYER: QCoreApplication.translate('Processing', 'A generic map layer parameter, which accepts either vector or raster layers.')
}
return tooltips[input_type]

0 comments on commit 5da28ed

Please sign in to comment.