Disable some more algs

This commit is contained in:
Alessandro Pasotti 2018-09-13 17:01:26 +02:00 committed by Nyall Dawson
parent e01449f5c5
commit 0626a0ff5d
6 changed files with 15 additions and 11 deletions

View File

@ -79,6 +79,9 @@ class FieldsMapper(QgisFeatureBasedAlgorithm):
def parameterAsFieldsMapping(self, parameters, name, context):
return parameters[name]
def supportInPlaceEdit(self, layer):
return False
def prepareAlgorithm(self, parameters, context, feedback):
source = self.parameterAsSource(parameters, 'INPUT', context)
if source is None:

View File

@ -77,6 +77,9 @@ class TextToFloat(QgisFeatureBasedAlgorithm):
self.field_name = self.parameterAsString(parameters, self.FIELD, context)
return True
def supportInPlaceEdit(self, layer):
return False
def sourceFlags(self):
return QgsProcessingFeatureSource.FlagSkipGeometryValidityChecks

View File

@ -143,14 +143,7 @@ class InPlaceAlgorithmLocatorFilter(QgsLocatorFilter):
if not a.flags() & QgsProcessingAlgorithm.FlagSupportsInPlaceEdits:
continue
if a.inputLayerTypes() and \
QgsProcessing.TypeVector not in a.inputLayerTypes() \
and QgsProcessing.TypeVectorAnyGeometry not in a.inputLayerTypes() \
and (QgsWkbTypes.geometryType(iface.activeLayer().wkbType()) == QgsWkbTypes.PolygonGeometry and QgsProcessing.TypeVectorPolygon not in a.inputLayerTypes() or
QgsWkbTypes.geometryType(
iface.activeLayer().wkbType()) == QgsWkbTypes.LineGeometry and QgsProcessing.TypeVectorLine not in a.inputLayerTypes() or
QgsWkbTypes.geometryType(
iface.activeLayer().wkbType()) == QgsWkbTypes.PointGeometry and QgsProcessing.TypeVectorPoint not in a.inputLayerTypes()):
if not a.supportInPlaceEdit(iface.activeLayer()):
continue
if QgsLocatorFilter.stringMatches(a.displayName(), string) or [t for t in a.tags() if QgsLocatorFilter.stringMatches(t, string)] or \

View File

@ -229,8 +229,7 @@ class ProcessingToolbox(QgsDockWidget, WIDGET):
dlg.exec_()
return
if self.in_place_mode and len(alg.parameterDefinitions()) <= 2:
# hack
if self.in_place_mode and not [d for d in alg.parameterDefinitions() if d.name() not in ('INPUT', 'OUTPUT')]:
parameters = {}
execute_in_place(alg, parameters)
return

View File

@ -162,4 +162,10 @@ QgsFeatureList QgsAddIncrementalFieldAlgorithm::processFeature( const QgsFeature
return QgsFeatureList() << f;
}
bool QgsAddIncrementalFieldAlgorithm::supportInPlaceEdit( const QgsVectorLayer *layer ) const
{
Q_UNUSED( layer );
return false;
}
///@endcond

View File

@ -53,6 +53,7 @@ class QgsAddIncrementalFieldAlgorithm : public QgsProcessingFeatureBasedAlgorith
bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
QgsFeatureRequest request() const override;
QgsFeatureList processFeature( const QgsFeature &feature, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
bool supportInPlaceEdit( const QgsVectorLayer *layer ) const override;
private:
@ -68,7 +69,6 @@ class QgsAddIncrementalFieldAlgorithm : public QgsProcessingFeatureBasedAlgorith
bool mSortAscending = true;
bool mSortNullsFirst = false;
};
///@endcond PRIVATE