本文整理汇总了Python中sextante.core.SextanteUtils.SextanteUtils.isWindows方法的典型用法代码示例。如果您正苦于以下问题:Python SextanteUtils.isWindows方法的具体用法?Python SextanteUtils.isWindows怎么用?Python SextanteUtils.isWindows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sextante.core.SextanteUtils.SextanteUtils
的用法示例。
在下文中一共展示了SextanteUtils.isWindows方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checkBeforeOpeningParametersDialog
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isWindows [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."
示例2: checkRIsInstalled
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isWindows [as 别名]
def checkRIsInstalled(ignoreRegistrySettings=False):
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 not ignoreRegistrySettings:
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
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/sextante/3rdParty.html">Click here</a>'
'to know more about how to install and configure R to be used with SEXTANTE</p>')
return html
示例3: executeGrass
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isWindows [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)
示例4: executeSaga
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isWindows [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)
示例5: otbPath
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isWindows [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
示例6: initializeSettings
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isWindows [as 别名]
def initializeSettings(self):
AlgorithmProvider.initializeSettings(self)
if SextanteUtils.isWindows():
SextanteConfig.addSetting(
Setting(self.getDescription(), SagaUtils.SAGA_FOLDER, "SAGA folder", SagaUtils.sagaPath())
)
SextanteConfig.addSetting(
Setting(
self.getDescription(),
SagaUtils.SAGA_AUTO_RESAMPLING,
"Use min covering grid system for resampling",
True,
)
)
SextanteConfig.addSetting(
Setting(self.getDescription(), SagaUtils.SAGA_LOG_COMMANDS, "Log execution commands", False)
)
SextanteConfig.addSetting(
Setting(self.getDescription(), SagaUtils.SAGA_LOG_CONSOLE, "Log console output", False)
)
SextanteConfig.addSetting(
Setting(self.getDescription(), SagaUtils.SAGA_RESAMPLING_REGION_XMIN, "Resampling region min x", 0)
)
SextanteConfig.addSetting(
Setting(self.getDescription(), SagaUtils.SAGA_RESAMPLING_REGION_YMIN, "Resampling region min y", 0)
)
SextanteConfig.addSetting(
Setting(self.getDescription(), SagaUtils.SAGA_RESAMPLING_REGION_XMAX, "Resampling region max x", 1000)
)
SextanteConfig.addSetting(
Setting(self.getDescription(), SagaUtils.SAGA_RESAMPLING_REGION_YMAX, "Resampling region max y", 1000)
)
SextanteConfig.addSetting(
Setting(self.getDescription(), SagaUtils.SAGA_RESAMPLING_REGION_CELLSIZE, "Resampling region cellsize", 1)
)
示例7: checkSagaIsInstalled
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isWindows [as 别名]
def checkSagaIsInstalled(ignoreRegistrySettings=False):
if SextanteUtils.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 SEXTANTE settings dialog, and check that the SAGA\n"
+ "folder is correctly configured")
settings = QSettings()
if not ignoreRegistrySettings:
SAGA_INSTALLED = "/SextanteQGIS/SagaInstalled"
if settings.contains(SAGA_INSTALLED):
return
try:
from sextante.core.Sextante 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)
示例8: unload
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isWindows [as 别名]
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_LOG_COMMANDS)
SextanteConfig.removeSetting(GrassUtils.GRASS_LOG_CONSOLE)
示例9: processAlgorithm
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isWindows [as 别名]
def processAlgorithm(self, progress):
#TODO:check correct num of bands
input = self.getParameterValue(SplitRGBBands.INPUT)
temp = SextanteUtils.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 SextanteUtils.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);
示例10: initializeSettings
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isWindows [as 别名]
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))
示例11: checkGrassIsInstalled
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isWindows [as 别名]
def checkGrassIsInstalled(ignoreRegistrySettings=False):
if SextanteUtils.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 SEXTANTE settings dialog, and check that the GRASS\n"
+ "folder is correctly configured")
settings = QSettings()
GRASS_INSTALLED = "/SextanteQGIS/GrassInstalled"
if not ignoreRegistrySettings:
if settings.contains(GRASS_INSTALLED):
return
try:
from sextante import runalg
result = runalg("grass:v.voronoi", points(),False,False,"270778.60198,270855.745301,4458921.97814,4458983.8488",-1,0.0001,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)
示例12: exportRasterLayer
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isWindows [as 别名]
def exportRasterLayer(self, layer):
destFilename = SextanteUtils.getTempFilename("sgrd")
self.exportedLayers[layer]= destFilename
if SextanteUtils.isWindows():
return "io_gdal 0 -GRIDS \"" + destFilename + "\" -FILES \"" + layer+"\""
else:
return "libio_gdal 0 -GRIDS \"" + destFilename + "\" -FILES \"" + layer + "\""
示例13: initializeSettings
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isWindows [as 别名]
def initializeSettings(self):
AlgorithmProvider.initializeSettings(self)
SextanteConfig.addSetting(
Setting(self.getDescription(), RUtils.RSCRIPTS_FOLDER, "R Scripts folder", RUtils.RScriptsFolder())
)
if SextanteUtils.isWindows():
SextanteConfig.addSetting(Setting(self.getDescription(), RUtils.R_FOLDER, "R folder", RUtils.RFolder()))
SextanteConfig.addSetting(Setting(self.getDescription(), RUtils.R_USE64, "Use 64 bit version", False))
示例14: getValueAsCommandLineParameter
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isWindows [as 别名]
def getValueAsCommandLineParameter(self):
if self.value == None:
return str(None)
else:
if not SextanteUtils.isWindows():
return '"' + str(self.value) + '"'
else:
return '"' + str(self.value).replace("\\", "\\\\") + '"'
示例15: sagaBatchJobFilename
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isWindows [as 别名]
def sagaBatchJobFilename():
if SextanteUtils.isWindows():
filename = "saga_batch_job.bat";
else:
filename = "saga_batch_job.sh";
batchfile = SextanteUtils.userFolder() + os.sep + filename
return batchfile