@staticmethod def handleAlgorithmResults(alg, progress, showResults = True): htmlResults = False; progress.setText("Loading resulting layers") i = 0 for out in alg.outputs: progress.setPercentage(100 * i / float(len(alg.outputs))) if out.hidden or not out.open: continue if isinstance(out, (OutputRaster, OutputVector, OutputTable)): try: if out.value.startswith("memory:"): layer = out.memoryLayer QgsMapLayerRegistry.instance().addMapLayers([layer]) else: if SextanteConfig.getSetting(SextanteConfig.USE_FILENAME_AS_LAYER_NAME): name = os.path.basename(out.value) else: name = out.description QGisLayers.load(out.value, name, alg.crs, RenderingStyles.getStyle(alg.commandLineName(),out.name)) except Exception, e: QMessageBox.critical(None, "Error", str(e)) elif isinstance(out, OutputHTML): SextanteResults.addResult(out.description, out.value) htmlResults = True i += 1 if showResults and htmlResults: QApplication.restoreOverrideCursor() dlg = ResultsDialog() dlg.exec_()
def openResults(self): dlg = ResultsDialog() dlg.exec_()
@staticmethod def handleAlgorithmResults(alg, showResults=True): htmlResults = False for out in alg.outputs: if out.hidden or not out.open: continue if isinstance(out, (OutputRaster, OutputVector, OutputTable)): try: if out.value.startswith("memory:"): layer = out.memoryLayer QgsMapLayerRegistry.instance().addMapLayer(layer) else: if SextanteConfig.getSetting( SextanteConfig.USE_FILENAME_AS_LAYER_NAME): name = os.path.basename(out.value) else: name = out.description QGisLayers.load( out.value, name, alg.crs, RenderingStyles.getStyle(alg.commandLineName(), out.name)) except Exception, e: QMessageBox.critical(None, "Error", str(e)) elif isinstance(out, OutputHTML): SextanteResults.addResult(out.description, out.value) htmlResults = True if showResults and htmlResults: QApplication.restoreOverrideCursor() dlg = ResultsDialog() dlg.exec_()
try: if out.value.startswith("memory:"): layer = out.memoryLayer QgsMapLayerRegistry.instance().addMapLayers([layer]) else: if SextanteConfig.getSetting( SextanteConfig.USE_FILENAME_AS_LAYER_NAME): name = os.path.basename(out.value) else: name = out.description QGisLayers.load( out.value, name, alg.crs, RenderingStyles.getStyle(alg.commandLineName(), out.name)) except Exception, e: wrongLayers.append(out) #QMessageBox.critical(None, "Error", str(e)) elif isinstance(out, OutputHTML): SextanteResults.addResult(out.description, out.value) htmlResults = True i += 1 if wrongLayers: QApplication.restoreOverrideCursor() dlg = CouldNotLoadResultsDialog(wrongLayers, alg) dlg.exec_() if showResults and htmlResults and not wrongLayers: QApplication.restoreOverrideCursor() dlg = ResultsDialog() dlg.exec_()