本文整理汇总了Python中sextante.core.SextanteConfig.SextanteConfig.setSettingValue方法的典型用法代码示例。如果您正苦于以下问题:Python SextanteConfig.setSettingValue方法的具体用法?Python SextanteConfig.setSettingValue怎么用?Python SextanteConfig.setSettingValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sextante.core.SextanteConfig.SextanteConfig
的用法示例。
在下文中一共展示了SextanteConfig.setSettingValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import setSettingValue [as 别名]
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,
示例2: fillCoords
# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import setSettingValue [as 别名]
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.")
示例3: execute
# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import setSettingValue [as 别名]
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.")
示例4: addToLog
# 需要导入模块: from sextante.core.SextanteConfig import SextanteConfig [as 别名]
# 或者: from sextante.core.SextanteConfig.SextanteConfig import setSettingValue [as 别名]
def addToLog(msgtype, msg):
try: #it seems that this fails sometimes depending on the msg added:
#To avoid it stopping the normal functioning of the algorithm,
#we catch all errors, assuming that is better to miss some log info
#that breaking the algorithm.
if isinstance(msg, list):
a = "|".join(m.strip("\n") for m in msg)
text = a
else:
text = msg.replace("\n", "|")
line = msgtype + "|" + datetime.datetime.now().strftime(SextanteLog.DATE_FORMAT).decode("utf-8") + "|" + text + "\n"
logfile = codecs.open(SextanteLog.logFilename(), "a", encoding="utf-8")
#logfile = codecs.open(SextanteLog.logFilename(), "a", encoding='utf-8')
logfile.write(line)
logfile.close()
if msgtype==SextanteLog.LOG_ALGORITHM:
algname = text[len("Sextante.runalg(\""):]
algname = algname[:algname.index("\"")]
if algname not in SextanteLog.recentAlgs:
SextanteLog.recentAlgs.append(algname)
recentAlgsString = ';'.join(SextanteLog.recentAlgs[-6:])
SextanteConfig.setSettingValue(SextanteConfig.RECENT_ALGORITHMS, recentAlgsString)
except:
pass