本文整理汇总了Python中PyQt5.QtCore.QCoreApplication.translate方法的典型用法代码示例。如果您正苦于以下问题:Python QCoreApplication.translate方法的具体用法?Python QCoreApplication.translate怎么用?Python QCoreApplication.translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.QCoreApplication
的用法示例。
在下文中一共展示了QCoreApplication.translate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: resumePushButtonPressed
# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import translate [as 别名]
def resumePushButtonPressed(self, button):
if self.status == "paused":
answer = download.downloadUnpause(self.gid)
# if aria2 did not respond , then this function is checking for aria2
# availability , and if aria2 disconnected then aria2Disconnected is
# executed
if not(answer):
version_answer = download.aria2Version()
if version_answer == 'did not respond':
self.parent.aria2Disconnected()
notifySend(QCoreApplication.translate("progress_src_ui_tr", "Aria2 disconnected!"), QCoreApplication.translate("progress_src_ui_tr", "Persepolis is trying to connect! be patient!"),
10000, 'warning', parent=self.parent)
else:
notifySend(QCoreApplication.translate("progress_src_ui_tr", "Aria2 did not respond!"), QCoreApplication.translate("progress_src_ui_tr", "Please try again."), 10000,
'warning', parent=self.parent)
示例2: stopLoss
# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import translate [as 别名]
def stopLoss(self):
logging.debug('BinanceOrder::stopLoss() called')
self.stop_loss_input = QWidget()
self.stop_loss_layout = QVBoxLayout(self.stop_loss_input)
self.stop_loss_price_txt = QLabel()
self.stop_loss_price_txt.setText(QC.translate('', 'Stop price:'))
self.stop_loss_price_input = QLineEdit()
self.stop_loss_price_input.setValidator(QDoubleValidator(999999, -999999, 8))
self.stop_loss_params = QLabel()
self.stop_loss_params.setText(
'{\'stopPrice\' : 12.345, \'quantity\' : 0.005}')
self.stop_loss_layout.addWidget(self.stop_loss_price_txt)
self.stop_loss_layout.addWidget(self.stop_loss_price_input)
self.stop_loss_layout.addWidget(self.stop_loss_params)
self.stop_loss_layout.addStretch(1)
self.order_box.addWidget(self.stop_loss_input)
示例3: maInput
# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import translate [as 别名]
def maInput(self):
self.ma_input = QWidget()
self.ma_layout = QHBoxLayout(self.ma_input)
self.ma_range_txt = QLabel()
self.ma_range_txt.setText(QC.translate('', 'Enter time range MA'))
self.ma_range_input = QLineEdit()
self.ma_range_input.setValidator(QIntValidator(1, 999))
self.ma_range_input.setPlaceholderText(QC.translate('', 'Default value: 3'))
self.ma_layout.addWidget(self.ma_range_txt)
self.ma_layout.addWidget(self.ma_range_input)
self.variable_box.addWidget(self.ma_input)
示例4: pausePushButtonPressed
# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import translate [as 别名]
def pausePushButtonPressed(self, button):
if self.status == "downloading":
answer = download.downloadPause(self.gid)
# if aria2 did not respond , then this function is checking for aria2
# availability , and if aria2 disconnected then aria2Disconnected is
# executed
if not(answer):
version_answer = download.aria2Version()
if version_answer == 'did not respond':
self.parent.aria2Disconnected()
download.downloadStop(self.gid, self.parent)
notifySend("Aria2 disconnected!", "Persepolis is trying to connect! be patient!",
10000, 'warning', parent=self.parent)
else:
notifySend(QCoreApplication.translate("progress_src_ui_tr", "Aria2 did not respond!"), QCoreApplication.translate("progress_src_ui_tr", "Try again!"), 10000,
'critical', parent=self.parent)
示例5: stopPushButtonPressed
# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import translate [as 别名]
def stopPushButtonPressed(self, button):
# cancel shut down progress
dictionary = {'category': self.video_finder_plus_gid,
'shutdown': 'canceled'}
self.parent.temp_db.updateQueueTable(dictionary)
answer = download.downloadStop(self.gid, self.parent)
# if aria2 did not respond , then this function is checking for aria2
# availability , and if aria2 disconnected then aria2Disconnected is
# executed
if answer == 'None':
version_answer = download.aria2Version()
if version_answer == 'did not respond':
self.parent.aria2Disconnected()
notifySend(QCoreApplication.translate("progress_src_ui_tr", "Aria2 disconnected!"), QCoreApplication.translate("progress_src_ui_tr", "Persepolis is trying to connect! be patient!"),
10000, 'warning', parent=self.parent)
示例6: remove
# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import translate [as 别名]
def remove(self):
self.status.setText('')
if self.listWidget.count() == 1:
self.status.setText(
QCoreApplication.translate(
'Message when trying to remove the'
'last and unique city in the list',
'This is the default city!',
'Cities list dialogue'
)
)
return
row = self.listWidget.currentRow()
item = self.listWidget.item(row)
if item is None:
return
message = self.tr('The city "{0}" has been removed').format(
self.listWidget.item(row).text())
item = self.listWidget.takeItem(row)
del item
self.status.setText(message)
示例7: takeProfit
# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import translate [as 别名]
def takeProfit(self):
logging.debug('BinanceOrder::takeProfit() called')
self.take_profit_input = QWidget()
self.take_profit_layout = QVBoxLayout(self.take_profit_input)
self.take_profit_stop_price = QLabel()
self.take_profit_stop_price.setText(QC.translate('', 'Stop price:'))
self.take_profit_stop_price_input = QLineEdit()
self.take_profit_stop_price_input.setValidator(QDoubleValidator(999999, -999999, 8))
self.take_profit_params = QLabel()
self.take_profit_params.setText(
'{\'stopPrice\': 12.345, \'quantity\' : 0.005}')
self.take_profit_layout.addWidget(self.take_profit_stop_price)
self.take_profit_layout.addWidget(self.take_profit_stop_price_input)
self.take_profit_layout.addWidget(self.take_profit_params)
self.take_profit_layout.addStretch(1)
self.order_box.addWidget(self.take_profit_input)
示例8: stoInput
# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import translate [as 别名]
def stoInput(self):
self.sto_input = QWidget()
self.sto_layout = QHBoxLayout(self.sto_input)
self.sto_range_txt = QLabel()
self.sto_range_txt.setText(QC.translate('', 'Enter MA period'))
self.sto_range_input = QLineEdit()
self.sto_range_input.setValidator(QIntValidator(1, 999))
self.sto_range_input.setPlaceholderText(QC.translate('', 'Default value: 3'))
self.sto_layout.addWidget(self.sto_range_txt)
self.sto_layout.addWidget(self.sto_range_input)
self.variable_box.addWidget(self.sto_input)
示例9: rsiInput
# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import translate [as 别名]
def rsiInput(self):
self.rsi_input = QWidget()
self.rsi_layout = QHBoxLayout(self.rsi_input)
self.rsi_range_txt = QLabel()
self.rsi_range_txt.setText(QC.translate('', 'Enter periods'))
self.rsi_range_input = QLineEdit()
self.rsi_range_input.setValidator(QIntValidator(1, 999))
self.rsi_range_input.setPlaceholderText(QC.translate('', 'Default value: 3'))
self.rsi_layout.addWidget(self.rsi_range_txt)
self.rsi_layout.addWidget(self.rsi_range_input)
self.variable_box.addWidget(self.rsi_input)
示例10: at_time
# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import translate [as 别名]
def at_time(self):
logging.debug('at_time() called')
self.at_time_input = QWidget()
self.at_time_layout = QVBoxLayout(self.at_time_input)
self.time_text = QLabel()
self.time_text.setText(QC.translate('', 'At:'))
self.time_input = QLineEdit()
regexp_validator = QRegExp('^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$')
self.time_validator = QRegExpValidator(regexp_validator)
self.time_input.setValidator(self.time_validator)
self.time_input.setPlaceholderText(QC.translate('', 'hh:mm'))
self.at_time_layout.addWidget(self.time_text)
self.at_time_layout.addWidget(self.time_input)
self.at_time_input.hide()
self.options_box_layout.addWidget(self.at_time_input)
示例11: full_interval
# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import translate [as 别名]
def full_interval(self):
logging.debug('full_interval() called')
self.full_interval_input = QWidget()
self.full_interval_layout = QVBoxLayout(self.full_interval_input)
self.description_1 = QLabel()
self.description_1.setText(QC.translate('', 'For instance a 15 minute interval executes every full'))
self.description_2 = QLabel()
self.description_2.setText(QC.translate('', '15 minutes: 10:00, 10:15, 10:30, 10:45, ...'))
self.full_interval_layout.addWidget(self.description_1)
self.full_interval_layout.addWidget(self.description_2)
self.full_interval_input.hide()
self.options_box_layout.addWidget(self.full_interval_input)
示例12: edit
# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import translate [as 别名]
def edit(self):
logging.debug('edit() called ExecBranch')
self.procEditLayout = QVBoxLayout()
self.procEdit = ElementEditor(self)
self.procEdit.setWindowTitle(QC.translate('', 'Edit Process Branch'))
self.help_text = QLabel()
self.help_text.setText(QC.translate('', 'Multiprocessing: Start a new execution path.'))
self.procEditLayout.addWidget(self.help_text)
self.procEditLayout.addStretch(1)
self.procEdit.setLayout(self.procEditLayout)
self.procEdit.show()
示例13: loadGrid
# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.QtCore.QCoreApplication import translate [as 别名]
def loadGrid(self, filename):
logging.debug('MainWindow::loadGrid() called')
grid_data_list = []
try:
with ZipFile(filename, 'r') as archive:
for zipped_grid in archive.namelist():
pickled_grid = archive.read(zipped_grid)
element_list = pickle.loads(pickled_grid)
# first char repesents the grid number
self.wrk_area_arr[int(zipped_grid[0])].loadGrid(pickle.loads(pickled_grid))
archive.close()
except Exception as e:
err_msg = QMessageBox()
err_msg.setIcon(QMessageBox.Critical)
err_msg.setWindowTitle(QC.translate('', 'File Error'))
err_msg.setText(QC.translate('', 'File can\'t be read'))
err_msg.setAttribute(Qt.WA_DeleteOnClose)
err_msg.exec()
示例14: tr
# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.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('RasterVisionPlugin', message)
示例15: test_qgis_translations
# 需要导入模块: from PyQt5.QtCore import QCoreApplication [as 别名]
# 或者: from PyQt5.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)