diff --git a/osx.sh b/osx.sh old mode 100644 new mode 100755 index e5d2e371..2f59f446 --- a/osx.sh +++ b/osx.sh @@ -12,12 +12,12 @@ if [[ -z "$1" ]]; then exit fi -echo "Creating OS X packages for Bitmessage. This script will ask for sudo to create the dmg volume" +echo "Creating OS X packages for Bitmessage." cd src && python build_osx.py py2app if [[ $? = "0" ]]; then - sudo hdiutil create -fs HFS+ -volname "Bitmessage" -srcfolder dist/Bitmessage.app dist/bitmessage-v$1.dmg + hdiutil create -fs HFS+ -volname "Bitmessage" -srcfolder dist/Bitmessage.app dist/bitmessage-v$1.dmg else echo "Problem creating Bitmessage.app, stopping." exit diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index f21f4ecc..94a6ff37 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -1943,20 +1943,30 @@ class MyForm(QtGui.QMainWindow): self.settingsDialogInstance.ui.checkBoxStartInTray.isChecked())) shared.config.set('bitmessagesettings', 'willinglysendtomobile', str( self.settingsDialogInstance.ui.checkBoxWillinglySendToMobile.isChecked())) + + lang_ind = int(self.settingsDialogInstance.ui.languageComboBox.currentIndex()) + 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'): QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate( "MainWindow", "You must restart Bitmessage for the port number change to take effect.")) shared.config.set('bitmessagesettings', 'port', str( self.settingsDialogInstance.ui.lineEditTCPPort.text())) - if shared.config.get('bitmessagesettings', 'socksproxytype') == 'none' and str(self.settingsDialogInstance.ui.comboBoxProxyType.currentText())[0:5] == 'SOCKS': + #print 'self.settingsDialogInstance.ui.comboBoxProxyType.currentText()', self.settingsDialogInstance.ui.comboBoxProxyType.currentText() + #print 'self.settingsDialogInstance.ui.comboBoxProxyType.currentText())[0:5]', self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] + if shared.config.get('bitmessagesettings', 'socksproxytype') == 'none' and self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] == 'SOCKS': if shared.statusIconColor != 'red': QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate( "MainWindow", "Bitmessage will use your proxy from now on but you may want to manually restart Bitmessage now to close existing connections (if any).")) - if shared.config.get('bitmessagesettings', 'socksproxytype')[0:5] == 'SOCKS' and str(self.settingsDialogInstance.ui.comboBoxProxyType.currentText()) == 'none': + if shared.config.get('bitmessagesettings', 'socksproxytype')[0:5] == 'SOCKS' and self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] != 'SOCKS': self.statusBar().showMessage('') - shared.config.set('bitmessagesettings', 'socksproxytype', str( - self.settingsDialogInstance.ui.comboBoxProxyType.currentText())) + if self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] == 'SOCKS': + shared.config.set('bitmessagesettings', 'socksproxytype', str( + self.settingsDialogInstance.ui.comboBoxProxyType.currentText())) + else: + shared.config.set('bitmessagesettings', 'socksproxytype', 'none') shared.config.set('bitmessagesettings', 'socksauthentication', str( self.settingsDialogInstance.ui.checkBoxAuthentication.isChecked())) shared.config.set('bitmessagesettings', 'sockshostname', str( @@ -2827,6 +2837,16 @@ class settingsDialog(QtGui.QDialog): shared.config.getboolean('bitmessagesettings', 'startintray')) self.ui.checkBoxWillinglySendToMobile.setChecked( shared.safeConfigGetBoolean('bitmessagesettings', 'willinglysendtomobile')) + + global languages + languages = ['system','en','eo','fr','de','es','ru','en_pirate','other'] + user_countrycode = str(shared.config.get('bitmessagesettings', 'userlocale')) + 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) if 'darwin' in sys.platform: @@ -3167,25 +3187,50 @@ class UISignaler(QThread): def run(): app = QtGui.QApplication(sys.argv) translator = QtCore.QTranslator() - - lang_countrycode = str(locale.getdefaultlocale()[0]) - translation = "translations/bitmessage_" + lang_countrycode - if not os.path.isfile(translation + ".pro"): - # Don't have fully localized translation, try language only - lang = lang_countrycode[0:2] - translation = "translations/bitmessage_" + lang - - if not os.path.isfile(translation + ".pro"): - # Don't have language either, default to 'Merica USA! USA! - translation = "translations/bitmessage_en_US" - try: - translator.load(translation) - #translator.load("translations/bitmessage_fr_BE") # test French + locale_countrycode = str(locale.getdefaultlocale()[0]) except: # The above is not compatible with all versions of OSX. - translator.load("translations/bitmessage_en_US") # Default to english. + locale_countrycode = "en_US" # Default to english. + locale_lang = locale_countrycode[0:2] + user_countrycode = str(shared.config.get('bitmessagesettings', 'userlocale')) + user_lang = user_countrycode[0:2] + translation_path = "translations/bitmessage_" + + if shared.config.get('bitmessagesettings', 'userlocale') == 'system': + # try to detect the users locale otherwise fallback to English + try: + # try the users full locale, e.g. 'en_US': + # since we usually only provide languages, not localozations + # this will usually fail + translator.load(translation_path + locale_countrycode) + except: + try: + # try the users locale language, e.g. 'en': + # since we usually only provide languages, not localozations + # this will usually succeed + translator.load(translation_path + locale_lang) + except: + # as English is already the default language, we don't + # need to do anything. No need to translate. + pass + else: + try: + # check if the user input is a valid translation file: + # since user_countrycode will be usually set by the combobox + # it will usually just be a language code + translator.load(translation_path + user_countrycode) + except: + try: + # check if the user lang is a valid translation file: + # this is only needed if the user manually set his 'userlocale' + # in the keys.dat to a countrycode (e.g. 'de_CH') + translator.load(translation_path + user_lang) + except: + # as English is already the default language, we don't + # need to do anything. No need to translate. + pass QtGui.QApplication.installTranslator(translator) app.setStyleSheet("QStatusBar::item { border: 0px solid black }") diff --git a/src/bitmessageqt/bitmessageui.py b/src/bitmessageqt/bitmessageui.py index c051c076..74505f38 100644 --- a/src/bitmessageqt/bitmessageui.py +++ b/src/bitmessageqt/bitmessageui.py @@ -2,8 +2,8 @@ # Form implementation generated from reading ui file 'bitmessageui.ui' # -# Created: Mon Aug 12 00:08:20 2013 -# by: PyQt4 UI code generator 4.10.2 +# Created: Thu Aug 15 14:19:52 2013 +# by: PyQt4 UI code generator 4.10 # # WARNING! All changes made in this file will be lost! @@ -69,7 +69,11 @@ class Ui_MainWindow(object): self.inboxSearchOptionCB.addItem(_fromUtf8("")) self.horizontalLayoutSearch.addWidget(self.inboxSearchOptionCB) self.verticalLayout_2.addLayout(self.horizontalLayoutSearch) - self.tableWidgetInbox = QtGui.QTableWidget(self.inbox) + self.splitter = QtGui.QSplitter(self.inbox) + self.splitter.setOrientation(QtCore.Qt.Vertical) + self.splitter.setObjectName(_fromUtf8("splitter")) + self.tableWidgetInbox = QtGui.QTableWidget(self.splitter) + self.tableWidgetInbox.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) self.tableWidgetInbox.setAlternatingRowColors(True) self.tableWidgetInbox.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) self.tableWidgetInbox.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) @@ -93,11 +97,11 @@ class Ui_MainWindow(object): self.tableWidgetInbox.horizontalHeader().setStretchLastSection(True) self.tableWidgetInbox.verticalHeader().setVisible(False) self.tableWidgetInbox.verticalHeader().setDefaultSectionSize(26) - self.verticalLayout_2.addWidget(self.tableWidgetInbox) - self.textEditInboxMessage = QtGui.QTextEdit(self.inbox) + self.textEditInboxMessage = QtGui.QTextEdit(self.splitter) self.textEditInboxMessage.setBaseSize(QtCore.QSize(0, 500)) + self.textEditInboxMessage.setReadOnly(True) self.textEditInboxMessage.setObjectName(_fromUtf8("textEditInboxMessage")) - self.verticalLayout_2.addWidget(self.textEditInboxMessage) + self.verticalLayout_2.addWidget(self.splitter) icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/inbox.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tabWidget.addTab(self.inbox, icon1, _fromUtf8("")) @@ -193,7 +197,11 @@ class Ui_MainWindow(object): self.sentSearchOptionCB.addItem(_fromUtf8("")) self.horizontalLayout.addWidget(self.sentSearchOptionCB) self.verticalLayout.addLayout(self.horizontalLayout) - self.tableWidgetSent = QtGui.QTableWidget(self.sent) + self.splitter_2 = QtGui.QSplitter(self.sent) + self.splitter_2.setOrientation(QtCore.Qt.Vertical) + self.splitter_2.setObjectName(_fromUtf8("splitter_2")) + self.tableWidgetSent = QtGui.QTableWidget(self.splitter_2) + self.tableWidgetSent.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) self.tableWidgetSent.setDragDropMode(QtGui.QAbstractItemView.DragDrop) self.tableWidgetSent.setAlternatingRowColors(True) self.tableWidgetSent.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) @@ -217,10 +225,10 @@ class Ui_MainWindow(object): self.tableWidgetSent.horizontalHeader().setStretchLastSection(True) self.tableWidgetSent.verticalHeader().setVisible(False) self.tableWidgetSent.verticalHeader().setStretchLastSection(False) - self.verticalLayout.addWidget(self.tableWidgetSent) - self.textEditSentMessage = QtGui.QTextEdit(self.sent) + self.textEditSentMessage = QtGui.QTextEdit(self.splitter_2) + self.textEditSentMessage.setReadOnly(True) self.textEditSentMessage.setObjectName(_fromUtf8("textEditSentMessage")) - self.verticalLayout.addWidget(self.textEditSentMessage) + self.verticalLayout.addWidget(self.splitter_2) icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/sent.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tabWidget.addTab(self.sent, icon3, _fromUtf8("")) @@ -428,7 +436,7 @@ class Ui_MainWindow(object): self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 795, 18)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 795, 23)) self.menubar.setObjectName(_fromUtf8("menubar")) self.menuFile = QtGui.QMenu(self.menubar) self.menuFile.setObjectName(_fromUtf8("menuFile")) @@ -546,8 +554,8 @@ class Ui_MainWindow(object): self.textEditMessage.setHtml(_translate("MainWindow", "\n" "
\n" -"