From 25dd77fb093302df1e6a138c394af9ff109f586b Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Wed, 16 Aug 2023 21:48:12 +0900 Subject: [PATCH] fix: show #ID badge always. improve: better support for locale extension --- __init__.py | 2 +- extension-node-map.json | 10 ++++++ js/comfyui-manager.js | 77 ++++++++++++++++++++++++----------------- 3 files changed, 57 insertions(+), 32 deletions(-) diff --git a/__init__.py b/__init__.py index 03b897c..2a3efbf 100644 --- a/__init__.py +++ b/__init__.py @@ -55,7 +55,7 @@ sys.path.append('../..') from torchvision.datasets.utils import download_url # ensure .js -print("### Loading: ComfyUI-Manager (V0.22.3)") +print("### Loading: ComfyUI-Manager (V0.22.4)") comfy_ui_required_revision = 1240 comfy_ui_revision = "Unknown" diff --git a/extension-node-map.json b/extension-node-map.json index 239ff10..71dc916 100644 --- a/extension-node-map.json +++ b/extension-node-map.json @@ -1458,6 +1458,7 @@ "Date Time Format", "Debug Extra", "Fetch widget value", + "KSampler With Refiner (Fooocus)", "Text Hash" ], { @@ -1647,6 +1648,15 @@ "title_aux": "CheckpointTomeLoader" } ], + "https://github.com/m-sokes/ComfyUI-Sokes-Nodes": [ + [ + "Custom Date Format | sokes \ud83e\uddac", + "Latent Switch x9 | sokes \ud83e\uddac" + ], + { + "title_aux": "ComfyUI Sokes Nodes" + } + ], "https://github.com/m957ymj75urz/ComfyUI-Custom-Nodes/raw/main/clip-text-encode-split/clip_text_encode_split.py": [ [ "RawText", diff --git a/js/comfyui-manager.js b/js/comfyui-manager.js index c262d93..15e48fa 100644 --- a/js/comfyui-manager.js +++ b/js/comfyui-manager.js @@ -144,6 +144,7 @@ async function install_custom_node(target, caller, mode) { } async function updateComfyUI() { + let prev_text = update_comfyui_button.innerText; update_comfyui_button.innerText = "Updating ComfyUI..."; update_comfyui_button.disabled = true; update_comfyui_button.style.backgroundColor = "gray"; @@ -152,7 +153,7 @@ async function updateComfyUI() { const response = await api.fetchApi('/comfyui_manager/update_comfyui'); if(response.status == 400) { - app.ui.dialog.show('Failed to update ComfyUI'); + app.ui.dialog.show('Failed to update ComfyUI.'); app.ui.dialog.element.style.zIndex = 9999; return false; } @@ -175,12 +176,13 @@ async function updateComfyUI() { } finally { update_comfyui_button.disabled = false; - update_comfyui_button.innerText = "Update ComfyUI"; + update_comfyui_button.innerText = prev_text; update_comfyui_button.style.backgroundColor = ""; } } async function fetchUpdates(update_check_checkbox) { + let prev_text = fetch_updates_button.innerText; fetch_updates_button.innerText = "Fetching updates..."; fetch_updates_button.disabled = true; fetch_updates_button.style.backgroundColor = "gray"; @@ -217,7 +219,7 @@ async function fetchUpdates(update_check_checkbox) { } finally { fetch_updates_button.disabled = false; - fetch_updates_button.innerText = "Fetch Updates"; + fetch_updates_button.innerText = prev_text; fetch_updates_button.style.backgroundColor = ""; } } @@ -1553,20 +1555,27 @@ app.registerExtension({ }, async beforeRegisterNodeDef(nodeType, nodeData, app) { - if(nicknames[nodeData.name.trim()]) { - const onDrawForeground = nodeType.prototype.onDrawForeground; - nodeType.prototype.onDrawForeground = function (ctx) { - const r = onDrawForeground?.apply?.(this, arguments); + const onDrawForeground = nodeType.prototype.onDrawForeground; + nodeType.prototype.onDrawForeground = function (ctx) { + const r = onDrawForeground?.apply?.(this, arguments); - if(!this.flags.collapsed && badge_mode != 'none') { - let text = nicknames[nodeData.name.trim()]; - if(text.length > 20) { - text = text.substring(0,17)+".."; - } + if(!this.flags.collapsed || badge_mode == 'none') { + let text = ""; + if(badge_mode == 'id_nick') + text = `#${this.id} `; - if(badge_mode == 'id_nick') - text = `#${this.id} ${text}`; + if(nicknames[nodeData.name.trim()]) { + let nick = nicknames[nodeData.name.trim()]; + + if(nick.length > 25) { + text += nick.substring(0,23)+".."; + } + else { + text += nick; + } + } + if(text != "") { let fgColor = "white"; let bgColor = "#0F1F0F"; let visible = true; @@ -1583,29 +1592,35 @@ app.registerExtension({ ctx.fillText(text, this.size[0]-sz.width-6, -LiteGraph.NODE_TITLE_HEIGHT - 6); ctx.restore(); } + } - return r; - }; - } + return r; + }; }, async loadedGraphNode(node, app) { if(node.has_errors) { - if(nicknames[node.type.trim()]) { - const onDrawForeground = node.onDrawForeground; - node.onDrawForeground = function (ctx) { - const r = onDrawForeground?.apply?.(this, arguments); + const onDrawForeground = node.onDrawForeground; + node.onDrawForeground = function (ctx) { + const r = onDrawForeground?.apply?.(this, arguments); - if(!this.flags.collapsed && badge_mode != 'none') { - let text = nicknames[node.type.trim()]; + if(!this.flags.collapsed || badge_mode == 'none') { + let text = ""; + if(badge_mode == 'id_nick') + text = `#${this.id} `; - if(text.length > 20) { - text = text.substring(0,17)+".."; - } + if(nicknames[node.type.trim()]) { + let nick = nicknames[node.type.trim()]; - if(badge_mode == 'id_nick') - text = `#${this.id} ${text}`; + if(nick.length > 25) { + text += nick.substring(0,23)+".."; + } + else { + text += nick; + } + } + if(text != "") { let fgColor = "white"; let bgColor = "#0F1F0F"; let visible = true; @@ -1622,10 +1637,10 @@ app.registerExtension({ ctx.fillText(text, this.size[0]-sz.width-6, -LiteGraph.NODE_TITLE_HEIGHT - 6); ctx.restore(); } + } - return r; - }; - } + return r; + }; } } });