Example #1
0
 def processAlgorithm(self, progress):
     if isWindows():
         path = RUtils.RFolder()
         if path == '':
             raise GeoAlgorithmExecutionException(
                 self.tr('R folder is not configured.\nPlease configure it '
                         'before running R scripts.'))
     loglines = []
     loglines.append(self.tr('R execution commands'))
     loglines += self.getFullSetOfRCommands()
     for line in loglines:
         progress.setCommand(line)
     ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)
     RUtils.executeRAlgorithm(self, progress)
     if self.showPlots:
         htmlfilename = self.getOutputValue(RAlgorithm.RPLOTS)
         f = open(htmlfilename, 'w')
         f.write('<html><img src="' + self.plotsFilename + '"/></html>')
         f.close()
     if self.showConsoleOutput:
         htmlfilename = self.getOutputValue(RAlgorithm.R_CONSOLE_OUTPUT)
         f = open(htmlfilename, 'w')
         f.write(RUtils.getConsoleOutput())
         f.close()