本文整理汇总了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))))
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)