Ejemplo n.º 1
0
 def runAlgorithm(self):
     alg = RAlgorithm(None, unicode(self.text.toPlainText()))
     alg.provider = Providers.providers['r']
     dlg = alg.getCustomParametersDialog()
     if not dlg:
         dlg = ParametersDialog(alg)
     canvas = QGisLayers.iface.mapCanvas()
     prevMapTool = canvas.mapTool()
     dlg.show()
     dlg.exec_()
     if canvas.mapTool()!=prevMapTool:
         try:
             canvas.mapTool().reset()
         except:
             pass
         canvas.setMapTool(prevMapTool)
Ejemplo n.º 2
0
 def runAlgorithm(self):
     alg = RAlgorithm(None, unicode(self.text.toPlainText()))
     alg.provider = Providers.providers['r']
     dlg = alg.getCustomParametersDialog()
     if not dlg:
         dlg = ParametersDialog(alg)
     canvas = QGisLayers.iface.mapCanvas()
     prevMapTool = canvas.mapTool()
     dlg.show()
     dlg.exec_()
     if canvas.mapTool()!=prevMapTool:
         try:
             canvas.mapTool().reset()
         except:
             pass
         canvas.setMapTool(prevMapTool)
Ejemplo n.º 3
0
 def editHelp(self):
     if self.alg is None:
         alg = RAlgorithm(None, unicode(self.text.toPlainText()))
     else:
         alg = self.alg
     dlg = HelpEditionDialog(alg)
     dlg.exec_()
     #We store the description string in case there were not saved because there was no
     #filename defined yet
     if self.alg is None and dlg.descriptions:
         self.help = dlg.descriptions
Ejemplo n.º 4
0
 def _loadAlgorithms(self):
     folder = RUtils.RScriptsFolder()
     for descriptionFile in os.listdir(folder):
         if descriptionFile.endswith("rsx"):
             try:
                 fullpath = os.path.join(RUtils.RScriptsFolder(), descriptionFile)
                 alg = RAlgorithm(fullpath)
                 if alg.name.strip() != "":
                     self.algs.append(alg)
             except WrongScriptException,e:
                 SextanteLog.addToLog(SextanteLog.LOG_ERROR,e.msg)
             except Exception, e:
                 SextanteLog.addToLog(SextanteLog.LOG_ERROR,"Could not load R script:" + descriptionFile)
Ejemplo n.º 5
0
 def loadFromFolder(self, folder):
     if not os.path.exists(folder):
         return
     for descriptionFile in os.listdir(folder):
         if descriptionFile.endswith("rsx"):
             try:
                 fullpath = os.path.join(folder, descriptionFile)
                 alg = RAlgorithm(fullpath)
                 if alg.name.strip() != "":
                     self.algs.append(alg)
             except WrongScriptException, e:
                 SextanteLog.addToLog(SextanteLog.LOG_ERROR, e.msg)
             except Exception, e:
                 SextanteLog.addToLog(
                     SextanteLog.LOG_ERROR, "Could not load R script:" +
                     descriptionFile + "\n" + str(e))