def get_config(): """Get the Load Marker config object or None.""" file_name = const.CONFIG_FILE_NAME config_path = config_utils.get_home_dir_path(file_name) config = config_utils.Config(config_path) config.set_autoread(False) config.set_autowrite(False) return config
import mmSolver.utils.config as config_utils import mmSolver.tools.userpreferences.constant as const LOG = mmSolver.logger.get_logger() # Intialised without a file path, because we only look up the file in # the functions below. # # Users are not allowed to touch this variable. # # Note we never re-assign this variable. The Config object instance is # always reused. __CONFIG_PATH = config_utils.get_home_dir_path(const.CONFIG_FILE_NAME) __CONFIG = config_utils.Config(__CONFIG_PATH) __CONFIG.autoread = True __CONFIG.autowrite = False def get_config(): return __CONFIG def force_reload_from_file(): if os.path.isfile(__CONFIG.file_path): __CONFIG.read() return def get_value(config, key):