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)
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)
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
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))
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
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)