← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/language-menu into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/language-menu into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/language-menu/+merge/52971

Change the "autodetect" item into a radio button and stop disabling the language items. This is a more sane and less irritating approach to selecting a language.
-- 
https://code.launchpad.net/~raoul-snyman/openlp/language-menu/+merge/52971
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2011-03-06 19:25:35 +0000
+++ openlp/core/ui/mainwindow.py	2011-03-11 05:58:53 +0000
@@ -232,7 +232,7 @@
         self.LanguageGroup = QtGui.QActionGroup(mainWindow)
         self.LanguageGroup.setExclusive(True)
         self.LanguageGroup.setObjectName(u'LanguageGroup')
-        self.LanguageGroup.setDisabled(LanguageManager.auto_language)
+        add_actions(self.LanguageGroup, [self.AutoLanguageItem])
         qmList = LanguageManager.get_qm_list()
         savedLanguage = LanguageManager.get_language()
         for key in sorted(qmList.keys()):
@@ -425,14 +425,14 @@
             translate('OpenLP.MainWindow', '&Online Help'))
         self.helpWebSiteItem.setText(
             translate('OpenLP.MainWindow', '&Web Site'))
-        self.AutoLanguageItem.setText(
-            translate('OpenLP.MainWindow', '&Auto Detect'))
-        self.AutoLanguageItem.setStatusTip(translate('OpenLP.MainWindow',
-            'Use the system language, if available.'))
         for item in self.LanguageGroup.actions():
             item.setText(item.objectName())
             item.setStatusTip(unicode(translate('OpenLP.MainWindow',
                 'Set the interface language to %s')) % item.objectName())
+        self.AutoLanguageItem.setText(
+            translate('OpenLP.MainWindow', '&Autodetect'))
+        self.AutoLanguageItem.setStatusTip(translate('OpenLP.MainWindow',
+            'Use the system language, if available.'))
         self.ToolsAddToolItem.setText(
             translate('OpenLP.MainWindow', 'Add &Tool...'))
         self.ToolsAddToolItem.setStatusTip(translate('OpenLP.MainWindow',
@@ -550,8 +550,6 @@
             QtCore.SIGNAL(u'triggered()'),
             self.ServiceManagerContents.printServiceOrder)
         # i18n set signals for languages
-        QtCore.QObject.connect(self.AutoLanguageItem,
-            QtCore.SIGNAL(u'toggled(bool)'), self.setAutoLanguage)
         self.LanguageGroup.triggered.connect(LanguageManager.set_language)
         QtCore.QObject.connect(self.ModeDefaultItem,
             QtCore.SIGNAL(u'triggered()'), self.onModeDefaultItemClicked)

=== modified file 'openlp/core/utils/languagemanager.py'
--- openlp/core/utils/languagemanager.py	2011-03-06 14:15:35 +0000
+++ openlp/core/utils/languagemanager.py	2011-03-11 05:58:53 +0000
@@ -112,9 +112,13 @@
         """
         language = u'en'
         if action:
-            action_name = u'%s' % action.objectName()
-            qm_list = LanguageManager.get_qm_list()
-            language = u'%s' % qm_list[action_name]
+            action_name = unicode(action.objectName())
+            if action_name == u'AutoLanguageItem':
+                LanguageManager.auto_language = True
+            else:
+                LanguageManager.auto_language = False
+                qm_list = LanguageManager.get_qm_list()
+                language = unicode(qm_list[action_name])
         if LanguageManager.auto_language:
             language = u'[%s]' % language
         # This needs to be here for the setValue to work


Follow ups