Add the ability to inhibit config saving
This commit is contained in:
parent
b7e9c4d02c
commit
2ce78b7903
|
@ -230,10 +230,12 @@ class Config(object):
|
||||||
gconf = None
|
gconf = None
|
||||||
system_font = None
|
system_font = None
|
||||||
system_focus = None
|
system_focus = None
|
||||||
|
inhibited = None
|
||||||
|
|
||||||
def __init__(self, profile='default'):
|
def __init__(self, profile='default'):
|
||||||
self.base = ConfigBase()
|
self.base = ConfigBase()
|
||||||
self.profile = profile
|
self.profile = profile
|
||||||
|
self.inhibited = False
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
"""Look up a configuration item"""
|
"""Look up a configuration item"""
|
||||||
|
@ -340,7 +342,18 @@ class Config(object):
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
"""Cause ConfigBase to save our config to file"""
|
"""Cause ConfigBase to save our config to file"""
|
||||||
return(self.base.save())
|
if self.inhibited is True:
|
||||||
|
return(True)
|
||||||
|
else:
|
||||||
|
return(self.base.save())
|
||||||
|
|
||||||
|
def inhibit_save(self):
|
||||||
|
"""Prevent calls to save() being honoured"""
|
||||||
|
self.inhibited = True
|
||||||
|
|
||||||
|
def uninhibit_save(self):
|
||||||
|
"""Allow calls to save() to be honoured"""
|
||||||
|
self.inhibited = False
|
||||||
|
|
||||||
def options_set(self, options):
|
def options_set(self, options):
|
||||||
"""Set the command line options"""
|
"""Set the command line options"""
|
||||||
|
|
Loading…
Reference in New Issue