我正在尝试创建一个qpy插件,但是我收到了一个错误。我添加的代码部分如下所示。
def run(self):
"""Run method that performs all the real work"""
# show the dialog
self.dlg.show()
layers=self.iface.legendInterface().layers()
layer_list=[]
for layer in layers:
layer_list.append(layer.name())
self.dlg.comboBox.addItems(layer_list)
# Run the dialog event loop
result = self.dlg.exec_()
# See if OK was pressed
if result==1:
# Do something useful here - delete the line containing pass and
index=self.dlg.comboBox.currentIndex()
layer=self.dlg.comboBox.itemData(index)
QMessageBox.information(self.iface.mainWindow(),"Hello world","%s has %d features."%(layer.name(),layer.featureCount()))
错误: