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