本文整理汇总了Python中sextante.core.SextanteUtils.SextanteUtils.isMac方法的典型用法代码示例。如果您正苦于以下问题:Python SextanteUtils.isMac方法的具体用法?Python SextanteUtils.isMac怎么用?Python SextanteUtils.isMac使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sextante.core.SextanteUtils.SextanteUtils
的用法示例。
在下文中一共展示了SextanteUtils.isMac方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: otbPath
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isMac [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
示例2: unload
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isMac [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)
示例3: executeGrass
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isMac [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: initializeSettings
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isMac [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))
示例5: mpiexecPath
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isMac [as 别名]
def mpiexecPath():
folder = SextanteConfig.getSetting(TauDEMUtils.MPIEXEC_FOLDER)
if folder == None:
folder = ""
if SextanteUtils.isMac():
testfolder = os.path.join(str(QgsApplication.prefixPath()), "bin")
if os.path.exists(os.path.join(testfolder, "mpiexec")):
folder = testfolder
else:
testfolder = "/usr/local/bin"
if os.path.exists(os.path.join(testfolder, "mpiexec")):
folder = testfolder
return folder
示例6: sagaPath
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isMac [as 别名]
def sagaPath():
folder = SextanteConfig.getSetting(SagaUtils.SAGA_FOLDER)
if folder == None:
folder =""
if SextanteUtils.isMac():
testfolder = os.path.join(str(QgsApplication.prefixPath()), "bin")
if os.path.exists(os.path.join(testfolder, "saga_cmd")):
folder = testfolder
else:
testfolder = "/usr/local/bin"
if os.path.exists(os.path.join(testfolder, "saga_cmd")):
folder = testfolder
return folder
示例7: taudemPath
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isMac [as 别名]
def taudemPath():
folder = SextanteConfig.getSetting(TauDEMUtils.TAUDEM_FOLDER)
if folder == None:
folder = ""
if SextanteUtils.isMac():
testfolder = os.path.join(str(QgsApplication.prefixPath()), "bin")
if os.path.exists(os.path.join(testfolder, "slopearea")):
folder = testfolder
else:
testfolder = "/usr/local/bin"
if os.path.exists(os.path.join(testfolder, "slopearea")):
folder = testfolder
return folder
示例8: prepareGrassExecution
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isMac [as 别名]
def prepareGrassExecution(commands):
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() + "/PERMANENT"
else:
command = "grass64 " + GrassUtils.grassMapsetFolder() + "/PERMANENT"
return command
示例9: createSagaBatchJobFileFromSagaCommands
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isMac [as 别名]
def createSagaBatchJobFileFromSagaCommands(commands):
fout = open(SagaUtils.sagaBatchJobFilename(), "w")
if SextanteUtils.isWindows():
fout.write("set SAGA=" + SagaUtils.sagaPath() + "\n");
fout.write("set SAGA_MLB=" + SagaUtils.sagaPath() + os.sep + "modules" + "\n");
fout.write("PATH=PATH;%SAGA%;%SAGA_MLB%\n");
elif SextanteUtils.isMac():
fout.write("export SAGA_MLB=" + SagaUtils.sagaPath() + "/../lib/saga\n");
fout.write("export PATH=" + SagaUtils.sagaPath() + ":$PATH\n");
else:
pass
for command in commands:
fout.write("saga_cmd " + command.encode("utf8") + "\n")
fout.write("exit")
fout.close()
示例10: initializeSettings
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isMac [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))
#SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_AUTO_REGION, "Use min covering region", True))
SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_LATLON, "Coordinates are lat/lon", False))
#=======================================================================
# SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_REGION_XMIN, "GRASS Region min x", 0))
# SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_REGION_YMIN, "GRASS Region min y", 0))
# SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_REGION_XMAX, "GRASS Region max x", 1000))
# SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_REGION_YMAX, "GRASS Region max y", 1000))
# SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_REGION_CELLSIZE, "GRASS Region cellsize", 100))
#=======================================================================
SextanteConfig.addSetting(Setting(self.getDescription(), GrassUtils.GRASS_HELP_FOLDER, "GRASS help folder", GrassUtils.grassHelpPath()))
示例11: resampleRasterLayer
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isMac [as 别名]
def resampleRasterLayer(self,layer):
'''this is supposed to be run after having exported all raster layers'''
if layer in self.exportedLayers.keys():
inputFilename = self.exportedLayers[layer]
else:
inputFilename = layer
destFilename = SextanteUtils.getTempFilename("sgrd")
self.exportedLayers[layer]= destFilename
if SextanteUtils.isWindows() or SextanteUtils.isMac():
s = "grid_tools \"Resampling\" -INPUT \"" + inputFilename + "\" -TARGET 0 -SCALE_UP_METHOD 4 -SCALE_DOWN_METHOD 4 -USER_XMIN " +\
str(self.xmin) + " -USER_XMAX " + str(self.xmax) + " -USER_YMIN " + str(self.ymin) + " -USER_YMAX " + str(self.ymax) +\
" -USER_SIZE " + str(self.cellsize) + " -USER_GRID \"" + destFilename + "\""
else:
s = "libgrid_tools \"Resampling\" -INPUT \"" + inputFilename + "\" -TARGET 0 -SCALE_UP_METHOD 4 -SCALE_DOWN_METHOD 4 -USER_XMIN " +\
str(self.xmin) + " -USER_XMAX " + str(self.xmax) + " -USER_YMIN " + str(self.ymin) + " -USER_YMAX " + str(self.ymax) +\
" -USER_SIZE " + str(self.cellsize) + " -USER_GRID \"" + destFilename + "\""
return s
示例12: unload
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isMac [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_AUTO_REGION)
SextanteConfig.removeSetting(GrassUtils.GRASS_LATLON)
#=======================================================================
# SextanteConfig.removeSetting(GrassUtils.GRASS_REGION_XMIN)
# SextanteConfig.removeSetting(GrassUtils.GRASS_REGION_YMIN)
# SextanteConfig.removeSetting(GrassUtils.GRASS_REGION_XMAX)
# SextanteConfig.removeSetting(GrassUtils.GRASS_REGION_YMAX)
# SextanteConfig.removeSetting(GrassUtils.GRASS_REGION_CELLSIZE)
#=======================================================================
SextanteConfig.removeSetting(GrassUtils.GRASS_HELP_FOLDER)
SextanteConfig.removeSetting(GrassUtils.GRASS_LOG_COMMANDS)
SextanteConfig.removeSetting(GrassUtils.GRASS_LOG_CONSOLE)
示例13: otbPath
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isMac [as 别名]
def otbPath():
folder = SextanteConfig.getSetting(OTBUtils.OTB_FOLDER)
if folder == None:
folder = ""
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
else:
testfolder = "/usr/bin"
if os.path.exists(os.path.join(testfolder, "otbcli")):
folder = testfolder
return folder
示例14: otbLibPath
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isMac [as 别名]
def otbLibPath():
folder = SextanteConfig.getSetting(OTBUtils.OTB_LIB_FOLDER)
if folder == None:
folder =""
if SextanteUtils.isMac():
testfolder = os.path.join(str(QgsApplication.prefixPath()), "lib/otb/applications")
if os.path.exists(testfolder):
folder = testfolder
else:
testfolder = "/usr/local/lib/otb/applications"
if os.path.exists(testfolder):
folder = testfolder
else:
testfolder = "/usr/lib/otb/applications"
if os.path.exists(testfolder):
folder = testfolder
return folder
示例15: sagaPath
# 需要导入模块: from sextante.core.SextanteUtils import SextanteUtils [as 别名]
# 或者: from sextante.core.SextanteUtils.SextanteUtils import isMac [as 别名]
def sagaPath():
folder = SextanteConfig.getSetting(SagaUtils.SAGA_FOLDER)
if folder == None:
folder =""
#try to auto-configure the folder
if SextanteUtils.isMac():
testfolder = os.path.join(str(QgsApplication.prefixPath()), "bin")
if os.path.exists(os.path.join(testfolder, "saga_cmd")):
folder = testfolder
else:
testfolder = "/usr/local/bin"
if os.path.exists(os.path.join(testfolder, "saga_cmd")):
folder = testfolder
elif SextanteUtils.isWindows():
testfolder = os.path.dirname(str(QgsApplication.prefixPath()))
testfolder = os.path.join(testfolder, "saga")
if os.path.exists(os.path.join(testfolder, "saga_cmd.exe")):
folder = testfolder
return folder