本文整理汇总了Python中processing.core.SilentProgress.SilentProgress.close方法的典型用法代码示例。如果您正苦于以下问题:Python SilentProgress.close方法的具体用法?Python SilentProgress.close怎么用?Python SilentProgress.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.core.SilentProgress.SilentProgress
的用法示例。
在下文中一共展示了SilentProgress.close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runAlgorithm
# 需要导入模块: from processing.core.SilentProgress import SilentProgress [as 别名]
# 或者: from processing.core.SilentProgress.SilentProgress import close [as 别名]
def runAlgorithm(algOrName, onFinish, *args):
if isinstance(algOrName, GeoAlgorithm):
alg = algOrName
else:
alg = Processing.getAlgorithm(algOrName)
if alg is None:
print 'Error: Algorithm not found\n'
return
if len(args) != alg.getVisibleParametersCount() \
+ alg.getVisibleOutputsCount():
print 'Error: Wrong number of parameters'
processing.alghelp(algOrName)
return
alg = alg.getCopy()
if isinstance(args, dict):
# Set params by name
for (name, value) in args.items():
if alg.getParameterFromName(name).setValue(value):
continue
if alg.getOutputFromName(name).setValue(value):
continue
print 'Error: Wrong parameter value %s for parameter %s.' \
% (value, name)
return
else:
i = 0
for param in alg.parameters:
if not param.hidden:
if not param.setValue(args[i]):
print 'Error: Wrong parameter value: ' \
+ unicode(args[i])
return
i = i + 1
for output in alg.outputs:
if not output.hidden:
if not output.setValue(args[i]):
print 'Error: Wrong output value: ' + unicode(args[i])
return
i = i + 1
msg = alg.checkParameterValuesBeforeExecuting()
if msg:
print 'Unable to execute algorithm\n' + msg
return
if not alg.checkInputCRS():
print 'Warning: Not all input layers use the same CRS.\n' \
+ 'This can cause unexpected results.'
ProcessingLog.addToLog(ProcessingLog.LOG_ALGORITHM, alg.getAsCommand())
# Don't set the wait cursor twice, because then when you
# restore it, it will still be a wait cursor.
cursor = QApplication.overrideCursor()
if cursor is None or cursor == 0:
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
elif cursor.shape() != Qt.WaitCursor:
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
progress = SilentProgress()
if interface.iface is not None :
progress = MessageBarProgress()
ret = UnthreadedAlgorithmExecutor.runalg(alg, progress)
if onFinish is not None and ret:
onFinish(alg, progress)
QApplication.restoreOverrideCursor()
progress.close()
return alg