• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python SextanteConfig.SextanteConfig类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sextante.core.SextanteConfig.SextanteConfig的典型用法代码示例。如果您正苦于以下问题:Python SextanteConfig类的具体用法?Python SextanteConfig怎么用?Python SextanteConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了SextanteConfig类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: fillTree

    def fillTree(self):
        useCategories = SextanteConfig.getSetting(SextanteConfig.USE_CATEGORIES)
        if useCategories:
            self.fillTreeUsingCategories()
        else:
            self.fillTreeUsingProviders()

        self.algorithmTree.sortItems(0, Qt.AscendingOrder)

        showRecent = SextanteConfig.getSetting(SextanteConfig.SHOW_RECENT_ALGORITHMS)
        if showRecent:
            recent = SextanteLog.getRecentAlgorithms()
            if len(recent) != 0:
                found = False
                recentItem = QTreeWidgetItem()
                recentItem.setText(0, self.tr("Recently used algorithms"))
                for algname in recent:
                    alg = Sextante.getAlgorithm(algname)
                    if alg is not None:
                        algItem = TreeAlgorithmItem(alg)
                        recentItem.addChild(algItem)
                        found = True
                if found:
                    self.algorithmTree.insertTopLevelItem(0, recentItem)
                    recentItem.setExpanded(True)

            self.algorithmTree.setWordWrap(True)
开发者ID:Nald,项目名称:Quantum-GIS,代码行数:27,代码来源:SextanteToolbox.py


示例2: initializeSettings

 def initializeSettings(self):
     '''this is the place where you should add config parameters to SEXTANTE using the SextanteConfig class.
     this method is called when a provider is added to SEXTANTE.
     By default it just adds a setting to activate or deactivate algorithms from the provider'''
     SextanteConfig.settingIcons[self.getDescription()] = self.getIcon()
     name = "ACTIVATE_" + self.getName().upper().replace(" ", "_")
     SextanteConfig.addSetting(Setting(self.getDescription(), name, "Activate", self.activate))
开发者ID:sawajid,项目名称:Quantum-GIS,代码行数:7,代码来源:AlgorithmProvider.py


示例3: initializeSettings

 def initializeSettings(self):
     '''In this method we add settings needed to configure our provider.
     Do not forget to call the parent method, since it takes care or
     automatically adding a setting for activating or deactivating the
     algorithms in the provider'''
     AlgorithmProvider.initializeSettings(self)
     SextanteConfig.addSetting(Setting("Example algorithms", ExampleAlgorithmProvider.MY_DUMMY_SETTING, "Example setting", "Default value"))
     '''To get the parameter of a setting parameter, use SextanteConfig.getSetting(name_of_parameter)'''
开发者ID:carsonfarmer,项目名称:Quantum-GIS,代码行数:8,代码来源:ExampleAlgorithmProvider.py


示例4: unload

 def unload(self):
     AlgorithmProvider.unload(self)
     if SextanteUtils.isWindows() or SextanteUtils.isMac():
         SextanteConfig.removeSetting(GrassUtils.GRASS_FOLDER)
         SextanteConfig.removeSetting(GrassUtils.GRASS_WIN_SHELL)
     SextanteConfig.removeSetting(GrassUtils.GRASS_HELP_FOLDER)
     SextanteConfig.removeSetting(GrassUtils.GRASS_LOG_COMMANDS)
     SextanteConfig.removeSetting(GrassUtils.GRASS_LOG_CONSOLE)
开发者ID:Nald,项目名称:Quantum-GIS,代码行数:8,代码来源:GrassAlgorithmProvider.py


示例5: initializeSettings

 def initializeSettings(self):
     AlgorithmProvider.initializeSettings(self)
     if SextanteUtils.isWindows() or SextanteUtils.isMac():
         SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_FOLDER, "GRASS folder", GrassUtils.grassPath()))
         SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_WIN_SHELL, "Msys folder", GrassUtils.grassWinShell()))
     SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_LOG_COMMANDS, "Log execution commands", False))
     SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_LOG_CONSOLE, "Log console output", False))
     SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_HELP_FOLDER, "GRASS help folder", GrassUtils.grassHelpPath()))
开发者ID:Nald,项目名称:Quantum-GIS,代码行数:8,代码来源:GrassAlgorithmProvider.py


示例6: setUp

 def setUp(self):
     SextanteConfig.setSettingValue(SextanteConfig.USE_THREADS, self.threaded)
     print
     print bcolors.INFO, self.msg, bcolors.ENDC,
     print "Parameters: ", self.alg.parameters,
     print "Outputs: ", [out for out in self.alg.outputs if not out.hidden],
     self.args = list(self.gen_test_parameters(self.alg, True))
     print ' => ', self.args, bcolors.WARNING,
开发者ID:Adam-Brown,项目名称:Quantum-GIS,代码行数:8,代码来源:test.py


示例7: initializeSettings

    def initializeSettings(self):
        '''add settings needed to configure our provider.'''
        # call the parent method which takes care of adding a setting for 
        # activating or deactivating the algorithms in the provider
        AlgorithmProvider.initializeSettings(self)

        # add settings
        SextanteConfig.addSetting(Setting("LWGEOM algorithms", LwgeomAlgorithmProvider.LWGEOM_PATH_SETTING, "Path to liblwgeom", ""))
开发者ID:SIGISLV,项目名称:processinglwgeomprovider,代码行数:8,代码来源:LwgeomAlgorithmProvider.py


示例8: addProvider

 def addProvider(provider):
     '''use this method to add algorithms from external providers'''
     '''Adding a new provider automatically initializes it, so there is no need to do it in advance'''
     #Note: this might slow down the initialization process if there are many new providers added.
     #Should think of a different solution
     provider.initializeSettings()
     Sextante.providers.append(provider)
     SextanteConfig.loadSettings()
     Sextante.updateAlgsList()
开发者ID:lordi,项目名称:Quantum-GIS,代码行数:9,代码来源:Sextante.py


示例9: removeProvider

 def removeProvider(provider):
     '''Use this method to remove a provider.
     This method should be called when unloading a plugin that contributes a provider to SEXTANTE'''
     try:
         provider.unload()
         Sextante.providers.remove(provider)
         SextanteConfig.loadSettings()
         Sextante.updateAlgsList()
     except:
         pass #This try catch block is here to avoid problems if the plugin with a provider is unloaded
开发者ID:Adam-Brown,项目名称:Quantum-GIS,代码行数:10,代码来源:Sextante.py


示例10: fillCoords

 def fillCoords(self):
     r = self.tool.rectangle()
     SextanteConfig.setSettingValue(GrassUtils.GRASS_REGION_XMIN, r.xMinimum())
     SextanteConfig.setSettingValue(GrassUtils.GRASS_REGION_YMIN, r.yMinimum())
     SextanteConfig.setSettingValue(GrassUtils.GRASS_REGION_XMAX, r.xMaximum())
     SextanteConfig.setSettingValue(GrassUtils.GRASS_REGION_YMAX, r.yMaximum())
     SextanteConfig.setSettingValue(GrassUtils.GRASS_AUTO_REGION, False)
     s = str(r.xMinimum()) + "," + str(r.xMaximum()) + "," + str(r.yMinimum()) + "," + str(r.yMaximum())
     self.tool.reset()
     canvas = QGisLayers.iface.mapCanvas()
     canvas.setMapTool(self.prevMapTool)
     QtGui.QMessageBox.information(None, "GRASS Region", "GRASS region set to:\n" + s + \
                                   "\nTo set the cellsize or set back the autoregion option,\ngo to the SEXTANTE configuration.")
开发者ID:mokerjoke,项目名称:Quantum-GIS,代码行数:13,代码来源:DefineGrassRegionAction.py


示例11: execute

 def execute(self):
     layers = QGisLayers.getAllLayers();
     layersMap = dict([(layer.name(), layer) for layer in layers])
     layerNames = [layer.name() for layer in layers]
     item, ok = QtGui.QInputDialog.getItem(None, "Select a layer", "Layer selection", layerNames, editable=False)
     if ok:
         layer = layersMap[item]
         SextanteConfig.setSettingValue(GrassUtils.GRASS_REGION_XMIN, layer.extent().xMinimum())
         SextanteConfig.setSettingValue(GrassUtils.GRASS_REGION_YMIN, layer.extent().yMinimum())
         SextanteConfig.setSettingValue(GrassUtils.GRASS_REGION_XMAX, layer.extent().xMaximum())
         SextanteConfig.setSettingValue(GrassUtils.GRASS_REGION_YMAX, layer.extent().yMaximum())
         SextanteConfig.setSettingValue(GrassUtils.GRASS_AUTO_REGION, False)
         s = str(layer.extent().xMinimum()) + "," + str(layer.extent().xMaximum()) + "," + str(layer.extent().yMinimum()) + "," + str(layer.extent().yMaximum())
         QtGui.QMessageBox.information(None, "GRASS Region", "GRASS region set to:\n" + s + \
                                   "\nTo set the cellsize or set back the autoregion option,\ngo to the SEXTANTE configuration.")
开发者ID:Adam-Brown,项目名称:Quantum-GIS,代码行数:15,代码来源:DefineGrassRegionFromLayerAction.py


示例12: handleAlgorithmResults

 def handleAlgorithmResults(alg, progress, showResults = True):
     wrongLayers = []
     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:
                 wrongLayers.append(out)
                 #QMessageBox.critical(None, "Error", str(e))
         elif isinstance(out, OutputHTML):
             SextanteResults.addResult(out.description, out.value)
             htmlResults = True
开发者ID:jesusjl,项目名称:Quantum-GIS,代码行数:26,代码来源:SextantePostprocessing.py


示例13: processAlgorithm

    def processAlgorithm(self, progress):
        commands = []
        commands.append(os.path.join(TauDEMUtils.mpiexecPath(), "mpiexec"))

        processNum = SextanteConfig.getSetting(TauDEMUtils.MPI_PROCESSES)
        if processNum <= 0:
          raise GeoAlgorithmExecutionException("Wrong number of MPI processes used.\nPlease set correct number before running TauDEM algorithms.")

        commands.append("-n")
        commands.append(str(processNum))
        commands.append(os.path.join(TauDEMUtils.taudemPath(), self.cmdName))
        commands.append("-ang")
        commands.append(self.getParameterValue(self.DINF_FLOW_DIR_GRID))
        commands.append("-fel")
        commands.append(self.getParameterValue(self.PIT_FILLED_GRID))
        commands.append("-m")
        commands.append(str(self.STAT_DICT[self.getParameterValue(self.STAT_METHOD)]))
        commands.append(str(self.DIST_DICT[self.getParameterValue(self.DIST_METHOD)]))
        commands.append("-thresh")
        commands.append(str(self.getParameterValue(self.THRESHOLD)))
        if str(self.getParameterValue(self.EDGE_CONTAM)).lower() == "false":
            commands.append("-nc")
        commands.append("-du")
        commands.append(self.getOutputValue(self.DIST_UP_GRID))

        loglines = []
        loglines.append("TauDEM execution command")
        for line in commands:
            loglines.append(line)
        SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)

        TauDEMUtils.executeTauDEM(commands, progress)
开发者ID:Hardysong,项目名称:Quantum-GIS,代码行数:32,代码来源:dinfdistup.py


示例14: executeGrass

    def executeGrass(commands, progress, outputCommands = None):
        loglines = []
        loglines.append("GRASS execution console output")
        grassOutDone = False
        command = GrassUtils.prepareGrassExecution(commands)
        proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE,stderr=subprocess.STDOUT, universal_newlines=True).stdout
        for line in iter(proc.readline, ""):
            if "GRASS_INFO_PERCENT" in line:
                try:
                    progress.setPercentage(int(line[len("GRASS_INFO_PERCENT")+ 2:]))
                except:
                    pass
            else:
                if "r.out" in line or "v.out" in line:
                    grassOutDone = True
                loglines.append(line)
                progress.setConsoleInfo(line)
        # Some GRASS scripts, like r.mapcalculator or r.fillnulls, call other GRASS scripts during execution. This may override any commands that are
        # still to be executed by the subprocess, which are usually the output ones. If that is the case runs the output commands again.
        if not grassOutDone and outputCommands:
            command = GrassUtils.prepareGrassExecution(outputCommands)
            proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE,stderr=subprocess.STDOUT, universal_newlines=True).stdout
            for line in iter(proc.readline, ""):
                if "GRASS_INFO_PERCENT" in line:
                    try:
                        progress.setPercentage(int(line[len("GRASS_INFO_PERCENT")+ 2:]))
                    except:
                        pass
                else:
                    loglines.append(line)
                    progress.setConsoleInfo(line)

        if SextanteConfig.getSetting(GrassUtils.GRASS_LOG_CONSOLE):
            SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)
        return loglines;
开发者ID:Nald,项目名称:Quantum-GIS,代码行数:35,代码来源:GrassUtils.py


示例15: addRecentAlgorithms

    def addRecentAlgorithms(self, updating):
        showRecent = SextanteConfig.getSetting(SextanteConfig.SHOW_RECENT_ALGORITHMS)
        if showRecent:
            recent = SextanteLog.getRecentAlgorithms()
            if len(recent) != 0:
                found = False
                if updating:
                    recentItem = self.algorithmTree.topLevelItem(0)
                    treeWidget = recentItem.treeWidget()
                    treeWidget.takeTopLevelItem(treeWidget.indexOfTopLevelItem(recentItem))
                    #self.algorithmTree.removeItemWidget(first, 0)

                recentItem = QTreeWidgetItem()
                recentItem.setText(0, self.tr("Recently used algorithms"))
                for algname in recent:
                    alg = Sextante.getAlgorithm(algname)
                    if alg is not None:
                        algItem = TreeAlgorithmItem(alg)
                        recentItem.addChild(algItem)
                        found = True
                if found:
                    self.algorithmTree.insertTopLevelItem(0, recentItem)
                    recentItem.setExpanded(True)

            self.algorithmTree.setWordWrap(True)
开发者ID:Hardysong,项目名称:Quantum-GIS,代码行数:25,代码来源:SextanteToolbox.py


示例16: executeAlgorithm

 def executeAlgorithm(self):
     item = self.algorithmTree.currentItem()
     if isinstance(item, TreeAlgorithmItem):
         alg = Sextante.getAlgorithm(item.alg.commandLineName())
         message = alg.checkBeforeOpeningParametersDialog()
         if message:
             dlg = MissingDependencyDialog(message)
             dlg.exec_()
             #QMessageBox.warning(self, self.tr("Warning"), message)
             return
         alg = alg.getCopy()
         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)
         if dlg.executed:
             showRecent = SextanteConfig.getSetting(SextanteConfig.SHOW_RECENT_ALGORITHMS)
             if showRecent:
                 self.addRecentAlgorithms(True)
     if isinstance(item, TreeActionItem):
         action = item.action
         action.setData(self)
         action.execute()
开发者ID:Hardysong,项目名称:Quantum-GIS,代码行数:32,代码来源:SextanteToolbox.py


示例17: processAlgorithm

    def processAlgorithm(self, progress):
        commands.append(os.path.join(TauDEMUtils.mpiexecPath(), "mpiexec"))

        processNum = SextanteConfig.getSetting(TauDEMUtils.MPI_PROCESSES)
        if processNum <= 0:
          raise GeoAlgorithmExecutionException("Wrong number of MPI processes used.\nPlease set correct number before running TauDEM algorithms.")

        commands.append("-n")
        commands.append(str(processNum))
        commands.append(os.path.join(TauDEMUtils.taudemPath(), self.cmdName))
        commands.append("-ad8")
        commands.append(self.getParameterValue(self.D8_CONTRIB_AREA_GRID))
        commands.append("-p")
        commands.append(self.getParameterValue(self.D8_FLOW_DIR_GRID))
        commands.append("-fel")
        commands.append(self.getParameterValue(self.PIT_FILLED_GRID))
        commands.append("-ssa")
        commands.append(self.getParameterValue(self.ACCUM_STREAM_SOURCE_GRID))
        commands.append("-o")
        commands.append(self.getParameterValue(self.OUTLETS_SHAPE))
        commands.append("-par")
        commands.append(str(self.getParameterValue(self.MIN_TRESHOLD)))
        commands.append(str(self.getParameterValue(self.MAX_THRESHOLD)))
        commands.append(str(self.getParameterValue(self.TRESHOLD_NUM)))
        commands.append(str(self.getParameterValue(self.STEPS)))
        commands.append("-drp")
        commands.append(self.getOutputValue(self.DROP_ANALYSIS_FILE))

        loglines = []
        loglines.append("TauDEM execution command")
        for line in commands:
            loglines.append(line)
        SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)

        TauDEMUtils.executeTauDEM(commands, progress)
开发者ID:Adam-Brown,项目名称:Quantum-GIS,代码行数:35,代码来源:dropanalysis.py


示例18: executeSaga

 def executeSaga(progress):
     if SextanteUtils.isWindows():
         command = ["cmd.exe", "/C ", SagaUtils.sagaBatchJobFilename()]
     else:
         os.chmod(SagaUtils.sagaBatchJobFilename(), stat.S_IEXEC | stat.S_IREAD | stat.S_IWRITE)
         command = [SagaUtils.sagaBatchJobFilename()]
     loglines = []
     loglines.append("SAGA execution console output")
     proc = subprocess.Popen(
         command,
         shell=True,
         stdout=subprocess.PIPE,
         stdin=subprocess.PIPE,
         stderr=subprocess.STDOUT,
         universal_newlines=True,
     ).stdout
     for line in iter(proc.readline, ""):
         if "%" in line:
             s = "".join([x for x in line if x.isdigit()])
             try:
                 progress.setPercentage(int(s))
             except:
                 pass
         else:
             line = line.strip()
             if line != "/" and line != "-" and line != "\\" and line != "|":
                 loglines.append(line)
                 progress.setConsoleInfo(line)
     if SextanteConfig.getSetting(SagaUtils.SAGA_LOG_CONSOLE):
         SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)
开发者ID:Nald,项目名称:Quantum-GIS,代码行数:30,代码来源:SagaUtils.py


示例19: checkBeforeOpeningParametersDialog

    def checkBeforeOpeningParametersDialog(self):
        if SextanteUtils.isWindows():
            path = RUtils.RFolder()
            if path == "":
                return "R folder is not configured.\nPlease configure it before running R scripts."
    
        R_INSTALLED = "R_INSTALLED"
        settings = QSettings()
        if settings.contains(R_INSTALLED):
            return
        if SextanteUtils.isWindows(): 
            if SextanteConfig.getSetting(RUtils.R_USE64):
                execDir = "x64"
            else:
                execDir = "i386"
            command = [RUtils.RFolder() + os.sep + "bin" + os.sep + execDir + os.sep + "R.exe --version"]
        else:
            command = ["R --version"]
        proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE,stderr=subprocess.STDOUT, universal_newlines=True).stdout

        for line in iter(proc.readline, ""):
            if "R version" in line:
                settings.setValue(R_INSTALLED, True)
                return
        return "It seems that R is not correctly installed in your system.\nPlease install it before running R Scripts."
开发者ID:JoeyPinilla,项目名称:Quantum-GIS,代码行数:25,代码来源:RAlgorithm.py


示例20: saveToFile

 def saveToFile(self):
     filefilter = self.output.getFileFilter(self.alg)
     settings = QSettings()
     if settings.contains("/SextanteQGIS/LastOutputPath"):
         path = settings.value( "/SextanteQGIS/LastOutputPath")
     else:
         path = SextanteConfig.getSetting(SextanteConfig.OUTPUT_FOLDER)
     lastEncoding = settings.value("/SextanteQGIS/encoding", "System")
     fileDialog = QgsEncodingFileDialog(self, "Save file", path, filefilter, lastEncoding)
     fileDialog.setFileMode(QFileDialog.AnyFile)
     fileDialog.setAcceptMode(QFileDialog.AcceptSave)
     fileDialog.setConfirmOverwrite(True)
     if fileDialog.exec_() == QDialog.Accepted:
         files = fileDialog.selectedFiles()
         encoding = unicode(fileDialog.encoding())
         self.output.encoding = encoding
         filename = unicode(files[0])
         selectedFilefilter = unicode(fileDialog.selectedNameFilter())
         if not filename.lower().endswith(tuple(re.findall("\*(\.[a-z]{1,5})", filefilter))):
             ext = re.search("\*(\.[a-z]{1,5})", selectedFilefilter)
             if ext:
                 filename = filename + ext.group(1)
         self.text.setText(filename)
         settings.setValue("/SextanteQGIS/LastOutputPath", os.path.dirname(filename))
         settings.setValue("/SextanteQGIS/encoding", encoding)
开发者ID:Adam-Brown,项目名称:Quantum-GIS,代码行数:25,代码来源:OutputSelectionPanel.py



注:本文中的sextante.core.SextanteConfig.SextanteConfig类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python SextanteLog.SextanteLog类代码示例发布时间:2022-05-27
下一篇:
Python Sextante.Sextante类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap