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


Python ProcessingUtils.isWindows方法代码示例

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


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

示例1: checkRIsInstalled

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isWindows [as 别名]
    def checkRIsInstalled(ignoreRegistrySettings=False):
        if ProcessingUtils.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 not ignoreRegistrySettings:
            if settings.contains(R_INSTALLED):
                return
        if ProcessingUtils.isWindows():
            if ProcessingConfig.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
        html = ("<p>This algorithm requires R to be run."
            "Unfortunately, it seems that R is not installed in your system, or it is not correctly configured to be used from QGIS</p>"
            '<p><a href= "http://docs.qgis.org/2.0/html/en/docs/user_manual/processing/3rdParty.html">Click here</a>'
             'to know more about how to install and configure R to be used with QGIS</p>')
        return html
开发者ID:alextheleritis,项目名称:QGIS,代码行数:32,代码来源:RUtils.py

示例2: checkSagaIsInstalled

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isWindows [as 别名]
    def checkSagaIsInstalled(ignoreRegistrySettings=False):
        if ProcessingUtils.isWindows():
            path = SagaUtils.sagaPath()
            if path == "":
                return "SAGA folder is not configured.\nPlease configure it before running SAGA algorithms."
            cmdpath = os.path.join(path, "saga_cmd.exe")
            if not os.path.exists(cmdpath):
                return (
                    "The specified SAGA folder does not contain a valid SAGA executable.\n"
                    + "Please, go to the processing settings dialog, and check that the SAGA\n"
                    + "folder is correctly configured"
                )

        settings = QSettings()
        SAGA_INSTALLED = "/ProcessingQGIS/SagaInstalled"
        if not ignoreRegistrySettings:
            if settings.contains(SAGA_INSTALLED):
                return

        try:
            from processing import runalg

            result = runalg("saga:thiessenpolygons", points(), None)
            if not os.path.exists(result["POLYGONS"]):
                return "It seems that SAGA is not correctly installed in your system.\nPlease install it before running SAGA algorithms."
        except:
            s = traceback.format_exc()
            return "Error while checking SAGA installation. SAGA might not be correctly configured.\n" + s

        settings.setValue(SAGA_INSTALLED, True)
开发者ID:artfwo,项目名称:Quantum-GIS,代码行数:32,代码来源:SagaUtils.py

示例3: processAlgorithm

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isWindows [as 别名]
    def processAlgorithm(self, progress):
        #TODO:check correct num of bands
        input = self.getParameterValue(SplitRGBBands.INPUT)
        temp = ProcessingUtils.getTempFilename(None).replace('.','');
        basename = os.path.basename(temp)
        validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
        safeBasename = ''.join(c for c in basename if c in validChars)
        temp = os.path.join(os.path.dirname(temp), safeBasename)

        r = self.getOutputValue(SplitRGBBands.R)
        g = self.getOutputValue(SplitRGBBands.G)
        b = self.getOutputValue(SplitRGBBands.B)
        commands = []
        if ProcessingUtils.isWindows():
            commands.append("io_gdal 0 -GRIDS \"" + temp + "\" -FILES \"" + input+"\"")
            commands.append("io_gdal 1 -GRIDS \"" + temp + "_0001.sgrd\" -FORMAT 1 -TYPE 0 -FILE \"" + r + "\"");
            commands.append("io_gdal 1 -GRIDS \"" + temp + "_0002.sgrd\" -FORMAT 1 -TYPE 0 -FILE \"" + g + "\"");
            commands.append("io_gdal 1 -GRIDS \"" + temp + "_0003.sgrd\" -FORMAT 1 -TYPE 0 -FILE \"" + b + "\"");
        else:
            commands.append("libio_gdal 0 -GRIDS \"" + temp + "\" -FILES \"" + input + "\"")
            commands.append("libio_gdal 1 -GRIDS \"" + temp + "_0001.sgrd\" -FORMAT 1 -TYPE 0 -FILE \"" + r + "\"");
            commands.append("libio_gdal 1 -GRIDS \"" + temp + "_0002.sgrd\" -FORMAT 1 -TYPE 0 -FILE \"" + g + "\"");
            commands.append("libio_gdal 1 -GRIDS \"" + temp + "_0003.sgrd\" -FORMAT 1 -TYPE 0 -FILE \"" + b + "\"");

        SagaUtils.createSagaBatchJobFileFromSagaCommands(commands)
        SagaUtils.executeSaga(progress);
开发者ID:alextheleritis,项目名称:QGIS,代码行数:28,代码来源:SplitRGBBands.py

示例4: initializeSettings

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isWindows [as 别名]
 def initializeSettings(self):
     AlgorithmProvider.initializeSettings(self)
     if ProcessingUtils.isWindows() or ProcessingUtils.isMac():
         ProcessingConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_FOLDER, "GRASS folder", GrassUtils.grassPath()))
         ProcessingConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_WIN_SHELL, "Msys folder", GrassUtils.grassWinShell()))
     ProcessingConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_LOG_COMMANDS, "Log execution commands", False))
     ProcessingConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_LOG_CONSOLE, "Log console output", False))
开发者ID:alextheleritis,项目名称:QGIS,代码行数:9,代码来源:GrassAlgorithmProvider.py

示例5: checkGrassIsInstalled

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isWindows [as 别名]
    def checkGrassIsInstalled(ignoreRegistrySettings=False):
        if ProcessingUtils.isWindows():
            path = GrassUtils.grassPath()
            if path == "":
                return "GRASS folder is not configured.\nPlease configure it before running SAGA algorithms."
            cmdpath = os.path.join(path, "bin","r.out.gdal.exe")
            if not os.path.exists(cmdpath):
                return ("The specified GRASS folder does not contain a valid set of GRASS modules.\n"
                        + "Please, go to the processing settings dialog, and check that the GRASS\n"
                        + "folder is correctly configured")

        settings = QSettings()
        GRASS_INSTALLED = "/ProcessingQGIS/GrassInstalled"
        if not ignoreRegistrySettings:
            if settings.contains(GRASS_INSTALLED):
                return
        try:
            from processing import runalg
            result = runalg("grass:v.voronoi", points(),False,False,"270778.60198,270855.745301,4458921.97814,4458983.8488",-1,0.0001, 0, None)
            if not os.path.exists(result['output']):
                return "It seems that GRASS is not correctly installed and configured in your system.\nPlease install it before running GRASS algorithms."
        except:
            s = traceback.format_exc()
            return "Error while checking GRASS installation. GRASS might not be correctly configured.\n" + s;

        settings.setValue(GRASS_INSTALLED, True)
开发者ID:alextheleritis,项目名称:QGIS,代码行数:28,代码来源:GrassUtils.py

示例6: unload

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isWindows [as 别名]
 def unload(self):
     AlgorithmProvider.unload(self)
     if ProcessingUtils.isWindows() or ProcessingUtils.isMac():
         ProcessingConfig.removeSetting(GrassUtils.GRASS_FOLDER)
         ProcessingConfig.removeSetting(GrassUtils.GRASS_WIN_SHELL)
     ProcessingConfig.removeSetting(GrassUtils.GRASS_LOG_COMMANDS)
     ProcessingConfig.removeSetting(GrassUtils.GRASS_LOG_CONSOLE)
开发者ID:alextheleritis,项目名称:QGIS,代码行数:9,代码来源:GrassAlgorithmProvider.py

示例7: executeSaga

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isWindows [as 别名]
 def executeSaga(progress):
     if ProcessingUtils.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 ProcessingConfig.getSetting(SagaUtils.SAGA_LOG_CONSOLE):
         ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)
开发者ID:artfwo,项目名称:Quantum-GIS,代码行数:32,代码来源:SagaUtils.py

示例8: otbPath

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isWindows [as 别名]
 def otbPath():
     folder = ProcessingConfig.getSetting(OTBUtils.OTB_FOLDER)
     if folder == None:
         folder = ""
         #try to configure the path automatically
         if ProcessingUtils.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 ProcessingUtils.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:alextheleritis,项目名称:QGIS,代码行数:27,代码来源:OTBUtils.py

示例9: exportRasterLayer

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isWindows [as 别名]
 def exportRasterLayer(self, layer):
     destFilename = ProcessingUtils.getTempFilenameInTempFolder(os.path.basename(layer)[0:5] + ".sgrd")
     self.exportedLayers[layer]= destFilename
     saga208 = ProcessingConfig.getSetting(SagaUtils.SAGA_208)
     if ProcessingUtils.isWindows() or ProcessingUtils.isMac() or not saga208:
         return "io_gdal 0 -GRIDS \"" + destFilename + "\" -FILES \"" + layer+"\""
     else:
         return "libio_gdal 0 -GRIDS \"" + destFilename + "\" -FILES \"" + layer + "\""
开发者ID:artfwo,项目名称:Quantum-GIS,代码行数:10,代码来源:SagaAlgorithm.py

示例10: getValueAsCommandLineParameter

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isWindows [as 别名]
 def getValueAsCommandLineParameter(self):
     if self.value == None:
         return str(None)
     else:
         if not ProcessingUtils.isWindows():
             return "\"" + unicode(self.value) + "\""
         else:
             return "\"" + unicode(self.value).replace("\\", "\\\\") + "\""
开发者ID:alextheleritis,项目名称:QGIS,代码行数:10,代码来源:ParameterDataObject.py

示例11: sagaBatchJobFilename

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isWindows [as 别名]
    def sagaBatchJobFilename():

        if ProcessingUtils.isWindows():
            filename = "saga_batch_job.bat"
        else:
            filename = "saga_batch_job.sh"

        batchfile = ProcessingUtils.userFolder() + os.sep + filename

        return batchfile
开发者ID:artfwo,项目名称:Quantum-GIS,代码行数:12,代码来源:SagaUtils.py

示例12: __init__

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isWindows [as 别名]
    def __init__(self):
        AlgorithmProvider.__init__(self)
        self.activate = False
        self.algsList = []
        if ProcessingUtils.isWindows():
            lastools = [las2shp(), lasboundary(), las2dem(), las2iso(), lasgrid(), lasground(),
                         lasinfo(), lasheight(), lasprecision(), lassplit(), lasclassify(), lasclip()]
        else:
            lastools = [lasinfo(), lasprecision()]
        for alg in lastools:
            alg.group = "LASTools"
        self.algsList.extend(lastools)

        if ProcessingUtils.isWindows():
            self.actions.append(OpenViewerAction())
            fusiontools = [CloudMetrics(), CanopyMaxima(), CanopyModel(), ClipData(), Cover(), FilterData(),
                         GridMetrics(), GroundFilter(), GridSurfaceCreate(), MergeData()]
            for alg in fusiontools:
                alg.group = "Fusion"
            self.algsList.extend(fusiontools)
开发者ID:alextheleritis,项目名称:QGIS,代码行数:22,代码来源:LidarToolsAlgorithmProvider.py

示例13: grassPath

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isWindows [as 别名]
    def grassPath():
        if not ProcessingUtils.isWindows() and not ProcessingUtils.isMac():
            return ""

        folder = ProcessingConfig.getSetting(GrassUtils.GRASS_FOLDER)
        if folder == None:
            if ProcessingUtils.isWindows():
                testfolder = os.path.dirname(str(QgsApplication.prefixPath()))
                testfolder = os.path.join(testfolder,  "grass")
                if os.path.isdir(testfolder):
                    for subfolder in os.listdir(testfolder):
                        if subfolder.startswith("grass"):
                            folder = os.path.join(testfolder, subfolder)
                            break
            else:
                folder = os.path.join(str(QgsApplication.prefixPath()), "grass")
                if not os.path.isdir(folder):
                    folder = "/Applications/GRASS-6.4.app/Contents/MacOS"

        return folder
开发者ID:alextheleritis,项目名称:QGIS,代码行数:22,代码来源:GrassUtils.py

示例14: unload

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isWindows [as 别名]
 def unload(self):
     AlgorithmProvider.unload(self)
     if ProcessingUtils.isWindows():
         ProcessingConfig.removeSetting(SagaUtils.SAGA_FOLDER)
     ProcessingConfig.removeSetting(SagaUtils.SAGA_AUTO_RESAMPLING)
     ProcessingConfig.removeSetting(SagaUtils.SAGA_RESAMPLING_REGION_XMIN)
     ProcessingConfig.removeSetting(SagaUtils.SAGA_RESAMPLING_REGION_YMIN)
     ProcessingConfig.removeSetting(SagaUtils.SAGA_RESAMPLING_REGION_XMAX)
     ProcessingConfig.removeSetting(SagaUtils.SAGA_RESAMPLING_REGION_YMAX)
     ProcessingConfig.removeSetting(SagaUtils.SAGA_RESAMPLING_REGION_CELLSIZE)
     ProcessingConfig.removeSetting(SagaUtils.SAGA_LOG_CONSOLE)
     ProcessingConfig.removeSetting(SagaUtils.SAGA_LOG_COMMANDS)
开发者ID:bobo-romania,项目名称:Quantum-GIS,代码行数:14,代码来源:SagaAlgorithmProvider.py

示例15: initializeSettings

# 需要导入模块: from processing.core.ProcessingUtils import ProcessingUtils [as 别名]
# 或者: from processing.core.ProcessingUtils.ProcessingUtils import isWindows [as 别名]
 def initializeSettings(self):
     AlgorithmProvider.initializeSettings(self)
     if ProcessingUtils.isWindows():
         ProcessingConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_FOLDER, "SAGA folder", SagaUtils.sagaPath()))
     ProcessingConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_208, "Enable SAGA 2.0.8 compatibility", False))
     ProcessingConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_AUTO_RESAMPLING, "Use min covering grid system for resampling", True))
     ProcessingConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_LOG_COMMANDS, "Log execution commands", True))
     ProcessingConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_LOG_CONSOLE, "Log console output", True))
     ProcessingConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_RESAMPLING_REGION_XMIN, "Resampling region min x", 0))
     ProcessingConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_RESAMPLING_REGION_YMIN, "Resampling region min y", 0))
     ProcessingConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_RESAMPLING_REGION_XMAX, "Resampling region max x", 1000))
     ProcessingConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_RESAMPLING_REGION_YMAX, "Resampling region max y", 1000))
     ProcessingConfig.addSetting(Setting(self.getDescription(), SagaUtils.SAGA_RESAMPLING_REGION_CELLSIZE, "Resampling region cellsize", 1))
开发者ID:bobo-romania,项目名称:Quantum-GIS,代码行数:15,代码来源:SagaAlgorithmProvider.py


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