# utils.py import json from pathlib import Path def save_config(config_dict, filename="config.json"): """Сохранить конфигурацию в JSON файл""" config_path = Path.home() / "Documents" / "C4" / filename config_path.parent.mkdir(parents=True, exist_ok=True) with open(config_path, 'w', encoding='utf-8') as f: json.dump(config_dict, f, indent=2, ensure_ascii=False) return config_path def load_config(filename="config.json"): """Загрузить конфигурацию из JSON файла""" config_path = Path.home() / "Documents" / "C4" / filename if config_path.exists(): with open(config_path, 'r', encoding='utf-8') as f: return json.load(f) return {} class ModuleManager: """Менеджер для работы с модулями""" def __init__(self): self.modules = {} def register_module(self, name, module_class): """Зарегистрировать модуль""" self.modules[name] = module_class def create_module(self, name, parent_frame): """Создать экземпляр модуля""" if name in self.modules: return self.modules[name](parent_frame) return None