Add commit changes

This commit is contained in:
Alireza Adli 2024-08-07 15:44:38 -04:00
parent 8ce3be96c2
commit f67b461c43

View File

@ -161,6 +161,7 @@ class ScrubLayer:
with edit(self.layer): with edit(self.layer):
for feature in self.layer.getFeatures(request): for feature in self.layer.getFeatures(request):
self.layer.deleteFeature(feature.id()) self.layer.deleteFeature(feature.id())
self.layer.commitChanges()
def add_field(self, new_field_name): def add_field(self, new_field_name):
functionalities = self.layer.dataProvider().capabilities() functionalities = self.layer.dataProvider().capabilities()
@ -175,7 +176,8 @@ class ScrubLayer:
idx = self.layer.fields().indexFromName(field_name) idx = self.layer.fields().indexFromName(field_name)
context = QgsExpressionContext() context = QgsExpressionContext()
context.appendScopes(QgsExpressionContextUtils.globalProjectLayerScopes(self.layer)) context.appendScopes(
QgsExpressionContextUtils.globalProjectLayerScopes(self.layer))
for feature in self.layer.getFeatures(): for feature in self.layer.getFeatures():
area = feature.geometry().area() area = feature.geometry().area()