当前位置: 首页>>代码示例>>Python>>正文


Python SextanteConfig.getSetting方法代码示例

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


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

示例1: fillTree

# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import getSetting [as 别名]
    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,代码行数:29,代码来源:SextanteToolbox.py

示例2: RScriptsFolder

# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import getSetting [as 别名]
    def RScriptsFolder():
        folder = SextanteConfig.getSetting(RUtils.RSCRIPTS_FOLDER)
        if folder == None:
            folder = os.path.join(os.path.dirname(__file__), "scripts")
        mkdir(folder)

        return folder
开发者ID:carsonfarmer,项目名称:Quantum-GIS,代码行数:9,代码来源:RUtils.py

示例3: handleAlgorithmResults

# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import getSetting [as 别名]
 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,代码行数:28,代码来源:SextantePostprocessing.py

示例4: scriptsFolder

# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import getSetting [as 别名]
    def scriptsFolder():
        folder = SextanteConfig.getSetting(ScriptUtils.SCRIPTS_FOLDER)
        if folder == None:
            folder = SextanteUtils.userFolder() + os.sep + "scripts"
        mkdir(folder)

        return folder
开发者ID:hCivil,项目名称:Quantum-GIS,代码行数:9,代码来源:ScriptUtils.py

示例5: getRecentAlgorithms

# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import getSetting [as 别名]
 def getRecentAlgorithms():
     recentAlgsSetting = SextanteConfig.getSetting(SextanteConfig.RECENT_ALGORITHMS)
     try:
         SextanteLog.recentAlgs = recentAlgsSetting.split(';')
     except:
         pass
     return SextanteLog.recentAlgs
开发者ID:Hardysong,项目名称:Quantum-GIS,代码行数:9,代码来源:SextanteLog.py

示例6: executeGrass

# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import getSetting [as 别名]
 def executeGrass(commands, progress):
     if SextanteUtils.isWindows():
         GrassUtils.createGrassScript(commands)
         command = ["cmd.exe", "/C ", GrassUtils.grassScriptFilename()]
     else:
         gisrc =  SextanteUtils.userFolder() + os.sep + "sextante.gisrc"
         os.putenv("GISRC", gisrc)
         os.putenv("GRASS_MESSAGE_FORMAT", "gui")
         os.putenv("GRASS_BATCH_JOB", GrassUtils.grassBatchJobFilename())
         GrassUtils.createGrassBatchJobFileFromGrassCommands(commands)
         os.chmod(GrassUtils.grassBatchJobFilename(), stat.S_IEXEC | stat.S_IREAD | stat.S_IWRITE)
         if SextanteUtils.isMac():
             command = GrassUtils.grassPath() + os.sep + "grass.sh " + GrassUtils.grassMapsetFolder() + "/user"
         else:
             command = "grass64 " + GrassUtils.grassMapsetFolder() + "/user"
     loglines = []
     loglines.append("GRASS 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 "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)
     shutil.rmtree(GrassUtils.grassMapsetFolder(), True)
开发者ID:mokerjoke,项目名称:Quantum-GIS,代码行数:32,代码来源:GrassUtils.py

示例7: checkBeforeOpeningParametersDialog

# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import getSetting [as 别名]
    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,代码行数:27,代码来源:RAlgorithm.py

示例8: processAlgorithm

# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import getSetting [as 别名]
    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,代码行数:37,代码来源:dropanalysis.py

示例9: otbPath

# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import getSetting [as 别名]
 def otbPath():
     folder = SextanteConfig.getSetting(OTBUtils.OTB_FOLDER)
     if folder == None:
         folder = ""
         #try to configure the path automatically
         if SextanteUtils.isMac():
             testfolder = os.path.join(str(QgsApplication.prefixPath()), "bin")
             if os.path.exists(os.path.join(testfolder, "otbcli")):
                 folder = testfolder
             else:
                 testfolder = "/usr/local/bin"
                 if os.path.exists(os.path.join(testfolder, "otbcli")):
                     folder = testfolder
         elif SextanteUtils.isWindows():
             testfolder = os.path.dirname(str(QgsApplication.prefixPath()))
             testfolder = os.path.dirname(testfolder)
             testfolder = os.path.join(testfolder,  "bin")
             path = os.path.join(testfolder, "otbcli.bat")
             if os.path.exists(path):
                 folder = testfolder
         else:
             testfolder = "/usr/bin"
             if os.path.exists(os.path.join(testfolder, "otbcli")):
                 folder = testfolder
     return folder
开发者ID:geodenilson,项目名称:Quantum-GIS,代码行数:27,代码来源:OTBUtils.py

示例10: exportVectorLayer

# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import getSetting [as 别名]
 def exportVectorLayer(self, orgFilename):
     #TODO: improve this. We are now exporting if it is not a shapefile,
     #but the functionality of v.in.ogr could be used for this.
     #We also export if there is a selection
     if not os.path.exists(orgFilename) or not orgFilename.endswith("shp"):
         layer = QGisLayers.getObjectFromUri(orgFilename, False)
         if layer:
             filename = LayerExporter.exportVectorLayer(layer)
     else:
         layer = QGisLayers.getObjectFromUri(orgFilename, False)
         if layer:
             useSelection = SextanteConfig.getSetting(SextanteConfig.USE_SELECTED)
             if useSelection and layer.selectedFeatureCount() != 0:
                 filename = LayerExporter.exportVectorLayer(layer)
             else:
                 filename = orgFilename
         else:
             filename = orgFilename
     destFilename = self.getTempFilename()
     self.exportedLayers[orgFilename]= destFilename
     command = "v.in.ogr"
     min_area = self.getParameterValue(self.GRASS_MIN_AREA_PARAMETER);
     command += " min_area=" + str(min_area)
     snap = self.getParameterValue(self.GRASS_SNAP_TOLERANCE_PARAMETER);
     command += " snap=" + str(snap)
     command += " dsn=\"" + os.path.dirname(filename) + "\""
     command += " layer=" + os.path.basename(filename)[:-4]
     command += " output=" + destFilename;
     command += " --overwrite -o"
     return command
开发者ID:PepSalehi,项目名称:Quantum-GIS,代码行数:32,代码来源:GrassAlgorithm.py

示例11: modelsFolder

# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import getSetting [as 别名]
    def modelsFolder():
        folder = SextanteConfig.getSetting(ModelerUtils.MODELS_FOLDER)
        if folder == None:
            folder = unicode(os.path.join(SextanteUtils.userFolder(), "models"))
        mkdir(folder)

        return os.path.abspath(folder)
开发者ID:Adam-Brown,项目名称:Quantum-GIS,代码行数:9,代码来源:ModelerUtils.py

示例12: exportVectorLayer

# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import getSetting [as 别名]
 def exportVectorLayer(layer):
     '''Takes a QgsVectorLayer and returns the filename to refer to it, which allows external
     apps which support only file-based layers to use it. It performs the necessary export
     in case the input layer is not in a standard format suitable for most applications, it is
     a remote one or db-based (non-file based) one, or if there is a selection and it should be
     used, exporting just the selected features.
     Currently, the output is restricted to shapefiles, so anything that is not in a shapefile
     will get exported.
     It also export to a new file if the original one contains non-ascii characters'''
     settings = QSettings()
     systemEncoding = settings.value( "/UI/encoding", "System" ).toString()
     output = SextanteUtils.getTempFilename("shp")
     provider = layer.dataProvider()
     useSelection = SextanteConfig.getSetting(SextanteConfig.USE_SELECTED)
     if useSelection and layer.selectedFeatureCount() != 0:
         writer = QgsVectorFileWriter(output, systemEncoding, layer.pendingFields(), provider.geometryType(), layer.crs())
         selection = layer.selectedFeatures()
         for feat in selection:
             writer.addFeature(feat)
         del writer
         return output
     else:
         isASCII=True
         try:
             unicode(layer.source()).decode("ascii")
         except UnicodeEncodeError:
             isASCII=False
         if (not unicode(layer.source()).endswith("shp") or not isASCII):
             writer = QgsVectorFileWriter( output, systemEncoding, layer.pendingFields(), provider.geometryType(), layer.crs() )
             for feat in layer.getFeatures():
                 writer.addFeature(feat)
             del writer
             return output
         else:
             return unicode(layer.source())
开发者ID:jacklibj,项目名称:readqgis,代码行数:37,代码来源:LayerExporter.py

示例13: runIli2c

# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import getSetting [as 别名]
 def runIli2c(args, progress):
     #ili2c USAGE
     #  ili2c [Options] file1.ili file2.ili ...
     #
     #OPTIONS
     #
     #--no-auto             don't look automatically after required models.
     #-o0                   Generate no output (default).
     #-o1                   Generate INTERLIS-1 output.
     #-o2                   Generate INTERLIS-2 output.
     #-oXSD                 Generate an XML-Schema.
     #-oFMT                 Generate an INTERLIS-1 Format.
     #-oIMD                 Generate Model as IlisMeta INTERLIS-Transfer (XTF).
     #-oIOM                 (deprecated) Generate Model as INTERLIS-Transfer (XTF).
     #--out file/dir        file or folder for output.
     #--ilidirs %ILI_DIR;http://models.interlis.ch/;%JAR_DIR list of directories with ili-files.
     #--proxy host          proxy server to access model repositories.
     #--proxyPort port      proxy port to access model repositories.
     #--with-predefined     Include the predefined MODEL INTERLIS in
     #                      the output. Usually, this is omitted.
     #--without-warnings    Report only errors, no warnings. Usually,
     #                      warnings are generated as well.
     #--trace               Display detailed trace messages.
     #--quiet               Suppress info messages.
     #-h|--help             Display this help text.
     #-u|--usage            Display short information about usage.
     #-v|--version          Display the version of ili2c.
     IliUtils.runJava( SextanteConfig.getSetting(IliUtils.ILI2C_JAR), args, progress )
开发者ID:ThomasG77,项目名称:ogrtools,代码行数:30,代码来源:IliUtils.py

示例14: modelsFolder

# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import getSetting [as 别名]
    def modelsFolder():
        folder = SextanteConfig.getSetting(ModelerUtils.MODELS_FOLDER)
        if folder == None:
            folder = SextanteUtils.userFolder() + os.sep + "models"
        mkdir(folder)

        return folder
开发者ID:hCivil,项目名称:Quantum-GIS,代码行数:9,代码来源:ModelerUtils.py

示例15: executeSaga

# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import getSetting [as 别名]
 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,代码行数:32,代码来源:SagaUtils.py


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