本文整理汇总了Python中PySide.QtUiTools.QUiLoader.setLanguageChangeEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python QUiLoader.setLanguageChangeEnabled方法的具体用法?Python QUiLoader.setLanguageChangeEnabled怎么用?Python QUiLoader.setLanguageChangeEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtUiTools.QUiLoader
的用法示例。
在下文中一共展示了QUiLoader.setLanguageChangeEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PySide.QtUiTools import QUiLoader [as 别名]
# 或者: from PySide.QtUiTools.QUiLoader import setLanguageChangeEnabled [as 别名]
def __init__(self, app, settings):
super(Window, self).__init__()
self.app = app
self.settings = settings
self.settings.changed.connect(self.refreshGui)
if "gui-language" in settings:
locale = settings["gui-language"]
else:
locale = DEFAULT_LOCALE
self.translator = QTranslator()
self.translator.load(os.path.join(current_dir, "locales", locale))
app.installTranslator(self.translator)
loader = QUiLoader()
loader.setLanguageChangeEnabled(True)
self.win = loader.load(os.path.join(current_dir, "controller.ui"), self)
QMetaObject.connectSlotsByName(self)
# Define GUI items
self.inputCombo = self.win.findChild(QComboBox, "inputMethodComboBox")
self.charsetCombo = self.win.findChild(QComboBox, "charsetComboBox")
self.skipNonVNCheckBox = self.win.findChild(QCheckBox, "skipNonVNCheckBox")
self.guiLanguageComboBox = self.win.findChild(QComboBox, "guiLanguageComboBox")
self.sourceCharsetCombo = self.win.findChild(QComboBox, "sourceCharsetCombo")
# Set their initial values
for i in range(len(inputMethodList)):
self.inputCombo.insertItem(i, inputMethodList[i])
for i in range(len(charsetList)):
self.charsetCombo.insertItem(i, charsetList[i])
if charsetList[i] != "utf-8":
self.sourceCharsetCombo.insertItem(i, charsetList[i].upper())
self.setupLanguages()
self.refreshGui()
box = QVBoxLayout()
box.addWidget(self.win)
self.setLayout(box)