Set dontconnect temporary, completely avoiding saving
This commit is contained in:
parent
df66277e2d
commit
24ae91ad0a
|
@ -490,11 +490,11 @@ class SettingsDialog(QtGui.QDialog):
|
||||||
|
|
||||||
if self.net_restart_needed:
|
if self.net_restart_needed:
|
||||||
self.net_restart_needed = False
|
self.net_restart_needed = False
|
||||||
self.config.set('bitmessagesettings', 'dontconnect', 'true')
|
self.config.setTemp('bitmessagesettings', 'dontconnect', 'true')
|
||||||
self.timer.singleShot(
|
self.timer.singleShot(
|
||||||
5000, lambda:
|
5000, lambda:
|
||||||
self.config.remove_option(
|
self.config.setTemp(
|
||||||
'bitmessagesettings', 'dontconnect')
|
'bitmessagesettings', 'dontconnect', 'false')
|
||||||
)
|
)
|
||||||
|
|
||||||
self.parent.updateStartOnLogon()
|
self.parent.updateStartOnLogon()
|
||||||
|
|
|
@ -46,6 +46,8 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
|
||||||
"""Singleton class inherited from ConfigParser.SafeConfigParser
|
"""Singleton class inherited from ConfigParser.SafeConfigParser
|
||||||
with additional methods specific to bitmessage config."""
|
with additional methods specific to bitmessage config."""
|
||||||
|
|
||||||
|
_temp = {}
|
||||||
|
|
||||||
def set(self, section, option, value=None):
|
def set(self, section, option, value=None):
|
||||||
if self._optcre is self.OPTCRE or value:
|
if self._optcre is self.OPTCRE or value:
|
||||||
if not isinstance(value, basestring):
|
if not isinstance(value, basestring):
|
||||||
|
@ -59,6 +61,10 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
|
||||||
if section == "bitmessagesettings" and option == "timeformat":
|
if section == "bitmessagesettings" and option == "timeformat":
|
||||||
return ConfigParser.ConfigParser.get(
|
return ConfigParser.ConfigParser.get(
|
||||||
self, section, option, raw, variables)
|
self, section, option, raw, variables)
|
||||||
|
try:
|
||||||
|
return self._temp[section][option]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
return ConfigParser.ConfigParser.get(
|
return ConfigParser.ConfigParser.get(
|
||||||
self, section, option, True, variables)
|
self, section, option, True, variables)
|
||||||
except ConfigParser.InterpolationError:
|
except ConfigParser.InterpolationError:
|
||||||
|
@ -70,6 +76,13 @@ class BMConfigParser(ConfigParser.SafeConfigParser):
|
||||||
except (KeyError, ValueError, AttributeError):
|
except (KeyError, ValueError, AttributeError):
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
def setTemp(self, section, option, value=None):
|
||||||
|
"""Temporary set option to value, not saving."""
|
||||||
|
try:
|
||||||
|
self._temp[section][option] = value
|
||||||
|
except KeyError:
|
||||||
|
self._temp[section] = {option: value}
|
||||||
|
|
||||||
def safeGetBoolean(self, section, field):
|
def safeGetBoolean(self, section, field):
|
||||||
try:
|
try:
|
||||||
return self.getboolean(section, field)
|
return self.getboolean(section, field)
|
||||||
|
|
Reference in New Issue
Block a user