示例#1
0
    def load_configs(self):
        if not os.path.isfile(self.model.CONFIGS_FILE):
            return
        with open(self.model.CONFIGS_FILE, 'r', encoding='utf-8') as file:
            data = yaml.load(file, yaml.FullLoader)
        if not data:
            self.logger.warning(f'{self.model.CONFIGS_FILE} is empty')
            return

        configs = [Config.from_dict(d) for d in data]
        for conf in configs:
            self.mod_manager.update_config_fields(conf)
        self.model.configs = configs
        self.logger.debug('configs loaded')
示例#2
0
    def load_configs(self):
        def check_utils(config):
            for t, field in self.TASK_FIELDS.items():
                if t not in config.utils:
                    config.utils[t] = {f: None for f in field.keys()}

        if not os.path.isfile(CONFIGS_FILE):
            return
        with open(CONFIGS_FILE, 'r', encoding='utf-8') as file:
            data = yaml.load(file, yaml.FullLoader)
        if not data:
            self.logger.warning(f'{CONFIGS_FILE} is empty')
            return
        self.configs = [Config.from_dict(d) for d in data]
        for c in self.configs:
            check_utils(c)
            self.__add_config_widget(c)
        self.logger.debug('configs loaded')