MODIFIED: remove config.ini to <user_path>/default/manager-ext.ini
FIXED: confusing of config handler with manager-core
This commit is contained in:
@@ -5,40 +5,57 @@ import manager_core as core
|
||||
import cm_global
|
||||
from manager_util import *
|
||||
|
||||
import folder_paths
|
||||
from comfy.cli_args import args
|
||||
import latent_preview
|
||||
|
||||
|
||||
version_code = [3, 0]
|
||||
version_str = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
|
||||
|
||||
DEFAULT_CHANNEL = "https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main"
|
||||
|
||||
config_path = os.path.join(comfyui_manager_path, "config.ini")
|
||||
manager_core_config_path = os.path.abspath(os.path.join(folder_paths.get_user_directory(), 'default', 'manager-ext.ini'))
|
||||
cached_config = None
|
||||
|
||||
|
||||
def get_current_preview_method():
|
||||
if args.preview_method == latent_preview.LatentPreviewMethod.Auto:
|
||||
return "auto"
|
||||
elif args.preview_method == latent_preview.LatentPreviewMethod.Latent2RGB:
|
||||
return "latent2rgb"
|
||||
elif args.preview_method == latent_preview.LatentPreviewMethod.TAESD:
|
||||
return "taesd"
|
||||
else:
|
||||
return "none"
|
||||
|
||||
|
||||
def write_config():
|
||||
config = configparser.ConfigParser()
|
||||
config['default'] = {
|
||||
'preview_method': get_current_preview_method(),
|
||||
'share_option': get_config()['share_option'],
|
||||
"file_logging": get_config()['file_logging'],
|
||||
'default_ui': get_config()['default_ui'],
|
||||
'component_policy': get_config()['component_policy'],
|
||||
'double_click_policy': get_config()['double_click_policy'],
|
||||
'model_download_by_agent': get_config()['model_download_by_agent'],
|
||||
'security_level': get_config()['security_level'],
|
||||
}
|
||||
with open(config_path, 'w') as configfile:
|
||||
with open(manager_core_config_path, 'w') as configfile:
|
||||
config.write(configfile)
|
||||
|
||||
|
||||
def read_config():
|
||||
try:
|
||||
config = configparser.ConfigParser()
|
||||
config.read(config_path)
|
||||
config.read(manager_core_config_path)
|
||||
default_conf = config['default']
|
||||
|
||||
# policy migration: disable_unsecure_features -> security_level
|
||||
security_level = default_conf['security_level'] if 'security_level' in default_conf else 'normal'
|
||||
|
||||
return {
|
||||
'preview_method': default_conf['preview_method'] if 'preview_method' in default_conf else get_current_preview_method(),
|
||||
'share_option': default_conf['share_option'] if 'share_option' in default_conf else 'all',
|
||||
'default_ui': default_conf['default_ui'] if 'default_ui' in default_conf else 'none',
|
||||
'component_policy': default_conf['component_policy'] if 'component_policy' in default_conf else 'workflow',
|
||||
@@ -49,6 +66,7 @@ def read_config():
|
||||
|
||||
except Exception:
|
||||
return {
|
||||
'preview_method': get_current_preview_method(),
|
||||
'share_option': 'all',
|
||||
'default_ui': 'none',
|
||||
'component_policy': 'workflow',
|
||||
|
||||
Reference in New Issue
Block a user