示例#1
0
    def _unload_configs(self):
        '''Unloads all cfg instances when unloading gungame51'''

        # Clear the CvarDefaults dictionary
        CvarDefaults.clear()

        # Unload all config files
        LoadedConfigs.clear()

        # Clear the ConfigInstances set
        ConfigInstances.clear()
示例#2
0
    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
示例#3
0
    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])