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


Python QCoreApplication.translate方法代码示例

本文整理汇总了Python中PyQt4.QtCore.QCoreApplication.translate方法的典型用法代码示例。如果您正苦于以下问题:Python QCoreApplication.translate方法的具体用法?Python QCoreApplication.translate怎么用?Python QCoreApplication.translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtCore.QCoreApplication的用法示例。


在下文中一共展示了QCoreApplication.translate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __getMasterPassword

# 需要导入模块: from PyQt4.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt4.QtCore.QCoreApplication import translate [as 别名]
def __getMasterPassword():
    """
    Private module function to get the password from the user.
    """
    global MasterPassword

    pw, ok = QInputDialog.getText(
        None,
        QCoreApplication.translate("Crypto", "Master Password"),
        QCoreApplication.translate("Crypto", "Enter the master password:"),
        QLineEdit.Password)
    if ok:
        from .py3PBKDF2 import verifyPassword
        masterPassword = Preferences.getUser("MasterPassword")
        try:
            if masterPassword:
                if verifyPassword(pw, masterPassword):
                    MasterPassword = pwEncode(pw)
                else:
                    E5MessageBox.warning(
                        None,
                        QCoreApplication.translate(
                            "Crypto", "Master Password"),
                        QCoreApplication.translate(
                            "Crypto",
                            """The given password is incorrect."""))
            else:
                E5MessageBox.critical(
                    None,
                    QCoreApplication.translate("Crypto", "Master Password"),
                    QCoreApplication.translate(
                        "Crypto",
                        """There is no master password registered."""))
        except ValueError as why:
            E5MessageBox.warning(
                None,
                QCoreApplication.translate("Crypto", "Master Password"),
                QCoreApplication.translate(
                    "Crypto",
                    """<p>The given password cannot be verified.</p>"""
                    """<p>Reason: {0}""".format(str(why)))) 
开发者ID:yuxiaokui,项目名称:Intranet-Penetration,代码行数:43,代码来源:__init__.py

示例2: tr

# 需要导入模块: from PyQt4.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt4.QtCore.QCoreApplication import translate [as 别名]
def tr(self, message):
        """[email protected] Get the translation for a string using Qt translation API.

        We implement this ourselves since we do not inherit QObject.

        :param message: String for translation.
        :type message: str, QString

        :returns: Translated version of message.
        :rtype: QString
        """
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('HistoricalMap', message) 
开发者ID:lennepkade,项目名称:HistoricalMap,代码行数:15,代码来源:historical_map.py

示例3: tr

# 需要导入模块: from PyQt4.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt4.QtCore.QCoreApplication import translate [as 别名]
def tr(self, message):
        """Get the translation for a string using Qt translation API.

        We implement this ourselves since we do not inherit QObject.

        :param message: String for translation.
        :type message: str, QString

        :returns: Translated version of message.
        :rtype: QString
        """
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('GeometryWrapper', message) 
开发者ID:MACBIO,项目名称:GeoWrap,代码行数:15,代码来源:geometry_wrapper.py

示例4: test_qgis_translations

# 需要导入模块: from PyQt4.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt4.QtCore.QCoreApplication import translate [as 别名]
def test_qgis_translations(self):
        """Test that translations work."""
        parent_path = os.path.join(__file__, os.path.pardir, os.path.pardir)
        dir_path = os.path.abspath(parent_path)
        file_path = os.path.join(
            dir_path, 'i18n', 'af.qm')
        translator = QTranslator()
        translator.load(file_path)
        QCoreApplication.installTranslator(translator)

        expected_message = 'Goeie more'
        real_message = QCoreApplication.translate("@default", 'Good morning')
        self.assertEqual(real_message, expected_message) 
开发者ID:MACBIO,项目名称:GeoWrap,代码行数:15,代码来源:test_translations.py

示例5: tr

# 需要导入模块: from PyQt4.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt4.QtCore.QCoreApplication import translate [as 别名]
def tr(self, message):
        """Get the translation for a string using Qt translation API.

        We implement this ourselves since we do not inherit QObject.

        :param message: String for translation.
        :type message: str, QString

        :returns: Translated version of message.
        :rtype: QString
        """
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('GoogleEarthEngine', message) 
开发者ID:gena,项目名称:qgis-earthengine-plugin,代码行数:15,代码来源:ee_plugin.py

示例6: tr

# 需要导入模块: from PyQt4.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt4.QtCore.QCoreApplication import translate [as 别名]
def tr(self, message):
        """Get the translation for a string using Qt translation API.

        We implement this ourselves since we do not inherit QObject.

        :param message: String for translation.
        :type message: str, QString

        :returns: Translated version of message.
        :rtype: QString
        """
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('SortNumber', message) 
开发者ID:ArMoraer,项目名称:QGISSortAndNumber,代码行数:15,代码来源:sort_number.py

示例7: tr

# 需要导入模块: from PyQt4.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt4.QtCore.QCoreApplication import translate [as 别名]
def tr(self, message):
        """Get the translation for a string using Qt translation API.

        We implement this ourselves since we do not inherit QObject.

        :param message: String for translation.
        :type message: str, QString

        :returns: Translated version of message.
        :rtype: QString
        """
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('isochrones', message) 
开发者ID:Samweli,项目名称:isochrones,代码行数:15,代码来源:isochrone.py

示例8: tr

# 需要导入模块: from PyQt4.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt4.QtCore.QCoreApplication import translate [as 别名]
def tr(text):
    """
    :param text: String to be translated
    :type text: str, unicode

    :returns: Translated version of the given string if available, otherwise
        the original string.
    :rtype: str, unicode
    """
    # Ensure it's in unicode
    text = get_unicode(text)
    # noinspection PyCallByClass,PyTypeChecker,PyArgumentList
    return QCoreApplication.translate('@default', text) 
开发者ID:Samweli,项目名称:isochrones,代码行数:15,代码来源:i18n.py

示例9: tr

# 需要导入模块: from PyQt4.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt4.QtCore.QCoreApplication import translate [as 别名]
def tr(self, message):
        """Get the translation for a string using Qt translation API.

        We implement this ourselves since we do not inherit QObject.

        :param message: String for translation.
        :type message: str, QString

        :returns: Translated version of message.
        :rtype: QString
        """
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('ElevationPluginDialogBase', message) 
开发者ID:bopen,项目名称:qgis-elevation-plugin,代码行数:15,代码来源:qgis_elevation_plugin.py

示例10: tr

# 需要导入模块: from PyQt4.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt4.QtCore.QCoreApplication import translate [as 别名]
def tr(self, message):
        """Get the translation for a string using Qt translation API.

        We implement this ourselves since we do not inherit QObject.

        :param message: String for translation.
        :type message: str, QString

        :returns: Translated version of message.
        :rtype: QString
        """
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('HotspotAnalysis', message) 
开发者ID:stanly3690,项目名称:HotSpotAnalysis_Plugin,代码行数:15,代码来源:hotspot_analysis.py

示例11: tr

# 需要导入模块: from PyQt4.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt4.QtCore.QCoreApplication import translate [as 别名]
def tr(self, message):
        """Get the translation for a string using Qt translation API.

        We implement this ourselves since we do not inherit QObject.

        :param message: String for translation.
        :type message: str, QString

        :returns: Translated version of message.
        :rtype: QString
        """
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('MapzenIsochrones', message) 
开发者ID:spatialmonk,项目名称:qgsMapzenIsochrones,代码行数:15,代码来源:mapzen_isochrones.py

示例12: tr

# 需要导入模块: from PyQt4.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt4.QtCore.QCoreApplication import translate [as 别名]
def tr(self, message):
        """Get the translation for a string using Qt translation API.

        We implement this ourselves since we do not inherit QObject.

        :param message: String for translation.
        :type message: str, QString

        :returns: Translated version of message.
        :rtype: QString
        """
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('mapillary', message) 
开发者ID:geodrinx,项目名称:mapillary,代码行数:15,代码来源:mapillary.py

示例13: tr

# 需要导入模块: from PyQt4.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt4.QtCore.QCoreApplication import translate [as 别名]
def tr(self, message):
        """Get the translation for a string using Qt translation API.

        We implement this ourselves since we do not inherit QObject.

        :param message: String for translation.
        :type message: str, QString

        :returns: Translated version of message.
        :rtype: QString
        """
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('DataLoader', message) 
开发者ID:OpenDataHack,项目名称:qgis-ecmwf-catalogue-plugin,代码行数:15,代码来源:Main.py

示例14: tr

# 需要导入模块: from PyQt4.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt4.QtCore.QCoreApplication import translate [as 别名]
def tr(self, message):
        """Get the translation for a string using Qt translation API.

        We implement this ourselves since we do not inherit QObject.

        :param message: String for translation.
        :type message: str, QString

        :returns: Translated version of message.
        :rtype: QString
        """
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('QgsResourceSharing', message) 
开发者ID:akbargumbira,项目名称:qgis_resources_sharing,代码行数:15,代码来源:plugin.py

示例15: tr

# 需要导入模块: from PyQt4.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt4.QtCore.QCoreApplication import translate [as 别名]
def tr(self, message):
        # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
        return QCoreApplication.translate('GkukanMusiumdb', message) 
开发者ID:matsu-reki,项目名称:GkukanMusiumdb,代码行数:5,代码来源:gkukanmusiumdb.py


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