Revert arguments renaming in bitmessageqt.settings

This commit is contained in:
Dmitri Bogomolov 2022-02-16 22:16:41 +02:00
parent a5773999fe
commit 08099d4409
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -16,7 +16,7 @@ import paths
import queues import queues
import state import state
import widgets import widgets
from bmconfigparser import config from bmconfigparser import config as config_obj
from helper_sql import sqlExecute, sqlStoredProcedure from helper_sql import sqlExecute, sqlStoredProcedure
from helper_startup import start_proxyconfig from helper_startup import start_proxyconfig
from network import knownnodes, AnnounceThread from network import knownnodes, AnnounceThread
@ -24,11 +24,11 @@ from network.asyncore_pollchoose import set_rates
from tr import _translate from tr import _translate
def getSOCKSProxyType(config_): def getSOCKSProxyType(config):
"""Get user socksproxytype setting from *config*""" """Get user socksproxytype setting from *config*"""
try: try:
result = ConfigParser.SafeConfigParser.get( result = ConfigParser.SafeConfigParser.get(
config_, 'bitmessagesettings', 'socksproxytype') config, 'bitmessagesettings', 'socksproxytype')
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
return None return None
else: else:
@ -45,7 +45,7 @@ class SettingsDialog(QtGui.QDialog):
self.parent = parent self.parent = parent
self.firstrun = firstrun self.firstrun = firstrun
self.config = config self.config = config_obj
self.net_restart_needed = False self.net_restart_needed = False
self.timer = QtCore.QTimer() self.timer = QtCore.QTimer()
@ -80,7 +80,7 @@ class SettingsDialog(QtGui.QDialog):
) )
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self)) QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
def adjust_from_config(self, config_): def adjust_from_config(self, config):
"""Adjust all widgets state according to config settings""" """Adjust all widgets state according to config settings"""
# pylint: disable=too-many-branches,too-many-statements # pylint: disable=too-many-branches,too-many-statements
if not self.parent.tray.isSystemTrayAvailable(): if not self.parent.tray.isSystemTrayAvailable():
@ -89,31 +89,31 @@ class SettingsDialog(QtGui.QDialog):
"MainWindow", "Tray (not available in your system)")) "MainWindow", "Tray (not available in your system)"))
for setting in ( for setting in (
'minimizetotray', 'trayonclose', 'startintray'): 'minimizetotray', 'trayonclose', 'startintray'):
config_.set('bitmessagesettings', setting, 'false') config.set('bitmessagesettings', setting, 'false')
else: else:
self.checkBoxMinimizeToTray.setChecked( self.checkBoxMinimizeToTray.setChecked(
config_.getboolean('bitmessagesettings', 'minimizetotray')) config.getboolean('bitmessagesettings', 'minimizetotray'))
self.checkBoxTrayOnClose.setChecked( self.checkBoxTrayOnClose.setChecked(
config_.safeGetBoolean('bitmessagesettings', 'trayonclose')) config.safeGetBoolean('bitmessagesettings', 'trayonclose'))
self.checkBoxStartInTray.setChecked( self.checkBoxStartInTray.setChecked(
config_.getboolean('bitmessagesettings', 'startintray')) config.getboolean('bitmessagesettings', 'startintray'))
self.checkBoxHideTrayConnectionNotifications.setChecked( self.checkBoxHideTrayConnectionNotifications.setChecked(
config_.getboolean( config.getboolean(
'bitmessagesettings', 'hidetrayconnectionnotifications')) 'bitmessagesettings', 'hidetrayconnectionnotifications'))
self.checkBoxShowTrayNotifications.setChecked( self.checkBoxShowTrayNotifications.setChecked(
config_.getboolean('bitmessagesettings', 'showtraynotifications')) config.getboolean('bitmessagesettings', 'showtraynotifications'))
self.checkBoxStartOnLogon.setChecked( self.checkBoxStartOnLogon.setChecked(
config_.getboolean('bitmessagesettings', 'startonlogon')) config.getboolean('bitmessagesettings', 'startonlogon'))
self.checkBoxWillinglySendToMobile.setChecked( self.checkBoxWillinglySendToMobile.setChecked(
config_.safeGetBoolean( config.safeGetBoolean(
'bitmessagesettings', 'willinglysendtomobile')) 'bitmessagesettings', 'willinglysendtomobile'))
self.checkBoxUseIdenticons.setChecked( self.checkBoxUseIdenticons.setChecked(
config_.safeGetBoolean('bitmessagesettings', 'useidenticons')) config.safeGetBoolean('bitmessagesettings', 'useidenticons'))
self.checkBoxReplyBelow.setChecked( self.checkBoxReplyBelow.setChecked(
config_.safeGetBoolean('bitmessagesettings', 'replybelow')) config.safeGetBoolean('bitmessagesettings', 'replybelow'))
if state.appdata == paths.lookupExeFolder(): if state.appdata == paths.lookupExeFolder():
self.checkBoxPortableMode.setChecked(True) self.checkBoxPortableMode.setChecked(True)
@ -142,57 +142,57 @@ class SettingsDialog(QtGui.QDialog):
# On the Network settings tab: # On the Network settings tab:
self.lineEditTCPPort.setText(str( self.lineEditTCPPort.setText(str(
config_.get('bitmessagesettings', 'port'))) config.get('bitmessagesettings', 'port')))
self.checkBoxUPnP.setChecked( self.checkBoxUPnP.setChecked(
config_.safeGetBoolean('bitmessagesettings', 'upnp')) config.safeGetBoolean('bitmessagesettings', 'upnp'))
self.checkBoxUDP.setChecked( self.checkBoxUDP.setChecked(
config_.safeGetBoolean('bitmessagesettings', 'udp')) config.safeGetBoolean('bitmessagesettings', 'udp'))
self.checkBoxAuthentication.setChecked( self.checkBoxAuthentication.setChecked(
config_.getboolean('bitmessagesettings', 'socksauthentication')) config.getboolean('bitmessagesettings', 'socksauthentication'))
self.checkBoxSocksListen.setChecked( self.checkBoxSocksListen.setChecked(
config_.getboolean('bitmessagesettings', 'sockslisten')) config.getboolean('bitmessagesettings', 'sockslisten'))
self.checkBoxOnionOnly.setChecked( self.checkBoxOnionOnly.setChecked(
config_.safeGetBoolean('bitmessagesettings', 'onionservicesonly')) config.safeGetBoolean('bitmessagesettings', 'onionservicesonly'))
self._proxy_type = getSOCKSProxyType(config_) self._proxy_type = getSOCKSProxyType(config)
self.comboBoxProxyType.setCurrentIndex( self.comboBoxProxyType.setCurrentIndex(
0 if not self._proxy_type 0 if not self._proxy_type
else self.comboBoxProxyType.findText(self._proxy_type)) else self.comboBoxProxyType.findText(self._proxy_type))
self.comboBoxProxyTypeChanged(self.comboBoxProxyType.currentIndex()) self.comboBoxProxyTypeChanged(self.comboBoxProxyType.currentIndex())
self.lineEditSocksHostname.setText( self.lineEditSocksHostname.setText(
config_.get('bitmessagesettings', 'sockshostname')) config.get('bitmessagesettings', 'sockshostname'))
self.lineEditSocksPort.setText(str( self.lineEditSocksPort.setText(str(
config_.get('bitmessagesettings', 'socksport'))) config.get('bitmessagesettings', 'socksport')))
self.lineEditSocksUsername.setText( self.lineEditSocksUsername.setText(
config_.get('bitmessagesettings', 'socksusername')) config.get('bitmessagesettings', 'socksusername'))
self.lineEditSocksPassword.setText( self.lineEditSocksPassword.setText(
config_.get('bitmessagesettings', 'sockspassword')) config.get('bitmessagesettings', 'sockspassword'))
self.lineEditMaxDownloadRate.setText(str( self.lineEditMaxDownloadRate.setText(str(
config_.get('bitmessagesettings', 'maxdownloadrate'))) config.get('bitmessagesettings', 'maxdownloadrate')))
self.lineEditMaxUploadRate.setText(str( self.lineEditMaxUploadRate.setText(str(
config_.get('bitmessagesettings', 'maxuploadrate'))) config.get('bitmessagesettings', 'maxuploadrate')))
self.lineEditMaxOutboundConnections.setText(str( self.lineEditMaxOutboundConnections.setText(str(
config_.get('bitmessagesettings', 'maxoutboundconnections'))) config.get('bitmessagesettings', 'maxoutboundconnections')))
# Demanded difficulty tab # Demanded difficulty tab
self.lineEditTotalDifficulty.setText(str((float( self.lineEditTotalDifficulty.setText(str((float(
config_.getint( config.getint(
'bitmessagesettings', 'defaultnoncetrialsperbyte') 'bitmessagesettings', 'defaultnoncetrialsperbyte')
) / defaults.networkDefaultProofOfWorkNonceTrialsPerByte))) ) / defaults.networkDefaultProofOfWorkNonceTrialsPerByte)))
self.lineEditSmallMessageDifficulty.setText(str((float( self.lineEditSmallMessageDifficulty.setText(str((float(
config_.getint( config.getint(
'bitmessagesettings', 'defaultpayloadlengthextrabytes') 'bitmessagesettings', 'defaultpayloadlengthextrabytes')
) / defaults.networkDefaultPayloadLengthExtraBytes))) ) / defaults.networkDefaultPayloadLengthExtraBytes)))
# Max acceptable difficulty tab # Max acceptable difficulty tab
self.lineEditMaxAcceptableTotalDifficulty.setText(str((float( self.lineEditMaxAcceptableTotalDifficulty.setText(str((float(
config_.getint( config.getint(
'bitmessagesettings', 'maxacceptablenoncetrialsperbyte') 'bitmessagesettings', 'maxacceptablenoncetrialsperbyte')
) / defaults.networkDefaultProofOfWorkNonceTrialsPerByte))) ) / defaults.networkDefaultProofOfWorkNonceTrialsPerByte)))
self.lineEditMaxAcceptableSmallMessageDifficulty.setText(str((float( self.lineEditMaxAcceptableSmallMessageDifficulty.setText(str((float(
config_.getint( config.getint(
'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes') 'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes')
) / defaults.networkDefaultPayloadLengthExtraBytes))) ) / defaults.networkDefaultPayloadLengthExtraBytes)))
@ -203,21 +203,21 @@ class SettingsDialog(QtGui.QDialog):
self.comboBoxOpenCL.addItems(openclpow.vendors) self.comboBoxOpenCL.addItems(openclpow.vendors)
self.comboBoxOpenCL.setCurrentIndex(0) self.comboBoxOpenCL.setCurrentIndex(0)
for i in range(self.comboBoxOpenCL.count()): for i in range(self.comboBoxOpenCL.count()):
if self.comboBoxOpenCL.itemText(i) == config_.safeGet( if self.comboBoxOpenCL.itemText(i) == config.safeGet(
'bitmessagesettings', 'opencl'): 'bitmessagesettings', 'opencl'):
self.comboBoxOpenCL.setCurrentIndex(i) self.comboBoxOpenCL.setCurrentIndex(i)
break break
# Namecoin integration tab # Namecoin integration tab
nmctype = config_.get('bitmessagesettings', 'namecoinrpctype') nmctype = config.get('bitmessagesettings', 'namecoinrpctype')
self.lineEditNamecoinHost.setText( self.lineEditNamecoinHost.setText(
config_.get('bitmessagesettings', 'namecoinrpchost')) config.get('bitmessagesettings', 'namecoinrpchost'))
self.lineEditNamecoinPort.setText(str( self.lineEditNamecoinPort.setText(str(
config_.get('bitmessagesettings', 'namecoinrpcport'))) config.get('bitmessagesettings', 'namecoinrpcport')))
self.lineEditNamecoinUser.setText( self.lineEditNamecoinUser.setText(
config_.get('bitmessagesettings', 'namecoinrpcuser')) config.get('bitmessagesettings', 'namecoinrpcuser'))
self.lineEditNamecoinPassword.setText( self.lineEditNamecoinPassword.setText(
config_.get('bitmessagesettings', 'namecoinrpcpassword')) config.get('bitmessagesettings', 'namecoinrpcpassword'))
if nmctype == "namecoind": if nmctype == "namecoind":
self.radioButtonNamecoinNamecoind.setChecked(True) self.radioButtonNamecoinNamecoind.setChecked(True)
@ -232,9 +232,9 @@ class SettingsDialog(QtGui.QDialog):
# Message Resend tab # Message Resend tab
self.lineEditDays.setText(str( self.lineEditDays.setText(str(
config_.get('bitmessagesettings', 'stopresendingafterxdays'))) config.get('bitmessagesettings', 'stopresendingafterxdays')))
self.lineEditMonths.setText(str( self.lineEditMonths.setText(str(
config_.get('bitmessagesettings', 'stopresendingafterxmonths'))) config.get('bitmessagesettings', 'stopresendingafterxmonths')))
def comboBoxProxyTypeChanged(self, comboBoxIndex): def comboBoxProxyTypeChanged(self, comboBoxIndex):
"""A callback for currentIndexChanged event of comboBoxProxyType""" """A callback for currentIndexChanged event of comboBoxProxyType"""