Esempio n. 1
0
    def _loadAlgorithms(self):
        self.algs = []

        version = OTBUtils.getInstalledVersion(True)
        if version is None:
            ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
                                   self.tr('Problem with OTB installation: OTB was not found or is not correctly installed'))
            return

        folder = OTBUtils.compatibleDescriptionPath(version)
        if folder is None:
            ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
                                   self.tr('Problem with OTB installation: installed OTB version (%s) is not supported' % version))
            return

        for descriptionFile in os.listdir(folder):
            if descriptionFile.endswith("xml"):
                try:
                    alg = OTBAlgorithm(os.path.join(folder, descriptionFile))

                    if alg.name.strip() != "":
                        self.algs.append(alg)
                    else:
                        ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
                                               self.tr("Could not open OTB algorithm: %s" % descriptionFile))
                except Exception as e:
                    ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
                                           self.tr("Could not open OTB algorithm: %s" % descriptionFile))
Esempio n. 2
0
 def help(self):
     version = OTBUtils.getInstalledVersion()
     folder = OTBUtils.compatibleDescriptionPath(version)
     if folder is None:
         return False, None
     folder = os.path.join(folder, 'doc')
     helpfile = os.path.join(unicode(folder), self.appkey + ".html")
     if os.path.exists(helpfile):
         return False, helpfile
     else:
         return False, None