def __enter__(self): '''Returns the class instance to use for Context Management''' # Get the AddonCFG instance for the .cfg file self.config = AddonCFG(self.filepath) # Add the AddonCFG instance to config_files ConfigInstances.add(self.config) # Create the list of sections to add cvars and text to self.sections = list() # Return the instance return self
def _load_config(self, cfgfile): '''Loads the _config.py file and stores its location to be executed''' # Get the _config.py file config = LoadedConfigs[cfgfile.namebase] # Loop through all objects in the _config.py file for item in config.__dict__: # Is the object a cfglib.AddonCFG object? if not isinstance(config.__dict__[item], AddonCFG): # If not, continue continue # Add the instance to ConfigInstances ConfigInstances.add(config.__dict__[item])