Add the reset of configurations between loads
This commit is contained in:
parent
b9c9189ca7
commit
3fe4589b8b
|
@ -26,6 +26,23 @@ class Config(object):
|
||||||
_config_file = 'config.yaml'
|
_config_file = 'config.yaml'
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
""" Initialize configuration.
|
||||||
|
|
||||||
|
Remember to add anything that needs to be reset between configurations
|
||||||
|
to self._reset_config
|
||||||
|
"""
|
||||||
|
self._has_loaded = False
|
||||||
|
self._printer = None
|
||||||
|
|
||||||
|
self._printer_name = None
|
||||||
|
self._printer_config = None
|
||||||
|
|
||||||
|
def _reset_config(self):
|
||||||
|
""" Clear the loaded configuration.
|
||||||
|
|
||||||
|
If we are loading a changed config, we don't want to have leftover
|
||||||
|
data.
|
||||||
|
"""
|
||||||
self._has_loaded = False
|
self._has_loaded = False
|
||||||
self._printer = None
|
self._printer = None
|
||||||
|
|
||||||
|
@ -39,6 +56,9 @@ class Config(object):
|
||||||
for the configuration file.
|
for the configuration file.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
self._reset_config()
|
||||||
|
|
||||||
if not config_path:
|
if not config_path:
|
||||||
config_path = os.path.join(
|
config_path = os.path.join(
|
||||||
appdirs.user_config_dir(self._app_name),
|
appdirs.user_config_dir(self._app_name),
|
||||||
|
|
Loading…
Reference in New Issue