本文整理汇总了Python中pygobstones.commons.i18n函数的典型用法代码示例。如果您正苦于以下问题:Python i18n函数的具体用法?Python i18n怎么用?Python i18n使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了i18n函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: openSelectBoardSizeWindow
def openSelectBoardSizeWindow(self, function, title):
self.widgetSize = QtGui.QDialog(self)
self.widgetSize.setWindowTitle(i18n(title))
self.widgetSize.setGeometry(500, 300, 180, 180)
self.widgetSize.setMaximumSize(280, 200)
self.setStyleSheet("background-color:'white'")
widthL = QtGui.QLabel(self.widgetSize)
widthL.setText(i18n('input') + ' x')
widthL.move(20, 20)
self.widthLE = QtGui.QLineEdit(self.widgetSize)
self.widthLE.setGeometry(20, 45, 80, 30)
heightL = QtGui.QLabel(self.widgetSize)
heightL.setText(i18n('input')+ ' y')
heightL.move(20, 70)
self.heightLE = QtGui.QLineEdit(self.widgetSize)
self.heightLE.setGeometry(20, 95, 80, 30)
hLayout = QtGui.QHBoxLayout()
hLayout.addStretch(1)
acceptButton = QtGui.QPushButton(i18n('Accept'))
acceptButton.clicked.connect(function)
hLayout.addWidget(acceptButton)
vLayout = QtGui.QVBoxLayout()
vLayout.addStretch(1)
vLayout.addLayout(hLayout)
self.widgetSize.setLayout(vLayout)
self.widgetSize.exec_()
示例2: success
def success(self, board_string, result):
if not self.interactiveRunning:
if not self.wasStoped:
self.mainW.ui.statusbar.showMessage(QtCore.QString
(i18n('Execution completed')))
self.results = Results(self.mainW)
board = self.prepareString(board_string)
self.results.setInitialBoard(BoardViewer(self,
self.mainW.initialBoardGenerator.board, self.mainW.getClothing()))
self.results.setFinalBoard(BoardViewer(self,
parseABoardString(board), self.mainW.getClothing()))
self.results.setRetVars(result)
self.setCodeInResults()
self.results.ui.tabWidgetResults.setCurrentIndex(2)
self.results.show()
self.mainW.resetButtonsRunAndStop()
self.showInLog(i18n('Execution completed'))
self.log('----------------'+
unicode(datetime.datetime.now())[:19] +
'-----------------\n')
else:
self.mainW.ui.statusbar.showMessage(QtCore.QString
(i18n('Execution completed')))
self.showInLog(i18n('Execution completed'))
self.log('----------------'+
unicode(datetime.datetime.now())[:19] +
'-----------------\n')
self.interactiveW.setStatusMessage(' ' + i18n('Execution completed'))
self.mainW.resetButtonsRunAndStop()
self.wasStoped = False
self.isOpenInteractiveW = False
self.interactiveRunning = False
示例3: checkWasChangesInFiles
def checkWasChangesInFiles(self):
if self.mainW.ui.textEditFile.document().isModified():
val = QMessageBox.question(
self.mainW,
i18n("Save changes?"),
i18n("The file %s was changed, Do you save changes?") % (self.mainW.ui.tabWidgetEditors.tabText(0)[3:]),
QMessageBox.Yes,
QMessageBox.No,
QMessageBox.Cancel,
)
if val == QMessageBox.Yes:
if not self.saveFile():
return QMessageBox.Cancel
if self.mainW.ui.textEditLibrary.document().isModified():
val = QMessageBox.question(
self.mainW,
i18n("Save changes?"),
i18n("The file %s was changed, Do you save changes?") % (self.mainW.ui.tabWidgetEditors.tabText(1)[3:]),
QMessageBox.Yes,
QMessageBox.No,
QMessageBox.Cancel,
)
if val == QMessageBox.Yes:
if not self.saveFile():
return QMessageBox.Cancel
return val
示例4: interpreter_log_default_exception
def interpreter_log_default_exception(self, exception):
if not self.wasStoped:
self.mainW.ui.statusbar.showMessage(QtCore.QString
(i18n('Was occurred an error')))
self.showInLog(i18n('Was occurred an error'))
self.log(exception.msg)
self.mainW.resetButtonsRunAndStop()
示例5: fail_handler
def fail_handler(exception):
self.mainW.ui.statusbar.showMessage(QtCore.QString(i18n('Check failed')))
self.showInLog(i18n('Check failed:'))
self.showRowAndColError(exception)
self.log(exception.msg)
self.log('----------------' +
unicode(datetime.datetime.now())[:19] +
'-----------------\n')
示例6: stop
def stop(self):
self.guiInterpreterHandler.initialStatus()
self.runButton.stopInterpreter()
self.resetButtonsRunAndStop()
self.ui.statusbar.showMessage(QtCore.QString
(i18n('Execution interrupted by the user')))
self.guiInterpreterHandler.showInLog(i18n(
'Execution interrupted by the user'))
self.guiInterpreterHandler.log('----------------' +
unicode(datetime.datetime.now())[:19] +
'-----------------')
示例7: check
def check(self):
self.ui.actionStop.setEnabled(True)
self.ui.actionCheck.setEnabled(False)
self.ui.actionRun.setEnabled(False)
self.guiInterpreterHandler.showInLog(i18n(
'Start check || Languaje: ') + self.lang)
self.guiInterpreterHandler.log('----------------' +
unicode(datetime.datetime.now())[:19] +
'-----------------')
self.ui.statusbar.showMessage(QtCore.QString(i18n('Checking...')))
self.checkButton = CheckButton(self)
self.checkButton.start()
示例8: retranslateUi
def retranslateUi(self, results):
results.setWindowTitle(QtGui.QApplication.translate("results", i18n('Mode Results'), None, QtGui.QApplication.UnicodeUTF8))
self.pushButtonSaveResults.setToolTip(QtGui.QApplication.translate("results", i18n('Save in file the final board'), None, QtGui.QApplication.UnicodeUTF8))
self.pushButtonSaveResults.setText(QtGui.QApplication.translate("results", i18n('Save Final Board'), None, QtGui.QApplication.UnicodeUTF8))
self.pushButtonSwitchViews.setToolTip(QtGui.QApplication.translate("switchViews", i18n('Switch between Gobstones Standard view and selected custom view'), None, QtGui.QApplication.UnicodeUTF8))
self.pushButtonSwitchViews.setText(QtGui.QApplication.translate("switchViews", i18n('Switch Views'), None, QtGui.QApplication.UnicodeUTF8))
#self.tabWidgetResults.setTabText(self.tabWidgetResults.indexOf(self.tabInitialBoard), QtGui.QApplication.translate("results", i18n('Initial Board'), None, QtGui.QApplication.UnicodeUTF8))
#self.tabWidgetResults.setTabText(self.tabWidgetResults.indexOf(self.tabFinalBoard), QtGui.QApplication.translate("results", i18n('Final Board'), None, QtGui.QApplication.UnicodeUTF8))
self.tabWidgetResults.setTabText(self.tabWidgetResults.indexOf(self.splitter), QtGui.QApplication.translate("results", i18n('Source Code'), None, QtGui.QApplication.UnicodeUTF8))
self.labelResults.setText(QtGui.QApplication.translate("results", i18n('Results'), None, QtGui.QApplication.UnicodeUTF8))
self.labelViews.setText(QtGui.QApplication.translate("results", i18n('Select View'), None, QtGui.QApplication.UnicodeUTF8))
示例9: closeApp
def closeApp(self, event):
if self.mainW.ui.textEditFile.document().isModified() or self.mainW.ui.textEditLibrary.document().isModified():
val = QMessageBox.question(
self.mainW,
i18n("Save changes?"),
i18n("There are unsaved files, you want to close the application?"),
QMessageBox.Yes,
QMessageBox.No,
)
if val == QMessageBox.Yes:
event.accept()
else:
event.ignore()
示例10: setFinalBoard
def setFinalBoard(self, boardV):
boardV.setParent(self.ui.tabWidgetResults)
self.ui.tabWidgetResults.insertTab(2,boardV,i18n('Final Board'))
if not boardV.is_board_error():
self.finalBoard = boardV.getBoard()
else:
self.ui.pushButtonSaveResults.setVisible(False)
示例11: makeRelationshipBetweenSizeAndHead
def makeRelationshipBetweenSizeAndHead(self, s):
if(s == 'dimensions random'):
self.ui.comboBox_3.clear()
self.ui.comboBox_3.addItem(i18n('head random'))
if(s == 'enter dimensions' or s == 'current conservation dimensions'):
self.ui.comboBox_3.clear()
self.initCombo3HeadPosition()
self.ui.comboBox_3.update()
示例12: acceptBoardSize
def acceptBoardSize(self):
y = self.heightLE.text()
x = self.widthLE.text()
if (self.isValidInt(x, 1) and self.isValidInt(y, 1)):
self.setBoardSize(int(self.widthLE.text()), int(self.heightLE.text()))
self.widgetSize.close()
else:
ErrorWindow(i18n("You must enter integers greater than zero!"))
示例13: makeRelationshipBetweenHeadAndSize
def makeRelationshipBetweenHeadAndSize(self, s):
if(s == 'enter coordinate' or s == 'current conservation coordinate'):
self.ui.comboBox_2.clear()
self.ui.comboBox_2.addItem(i18n('current conservation dimensions'))
if(s == 'head random'):
self.ui.comboBox_2.clear()
self.initCombo2SizeDimensions()
self.ui.comboBox_2.update()
示例14: run
def run(self):
self.ui.logger.clear()
if MainWindow.getPreference('logger') == False:
self.setPreference('logger', True)
self.initLoggerSize()
self.guiInterpreterHandler.wasStoped = False
self.guiInterpreterHandler.showInLog(i18n(
'Start execution || Languaje: ') + self.lang)
self.guiInterpreterHandler.log('----------------' +
unicode(datetime.datetime.now())[:19] +
'-----------------')
self.ui.logger.show()
self.ui.actionStop.setEnabled(True)
self.ui.actionCheck.setEnabled(False)
self.ui.statusbar.showMessage(QtCore.QString(i18n('Processing...')))
self.programRun.handler = self.guiInterpreterHandler
self.runButton.start(self.programRun)
示例15: acceptHeadPosition
def acceptHeadPosition(self):
y = self.heightLE.text()
x = self.widthLE.text()
if (self.isValidIntAndPosition(x,y)):
self.initialBoardGenerator.setHead(int(x), int(y))
self.widgetSize.close()
else:
ErrorWindow(i18n("You must enter integers less or equal than ({0},{1})").
format(self.initialBoardGenerator.board.getX()-1,self.initialBoardGenerator.board.getY()-1))