当前位置: 首页>>代码示例>>Python>>正文


Python QgsApplication.processingRegsitry方法代码示例

本文整理汇总了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('"', '\\"')))
开发者ID:timlinux,项目名称:QGIS,代码行数:53,代码来源:translation.py


注:本文中的qgis.core.QgsApplication.processingRegsitry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。