Have loaded a CSV layer with a QGIS plugin (so far so good) but cannot add a field to

المشرف العام

Administrator
طاقم الإدارة
I have created my first ever plugin in QGIS 2.10.1 Pisa, and the layer loads fine, but after two days of trying, I cannot get the plugin to also add a field. The following code in the "def run(self):" section doesn't cause any error, but also does not add the field. Can anyone tell me what I'm doing wrong here, please?

filename = self.dlg.lineEdit.text()uri="file:///"+filename+"?"+"delimiter=%s&xField=%s&yField=%s"%("\t", "Set Grid Easting", "Set Grid Northing")vlayer = QgsVectorLayer(uri, "SpreadTests", "delimitedtext")QgsMapLayerRegistry.instance().addMapLayer(vlayer)vpr = vlayer.dataProvider()vpr.addAttributes([QgsField("Testing", QVariant.Double)])vlayer.updateFields()

أكثر...
 
أعلى