def doView(self): try: from metatoolsviewer import MetatoolsViewer except: QMessageBox.critical(self.iface.mainWindow(), QCoreApplication.translate("Metatools", "Metatools"), QCoreApplication.translate("Metatools", "Viewer can't be loaded: %s %s!") % (unicode(sys.exc_info()[0]), unicode(sys.exc_info()[1])) ) return # check metadata exists if not self.checkMetadata(): return # check matadata standard standard = MetaInfoStandard.tryDetermineStandard(self.metaProvider) if standard != MetaInfoStandard.ISO19115 and standard != MetaInfoStandard.FGDC: QMessageBox.critical(self.iface.mainWindow(), QCoreApplication.translate("Metatools", "Metatools"), QCoreApplication.translate("Metatools", "Unsupported metadata standard! Only ISO19115 and FGDC supported now!") ) return # TODO: validate metadata file # get xsl file path settings = QSettings("NextGIS", "metatools") if standard == MetaInfoStandard.ISO19115: xsltFilePath = os.path.join(self.pluginPath, "xsl/") + settings.value("iso19115/stylesheet", "iso19115.xsl") if standard == MetaInfoStandard.FGDC: xsltFilePath = os.path.join(self.pluginPath, "xsl/") + settings.value("fgdc/stylesheet", "fgdc.xsl") dlg = MetatoolsViewer() if dlg.setContent(self.metaProvider, xsltFilePath): dlg.exec_()