A work-in-progress plugin's dialog window contains a rolodex which allows the user to cycle through a timeseries of data; updating the relative memory layers geometries with each new time selection.
The script below is called upon when cycling to a new time selection. Even though it updates the layer's geometry without problems, the layer's attribute table (if open) is updated with 'ERROR' for all of the reloaded field values. If the table is closed and reopened after each successive timeseries change, the field value updates are successful.
Is there a means of auto-updating a memory layers constantly opened attribute table based on user interaction?
updates = []
trackLayer.startEditing()
for groupIdx, group in enumerate(newPathGroups):
for pathIdx,path in enumerate(group):
feature = QgsFeature()
feature.setGeometry(QgsGeometry.fromPolyline(path))
feature.setAttributes([self.groupNames[groupIdx][0],str(groupIdx+1),\
trackingRange, feature.geometry().length()])
trackProvider.addFeatures([feature])
trackLayer.commitChanges()
trackLayer.reload()
trackLayer.updateFields()
UPDATE:
Is there possibly a inverse of the following function, allowing a checksum to see if existing table is open, and if so - remove and reload?
Although I would much rather possibly access an existing open attribute table model, and refresh the data source if possible...