本文整理汇总了Python中qgis.core.QgsApplication.processingRegsitry方法的典型用法代码示例。如果您正苦于以下问题:Python QgsApplication.processingRegsitry方法的具体用法?Python QgsApplication.processingRegsitry怎么用?Python QgsApplication.processingRegsitry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qgis.core.QgsApplication
的用法示例。
在下文中一共展示了QgsApplication.processingRegsitry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: updateTranslations
# 需要导入模块: from qgis.core import QgsApplication [as 别名]
# 或者: from qgis.core.QgsApplication import processingRegsitry [as 别名]
def updateTranslations():
"""Update processing.algs.translations module.
Need QGIS python API on python path, can be run from QGIS console. Example:
from processing.tools.translation import updateTranslations
updateTranslations()
"""
loadClassification()
with open(os.path.join(os.path.dirname(__file__), '../algs/translations.py'), 'w') as f:
f.write('''# -*- coding: utf-8 -*-
"""
Don't edit this file manually.
Update it from QGIS console:
from processing.tools.translation import updateTranslations
updateTranslations()
"""
from qgis.PyQt.QtCore import QCoreApplication
def translationShadow():
''')
groups = {}
for provider in QgsApplication.processingRegsitry().providers():
f.write('''
"""{}"""
'''.format(provider.__class__.__name__))
for alg in provider.algorithms():
display_name = alg.name()
f.write(" QCoreApplication.translate(\"{}\", \"{}\")\n"
.format(alg.__class__.__name__,
display_name.replace('"', '\\"')))
if alg.group() not in groups:
groups[alg.group()] = 'AlgorithmClassification'
group, subgroup = getClassificationEn(alg)
if group is not None and group not in groups:
groups[group] = 'AlgorithmClassification'
if subgroup is not None and subgroup not in groups:
groups[subgroup] = 'AlgorithmClassification'
f.write('''
"""Groups and subgroups"""
''')
for group, context in list(groups.items()):
f.write(" QCoreApplication.translate(\"{}\", \"{}\")\n"
.format(context,
group.replace('"', '\\"')))