feat: default_ui

This commit is contained in:
dr.lt.data 2024-01-12 14:14:34 +09:00
parent bd829bfe85
commit 7e93258c4c
5 changed files with 77 additions and 8 deletions

View File

@ -28,7 +28,7 @@ except:
print(f"[WARN] ComfyUI-Manager: Your ComfyUI version is outdated. Please update to the latest version.")
version = [1, 25, 4]
version = [1, 26]
version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '')
print(f"### Loading: ComfyUI-Manager ({version_str})")
@ -169,7 +169,8 @@ def write_config():
'git_exe': get_config()['git_exe'],
'channel_url': get_config()['channel_url'],
'share_option': get_config()['share_option'],
'bypass_ssl': get_config()['bypass_ssl']
'bypass_ssl': get_config()['bypass_ssl'],
'default_ui': get_config()['default_ui'],
}
with open(config_path, 'w') as configfile:
config.write(configfile)
@ -188,6 +189,7 @@ def read_config():
'channel_url': default_conf['channel_url'] if 'channel_url' in default_conf else 'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main',
'share_option': default_conf['share_option'] if 'share_option' in default_conf else 'all',
'bypass_ssl': default_conf['bypass_ssl'] if 'bypass_ssl' in default_conf else False,
'default_ui': default_conf['default_ui'] if 'default_ui' in default_conf else 'none',
}
except Exception:
@ -197,7 +199,8 @@ def read_config():
'git_exe': '',
'channel_url': 'https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main',
'share_option': 'all',
'bypass_ssl': False
'bypass_ssl': False,
'default_ui': 'none'
}
@ -234,11 +237,15 @@ def set_preview_method(method):
get_config()['preview_method'] = args.preview_method
set_preview_method(get_config()['preview_method'])
def set_badge_mode(mode):
get_config()['badge_mode'] = mode
set_preview_method(get_config()['preview_method'])
def set_default_ui_mode(mode):
get_config()['default_ui'] = mode
def try_install_script(url, repo_path, install_cmd):
@ -1749,6 +1756,16 @@ async def badge_mode(request):
return web.Response(status=200)
@server.PromptServer.instance.routes.get("/manager/default_ui")
async def default_ui_mode(request):
if "value" in request.rel_url.query:
set_default_ui_mode(request.rel_url.query['value'])
write_config()
else:
return web.Response(text=get_config()['default_ui'], status=200)
return web.Response(status=200)
@server.PromptServer.instance.routes.get("/manager/channel_url_list")
async def channel_url_list(request):
channels = get_channel_dict()

View File

@ -5031,6 +5031,7 @@
"GlobalSampler //Inspire",
"GlobalSeed //Inspire",
"HEDPreprocessor_Provider_for_SEGS //Inspire",
"HyperTile //Inspire",
"ImageBatchSplitter //Inspire",
"InpaintPreprocessor_Provider_for_SEGS //Inspire",
"KSampler //Inspire",

View File

@ -21,7 +21,7 @@ var docStyle = document.createElement('style');
docStyle.innerHTML = `
#cm-manager-dialog {
width: 1000px;
height: 465px;
height: 495px;
box-sizing: content-box;
z-index: 10000;
}
@ -74,7 +74,7 @@ docStyle.innerHTML = `
.cm-notice-board {
width: 310px;
padding: 0px !important;
height: 230px;
height: 260px;
overflow: auto;
color: var(--input-text);
border: 1px solid var(--descrip-text);
@ -685,7 +685,7 @@ class ManagerMenuDialog extends ComfyDialog {
api.fetchApi('/manager/preview_method')
.then(response => response.text())
.then(data => { preview_combo.value = data; })
.then(data => { preview_combo.value = data; });
preview_combo.addEventListener('change', function (event) {
api.fetchApi(`/manager/preview_method?value=${event.target.value}`);
@ -736,6 +736,21 @@ class ManagerMenuDialog extends ComfyDialog {
}
});
// default ui state
let default_ui_combo = document.createElement("select");
default_ui_combo.className = "cm-menu-combo";
default_ui_combo.appendChild($el('option', { value: 'none', text: 'Default UI: None' }, []));
default_ui_combo.appendChild($el('option', { value: 'history', text: 'Default UI: History' }, []));
default_ui_combo.appendChild($el('option', { value: 'queue', text: 'Default UI: Queue' }, []));
api.fetchApi('/manager/default_ui')
.then(response => response.text())
.then(data => { default_ui_combo.value = data; });
default_ui_combo.addEventListener('change', function (event) {
api.fetchApi(`/manager/default_ui?value=${event.target.value}`);
});
// share
let share_combo = document.createElement("select");
share_combo.className = "cm-menu-combo";
@ -777,6 +792,7 @@ class ManagerMenuDialog extends ComfyDialog {
channel_combo,
preview_combo,
badge_combo,
default_ui_combo,
share_combo,
$el("br", {}, []),
$el("button.cm-button", {
@ -1171,3 +1187,27 @@ app.registerExtension({
}
},
});
async function set_default_ui()
{
let res = await api.fetchApi('/manager/default_ui');
if(res.status == 200) {
let mode = await res.text();
switch(mode) {
case 'history':
app.ui.queue.hide();
app.ui.history.show();
break;
case 'queue':
app.ui.queue.show();
app.ui.history.hide();
break;
default:
// do nothing
break;
}
}
}
set_default_ui();

View File

@ -10,6 +10,16 @@
},
{
"author": "AIGODLIKE",
"title": "AIGODLIKE/ComfyUI-Model-Manager [WIP]",
"reference": "https://github.com/AIGODLIKE/ComfyUI-Model-Manager",
"files": [
"https://github.com/AIGODLIKE/ComfyUI-Model-Manager"
],
"install_type": "git-clone",
"description": "WIP"
},
{
"author": "kadirnar",
"title": "ComfyUI-Transformers",
@ -32,7 +42,7 @@
},
{
"author": "11cafe",
"title": "ComfyUI Model Manager [WIP]",
"title": "11cafe/ComfyUI Model Manager [WIP]",
"reference": "https://github.com/11cafe/model-manager-comfyui",
"files": [
"https://github.com/11cafe/model-manager-comfyui"

View File

@ -5031,6 +5031,7 @@
"GlobalSampler //Inspire",
"GlobalSeed //Inspire",
"HEDPreprocessor_Provider_for_SEGS //Inspire",
"HyperTile //Inspire",
"ImageBatchSplitter //Inspire",
"InpaintPreprocessor_Provider_for_SEGS //Inspire",
"KSampler //Inspire",