various modifications to previous commit regarding ability to select language

This commit is contained in:
Jonathan Warren 2013-08-27 22:29:39 -04:00
parent aea1d41bf8
commit 0d5f2680d4
6 changed files with 41 additions and 24 deletions

View File

@ -2049,14 +2049,19 @@ class MyForm(QtGui.QMainWindow):
"MainWindow", "You must restart Bitmessage for the port number change to take effect.")) "MainWindow", "You must restart Bitmessage for the port number change to take effect."))
shared.config.set('bitmessagesettings', 'port', str( shared.config.set('bitmessagesettings', 'port', str(
self.settingsDialogInstance.ui.lineEditTCPPort.text())) 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': if shared.statusIconColor != 'red':
QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate( 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).")) "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('') self.statusBar().showMessage('')
shared.config.set('bitmessagesettings', 'socksproxytype', str( if self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] == 'SOCKS':
self.settingsDialogInstance.ui.comboBoxProxyType.currentText())) shared.config.set('bitmessagesettings', 'socksproxytype', str(
self.settingsDialogInstance.ui.comboBoxProxyType.currentText()))
else:
shared.config.set('bitmessagesettings', 'socksproxytype', 'none')
shared.config.set('bitmessagesettings', 'socksauthentication', str( shared.config.set('bitmessagesettings', 'socksauthentication', str(
self.settingsDialogInstance.ui.checkBoxAuthentication.isChecked())) self.settingsDialogInstance.ui.checkBoxAuthentication.isChecked()))
shared.config.set('bitmessagesettings', 'sockshostname', str( shared.config.set('bitmessagesettings', 'sockshostname', str(

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'settings.ui' # Form implementation generated from reading ui file 'settings.ui'
# #
# Created: Sat Aug 24 09:19:58 2013 # Created: Tue Aug 27 22:23:38 2013
# by: PyQt4 UI code generator 4.10.2 # by: PyQt4 UI code generator 4.10.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -71,6 +71,7 @@ class Ui_settingsDialog(object):
self.horizontalLayout_2 = QtGui.QHBoxLayout(self.groupBox) self.horizontalLayout_2 = QtGui.QHBoxLayout(self.groupBox)
self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2"))
self.languageComboBox = QtGui.QComboBox(self.groupBox) self.languageComboBox = QtGui.QComboBox(self.groupBox)
self.languageComboBox.setMinimumSize(QtCore.QSize(100, 0))
self.languageComboBox.setObjectName(_fromUtf8("languageComboBox")) self.languageComboBox.setObjectName(_fromUtf8("languageComboBox"))
self.languageComboBox.addItem(_fromUtf8("")) self.languageComboBox.addItem(_fromUtf8(""))
self.languageComboBox.addItem(_fromUtf8("")) self.languageComboBox.addItem(_fromUtf8(""))
@ -347,10 +348,10 @@ class Ui_settingsDialog(object):
self.languageComboBox.setItemText(0, _translate("settingsDialog", "System Settings", "system")) self.languageComboBox.setItemText(0, _translate("settingsDialog", "System Settings", "system"))
self.languageComboBox.setItemText(1, _translate("settingsDialog", "English", "en")) self.languageComboBox.setItemText(1, _translate("settingsDialog", "English", "en"))
self.languageComboBox.setItemText(2, _translate("settingsDialog", "Esperanto", "eo")) self.languageComboBox.setItemText(2, _translate("settingsDialog", "Esperanto", "eo"))
self.languageComboBox.setItemText(3, _translate("settingsDialog", "French", "fr")) self.languageComboBox.setItemText(3, _translate("settingsDialog", "Français", "fr"))
self.languageComboBox.setItemText(4, _translate("settingsDialog", "German", "de")) self.languageComboBox.setItemText(4, _translate("settingsDialog", "Deutsch", "de"))
self.languageComboBox.setItemText(5, _translate("settingsDialog", "Spanish", "es")) self.languageComboBox.setItemText(5, _translate("settingsDialog", "Español", "es"))
self.languageComboBox.setItemText(6, _translate("settingsDialog", "Russian", "ru")) self.languageComboBox.setItemText(6, _translate("settingsDialog", "Русский", "ru"))
self.languageComboBox.setItemText(7, _translate("settingsDialog", "Pirate English", "en_pirate")) self.languageComboBox.setItemText(7, _translate("settingsDialog", "Pirate English", "en_pirate"))
self.languageComboBox.setItemText(8, _translate("settingsDialog", "Other (set in keys.dat)", "other")) 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.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabUserInterface), _translate("settingsDialog", "User Interface", None))
@ -389,13 +390,3 @@ class Ui_settingsDialog(object):
self.radioButtonNamecoinNmcontrol.setText(_translate("settingsDialog", "NMControl", None)) self.radioButtonNamecoinNmcontrol.setText(_translate("settingsDialog", "NMControl", None))
self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabNamecoin), _translate("settingsDialog", "Namecoin integration", None)) self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabNamecoin), _translate("settingsDialog", "Namecoin integration", None))
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
settingsDialog = QtGui.QDialog()
ui = Ui_settingsDialog()
ui.setupUi(settingsDialog)
settingsDialog.show()
sys.exit(app.exec_())

View File

@ -113,6 +113,12 @@
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QComboBox" name="languageComboBox"> <widget class="QComboBox" name="languageComboBox">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<item> <item>
<property name="text"> <property name="text">
<string comment="system">System Settings</string> <string comment="system">System Settings</string>
@ -130,22 +136,22 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string comment="fr">French</string> <string comment="fr">Français</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string comment="de">German</string> <string comment="de">Deutsch</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string comment="es">Spanish</string> <string comment="es">Español</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string comment="ru">Russian</string> <string comment="ru">Русский</string>
</property> </property>
</item> </item>
<item> <item>

View File

@ -25,7 +25,7 @@ class outgoingSynSender(threading.Thread):
def run(self): def run(self):
while shared.safeConfigGetBoolean('bitmessagesettings', 'dontconnect'): while shared.safeConfigGetBoolean('bitmessagesettings', 'dontconnect'):
time.sleep(2) time.sleep(2)
while True: while shared.safeConfigGetBoolean('bitmessagesettings', 'sendoutgoingconnections'):
while len(self.selfInitiatedConnections[self.streamNumber]) >= 8: # maximum number of outgoing connections = 8 while len(self.selfInitiatedConnections[self.streamNumber]) >= 8: # maximum number of outgoing connections = 8
time.sleep(10) time.sleep(10)
if shared.shutdown: if shared.shutdown:

View File

@ -204,6 +204,14 @@ class sqlThread(threading.Thread):
item = '''update settings set value=? WHERE key='version';''' item = '''update settings set value=? WHERE key='version';'''
parameters = (2,) parameters = (2,)
self.cur.execute(item, parameters) self.cur.execute(item, parameters)
if not shared.config.has_option('bitmessagesettings', 'userlocale'):
shared.config.set('bitmessagesettings', 'userlocale', 'system')
if not shared.config.has_option('bitmessagesettings', 'sendoutgoingconnections'):
shared.config.set('bitmessagesettings', 'sendoutgoingconnections', 'True')
# Are you hoping to add a new option to the keys.dat file of existing
# Bitmessage users? Add it right above this line!
try: try:
testpayload = '\x00\x00' testpayload = '\x00\x00'

View File

@ -84,6 +84,13 @@ def loadConfig():
'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes', '0') 'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes', '0')
shared.config.set('bitmessagesettings', 'dontconnect', 'true') shared.config.set('bitmessagesettings', 'dontconnect', 'true')
shared.config.set('bitmessagesettings', 'userlocale', 'system') shared.config.set('bitmessagesettings', 'userlocale', 'system')
# Are you hoping to add a new option to the keys.dat file? You're in
# the right place for adding it to users who install the software for
# the first time. But you must also add it to the keys.dat file of
# existing users. To do that, search the class_sqlThread.py file for the
# text: "right above this line!"
ensureNamecoinOptions() ensureNamecoinOptions()
if storeConfigFilesInSameDirectoryAsProgramByDefault: if storeConfigFilesInSameDirectoryAsProgramByDefault: