示例#1
0
 def runAlgorithm(self):
     alg = RAlgorithm(None, unicode(self.text.text()))
     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)
示例#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)
示例#3
0
 def editHelp(self):
     if self.alg is None:
         alg = RAlgorithm(None, unicode(self.text.text()))
     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
示例#4
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:
                 ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,e.msg)
             except Exception, e:
                 ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,"Could not load R script:" + descriptionFile + "\n" + str(e))
示例#5
0
    def editHelp(self):
        if self.alg is None:
            if self.algType == self.SCRIPT_PYTHON:
                alg = ScriptAlgorithm(None, unicode(self.editor.toPlainText()))
            elif self.algType == self.SCRIPT_R:
                alg = RAlgorithm(None, unicode(self.editor.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
示例#6
0
    def runAlgorithm(self):
        if self.algType == self.SCRIPT_PYTHON:
            alg = ScriptAlgorithm(None, unicode(self.editor.text()))
            alg.provider = Providers.providers['script']
        if self.algType == self.SCRIPT_R:
            alg = RAlgorithm(None, unicode(self.editor.text()))
            alg.provider = Providers.providers['r']

        dlg = alg.getCustomParametersDialog()
        if not dlg:
            dlg = ParametersDialog(alg)

        canvas = interface.iface.mapCanvas()
        prevMapTool = canvas.mapTool()

        dlg.show()
        dlg.exec_()

        if canvas.mapTool() != prevMapTool:
            try:
                canvas.mapTool().reset()
            except:
                pass
            canvas.setMapTool(prevMapTool)