From a36c696f9dbcadad53529b2161dd352164b0b777 Mon Sep 17 00:00:00 2001 From: sendiulo Date: Sat, 24 Aug 2013 09:21:59 +0200 Subject: [PATCH] Now the userlocale can be set manually in the keys.dat without being overwritten (e.g. for importing language files that aren't already in the main code). --- src/bitmessageqt/__init__.py | 12 ++++++++---- src/bitmessageqt/settings.py | 4 +++- src/bitmessageqt/settings.ui | 5 +++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 06010f7c..3e513295 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -2033,7 +2033,8 @@ class MyForm(QtGui.QMainWindow): self.settingsDialogInstance.ui.checkBoxWillinglySendToMobile.isChecked())) lang_ind = int(self.settingsDialogInstance.ui.languageComboBox.currentIndex()) - shared.config.set('bitmessagesettings', 'userlocale', languages[lang_ind]) + if not languages[lang_ind] == 'other': + shared.config.set('bitmessagesettings', 'userlocale', languages[lang_ind]) if int(shared.config.get('bitmessagesettings', 'port')) != int(self.settingsDialogInstance.ui.lineEditTCPPort.text()): if not shared.safeConfigGetBoolean('bitmessagesettings', 'dontconnect'): @@ -3047,10 +3048,13 @@ class settingsDialog(QtGui.QDialog): shared.safeConfigGetBoolean('bitmessagesettings', 'willinglysendtomobile')) global languages - languages = ['system','en','eo','fr','de','es','ru','en_pirate'] - + languages = ['system','en','eo','fr','de','es','ru','en_pirate','other'] user_countrycode = str(shared.config.get('bitmessagesettings', 'userlocale')) - self.ui.languageComboBox.setCurrentIndex(languages.index(user_countrycode)) + if user_countrycode in languages: + curr_index = languages.index(user_countrycode) + else: + curr_index = languages.index('other') + self.ui.languageComboBox.setCurrentIndex(curr_index) if shared.appdata == '': self.ui.checkBoxPortableMode.setChecked(True) diff --git a/src/bitmessageqt/settings.py b/src/bitmessageqt/settings.py index bd7d0240..ad597773 100644 --- a/src/bitmessageqt/settings.py +++ b/src/bitmessageqt/settings.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'settings.ui' # -# Created: Sat Aug 24 08:28:46 2013 +# Created: Sat Aug 24 09:19:58 2013 # by: PyQt4 UI code generator 4.10.2 # # WARNING! All changes made in this file will be lost! @@ -80,6 +80,7 @@ class Ui_settingsDialog(object): self.languageComboBox.addItem(_fromUtf8("")) self.languageComboBox.addItem(_fromUtf8("")) self.languageComboBox.addItem(_fromUtf8("")) + self.languageComboBox.addItem(_fromUtf8("")) self.horizontalLayout_2.addWidget(self.languageComboBox) self.gridLayout_5.addWidget(self.groupBox, 10, 1, 1, 1) self.tabWidgetSettings.addTab(self.tabUserInterface, _fromUtf8("")) @@ -351,6 +352,7 @@ class Ui_settingsDialog(object): self.languageComboBox.setItemText(5, _translate("settingsDialog", "Spanish", "es")) self.languageComboBox.setItemText(6, _translate("settingsDialog", "Russian", "ru")) self.languageComboBox.setItemText(7, _translate("settingsDialog", "Pirate English", "en_pirate")) + self.languageComboBox.setItemText(8, _translate("settingsDialog", "Other (set in keys.dat)", "other")) self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabUserInterface), _translate("settingsDialog", "User Interface", None)) self.groupBox1.setTitle(_translate("settingsDialog", "Listening port", None)) self.label.setText(_translate("settingsDialog", "Listen for connections on port:", None)) diff --git a/src/bitmessageqt/settings.ui b/src/bitmessageqt/settings.ui index abacd30f..eec38d8d 100644 --- a/src/bitmessageqt/settings.ui +++ b/src/bitmessageqt/settings.ui @@ -153,6 +153,11 @@ Pirate English + + + Other (set in keys.dat) + +