forked from openlp/openlp
You can now set the Language
This commit is contained in:
parent
f295ac5407
commit
b4156c809b
@ -276,10 +276,8 @@ def main():
|
||||
if QtCore.QSettings().value(
|
||||
u'general/first time', QtCore.QVariant(True)).toBool():
|
||||
FirstTimeForm().exec_()
|
||||
pass
|
||||
# i18n Set Language
|
||||
language = LanguageManager.get_language()
|
||||
print language
|
||||
appTranslator = LanguageManager.get_translator(language)
|
||||
app.installTranslator(appTranslator)
|
||||
if not options.no_error_form:
|
||||
|
@ -48,6 +48,9 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||
print self.webAccess
|
||||
QtGui.QWizard.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
QtCore.QObject.connect(self.autoLanguageCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onAutoLanguageClicked)
|
||||
#self.registerFields()
|
||||
|
||||
def exec_(self, edit=False):
|
||||
@ -62,15 +65,16 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||
Set up display at start of theme edit.
|
||||
"""
|
||||
self.restart()
|
||||
# Sort out internet access
|
||||
# Sort out internet access for downloads
|
||||
if self.webAccess:
|
||||
self.internetGroupBox.setVisible(True)
|
||||
self.noInternetLabel.setVisible(False)
|
||||
else:
|
||||
self.internetGroupBox.setVisible(False)
|
||||
self.noInternetLabel.setVisible(True)
|
||||
if LanguageManager.auto_language:
|
||||
self.LanguageComboBox.setEnabled(False)
|
||||
# Sort out Language settings
|
||||
self.autoLanguageCheckBox.setChecked(True)
|
||||
self.LanguageComboBox.setEnabled(False)
|
||||
self.qmList = LanguageManager.get_qm_list()
|
||||
for key in sorted(self.qmList.keys()):
|
||||
self.LanguageComboBox.addItem(key)
|
||||
@ -81,7 +85,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||
self.__pluginStatus(self.presentationCheckBox, u'presentations/status')
|
||||
self.__pluginStatus(self.imageCheckBox, u'images/status')
|
||||
self.__pluginStatus(self.mediaCheckBox, u'media/status')
|
||||
self.__pluginStatus(self.remoteCheckBox, u'remote/status')
|
||||
self.__pluginStatus(self.remoteCheckBox, u'remotes/status')
|
||||
self.__pluginStatus(self.customCheckBox, u'custom/status')
|
||||
self.__pluginStatus(self.songUsageCheckBox, u'songusage/status')
|
||||
self.__pluginStatus(self.alertCheckBox, u'alerts/status')
|
||||
@ -95,6 +99,12 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||
LanguageManager.set_language(action, False)
|
||||
return QtGui.QWizard.accept(self)
|
||||
|
||||
def onAutoLanguageClicked(self, state):
|
||||
if state == QtCore.Qt.Checked:
|
||||
self.LanguageComboBox.setEnabled(False)
|
||||
else:
|
||||
self.LanguageComboBox.setEnabled(True)
|
||||
|
||||
def __pluginStatus(self, field, tag):
|
||||
status = PluginStatus.Active if field.checkState() \
|
||||
== QtCore.Qt.Checked else PluginStatus.Inactive
|
||||
|
@ -112,12 +112,13 @@ class LanguageManager(object):
|
||||
language = u'en'
|
||||
if action:
|
||||
action_name = u'%s' % action.objectName()
|
||||
print action_name
|
||||
qm_list = LanguageManager.get_qm_list()
|
||||
language = u'%s' % qm_list[action_name]
|
||||
if LanguageManager.auto_language:
|
||||
language = u'[%s]' % language
|
||||
QtCore.QSettings().setValue(
|
||||
# This needs to be here for the setValue to work
|
||||
settings = QtCore.QSettings(u'OpenLP', u'OpenLP')
|
||||
settings.setValue(
|
||||
u'general/language', QtCore.QVariant(language))
|
||||
log.info(u'Language file: \'%s\' written to conf file' % language)
|
||||
if message:
|
||||
|
Loading…
Reference in New Issue
Block a user