def importMetadataFromFile(self, layers, explorer): fileName = QtGui.QFileDialog.getOpenFileName(config.iface.mainWindow(), "Select metadata file", "", 'XML files (*.xml);;Text files (*.txt *.TXT);;All files (*.*)' ) if fileName: try: for layer in layers: md = MetadataProvider.getProvider(layer) md.importFromFile(unicode(fileName)) explorer.setInfo("Metadata was imported successfully") except Exception, e: explorer.setWarning("Metadata can't be imported: " + e.args[0])
def editMetadata(self, tree, explorer): try: md = MetadataProvider.getProvider(self.element) except Exception, e: explorer.setWarning(unicode(e.args[0])) return