fix: show #ID badge always.

improve: better support for locale extension
This commit is contained in:
Dr.Lt.Data 2023-08-16 21:48:12 +09:00
parent a69a865417
commit 25dd77fb09
3 changed files with 57 additions and 32 deletions

View File

@ -55,7 +55,7 @@ sys.path.append('../..')
from torchvision.datasets.utils import download_url from torchvision.datasets.utils import download_url
# ensure .js # ensure .js
print("### Loading: ComfyUI-Manager (V0.22.3)") print("### Loading: ComfyUI-Manager (V0.22.4)")
comfy_ui_required_revision = 1240 comfy_ui_required_revision = 1240
comfy_ui_revision = "Unknown" comfy_ui_revision = "Unknown"

View File

@ -1458,6 +1458,7 @@
"Date Time Format", "Date Time Format",
"Debug Extra", "Debug Extra",
"Fetch widget value", "Fetch widget value",
"KSampler With Refiner (Fooocus)",
"Text Hash" "Text Hash"
], ],
{ {
@ -1647,6 +1648,15 @@
"title_aux": "CheckpointTomeLoader" "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": [ "https://github.com/m957ymj75urz/ComfyUI-Custom-Nodes/raw/main/clip-text-encode-split/clip_text_encode_split.py": [
[ [
"RawText", "RawText",

View File

@ -144,6 +144,7 @@ async function install_custom_node(target, caller, mode) {
} }
async function updateComfyUI() { async function updateComfyUI() {
let prev_text = update_comfyui_button.innerText;
update_comfyui_button.innerText = "Updating ComfyUI..."; update_comfyui_button.innerText = "Updating ComfyUI...";
update_comfyui_button.disabled = true; update_comfyui_button.disabled = true;
update_comfyui_button.style.backgroundColor = "gray"; update_comfyui_button.style.backgroundColor = "gray";
@ -152,7 +153,7 @@ async function updateComfyUI() {
const response = await api.fetchApi('/comfyui_manager/update_comfyui'); const response = await api.fetchApi('/comfyui_manager/update_comfyui');
if(response.status == 400) { 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; app.ui.dialog.element.style.zIndex = 9999;
return false; return false;
} }
@ -175,12 +176,13 @@ async function updateComfyUI() {
} }
finally { finally {
update_comfyui_button.disabled = false; update_comfyui_button.disabled = false;
update_comfyui_button.innerText = "Update ComfyUI"; update_comfyui_button.innerText = prev_text;
update_comfyui_button.style.backgroundColor = ""; update_comfyui_button.style.backgroundColor = "";
} }
} }
async function fetchUpdates(update_check_checkbox) { async function fetchUpdates(update_check_checkbox) {
let prev_text = fetch_updates_button.innerText;
fetch_updates_button.innerText = "Fetching updates..."; fetch_updates_button.innerText = "Fetching updates...";
fetch_updates_button.disabled = true; fetch_updates_button.disabled = true;
fetch_updates_button.style.backgroundColor = "gray"; fetch_updates_button.style.backgroundColor = "gray";
@ -217,7 +219,7 @@ async function fetchUpdates(update_check_checkbox) {
} }
finally { finally {
fetch_updates_button.disabled = false; fetch_updates_button.disabled = false;
fetch_updates_button.innerText = "Fetch Updates"; fetch_updates_button.innerText = prev_text;
fetch_updates_button.style.backgroundColor = ""; fetch_updates_button.style.backgroundColor = "";
} }
} }
@ -1553,20 +1555,27 @@ app.registerExtension({
}, },
async beforeRegisterNodeDef(nodeType, nodeData, app) { async beforeRegisterNodeDef(nodeType, nodeData, app) {
if(nicknames[nodeData.name.trim()]) {
const onDrawForeground = nodeType.prototype.onDrawForeground; const onDrawForeground = nodeType.prototype.onDrawForeground;
nodeType.prototype.onDrawForeground = function (ctx) { nodeType.prototype.onDrawForeground = function (ctx) {
const r = onDrawForeground?.apply?.(this, arguments); const r = onDrawForeground?.apply?.(this, arguments);
if(!this.flags.collapsed && badge_mode != 'none') { if(!this.flags.collapsed || badge_mode == 'none') {
let text = nicknames[nodeData.name.trim()]; let text = "";
if(text.length > 20) { if(badge_mode == 'id_nick')
text = text.substring(0,17)+".."; text = `#${this.id} `;
if(nicknames[nodeData.name.trim()]) {
let nick = nicknames[nodeData.name.trim()];
if(nick.length > 25) {
text += nick.substring(0,23)+"..";
}
else {
text += nick;
}
} }
if(badge_mode == 'id_nick') if(text != "") {
text = `#${this.id} ${text}`;
let fgColor = "white"; let fgColor = "white";
let bgColor = "#0F1F0F"; let bgColor = "#0F1F0F";
let visible = true; let visible = true;
@ -1583,29 +1592,35 @@ app.registerExtension({
ctx.fillText(text, this.size[0]-sz.width-6, -LiteGraph.NODE_TITLE_HEIGHT - 6); ctx.fillText(text, this.size[0]-sz.width-6, -LiteGraph.NODE_TITLE_HEIGHT - 6);
ctx.restore(); ctx.restore();
} }
}
return r; return r;
}; };
}
}, },
async loadedGraphNode(node, app) { async loadedGraphNode(node, app) {
if(node.has_errors) { if(node.has_errors) {
if(nicknames[node.type.trim()]) {
const onDrawForeground = node.onDrawForeground; const onDrawForeground = node.onDrawForeground;
node.onDrawForeground = function (ctx) { node.onDrawForeground = function (ctx) {
const r = onDrawForeground?.apply?.(this, arguments); const r = onDrawForeground?.apply?.(this, arguments);
if(!this.flags.collapsed && badge_mode != 'none') { if(!this.flags.collapsed || badge_mode == 'none') {
let text = nicknames[node.type.trim()]; let text = "";
if(badge_mode == 'id_nick')
text = `#${this.id} `;
if(text.length > 20) { if(nicknames[node.type.trim()]) {
text = text.substring(0,17)+".."; let nick = nicknames[node.type.trim()];
if(nick.length > 25) {
text += nick.substring(0,23)+"..";
}
else {
text += nick;
}
} }
if(badge_mode == 'id_nick') if(text != "") {
text = `#${this.id} ${text}`;
let fgColor = "white"; let fgColor = "white";
let bgColor = "#0F1F0F"; let bgColor = "#0F1F0F";
let visible = true; let visible = true;
@ -1622,10 +1637,10 @@ app.registerExtension({
ctx.fillText(text, this.size[0]-sz.width-6, -LiteGraph.NODE_TITLE_HEIGHT - 6); ctx.fillText(text, this.size[0]-sz.width-6, -LiteGraph.NODE_TITLE_HEIGHT - 6);
ctx.restore(); ctx.restore();
} }
}
return r; return r;
}; };
} }
} }
}
}); });