async関数を使用してImageDirの進捗が表示されるように修正

This commit is contained in:
るみなー先生
2026-06-06 22:39:50 +09:00
parent 63b24f37c2
commit 28c8d3ba0b
2 changed files with 17 additions and 7 deletions
+10 -1
View File
@@ -1,3 +1,4 @@
import asyncio
import base64
import io
import json
@@ -2088,7 +2089,15 @@ async def review_sync_checkpoint(request):
continue
search_directory = target.get("search_directory")
max_preview_images = _clamp_image_dir_max_images(target.get("max_preview_images", IMAGE_DIR_DEFAULT_MAX_IMAGES))
sheet, extra = _load_image_dir_preview(node_id, relpath, search_directory, tab_id=tab_id, send_progress=True, max_preview_images=max_preview_images)
sheet, extra = await asyncio.to_thread(
_load_image_dir_preview,
node_id,
relpath,
search_directory,
tab_id,
True,
max_preview_images,
)
_store_preview_state(tab_id, node_id, relpath, status, node_class="ImageDirPreview")
_send_preview(node_id, _image_dir_title(relpath), sheet, extra, tab_id=tab_id)
preview_count += 1
+7 -6
View File
@@ -798,7 +798,7 @@ function setupPreviewNode(nodeType) {
const total = Math.max(1, Number(st.progress_total || st.max_preview_images || 1));
const value = Math.max(0, Math.min(total, Number(st.progress_value || 0)));
const barX = margin;
const barY = 52;
const barY = 0;
const barW = Math.max(1, this.size[0] - margin * 2);
const barH = 6;
ctx.fillStyle = "rgba(255,255,255,0.14)";
@@ -894,13 +894,14 @@ function selectorRects(node) {
const buttonY = 8;
const buttonH = 24;
const arrowW = 32;
const downX = Math.max(430, (node.size?.[0] || 520) - margin - arrowW);
const upX = downX - gap - arrowW;
const refreshW = 102;
const listOnlyW = 92;
const pushW = selectorActionMode(node) === "sync" ? 150 : 132;
const pushX = margin + refreshW + gap + listOnlyW + gap;
const availablePushW = Math.max(140, upX - gap - pushX);
const pushW = Math.min(190, availablePushW);
// Keep scroll buttons close to the toolbar action buttons instead of anchoring
// them to the right edge. The right edge belongs to ComfyUI output pins.
const upX = pushX + pushW + gap;
const downX = upX + arrowW + gap;
return {
refreshAll: { x: margin, y: buttonY, w: refreshW, h: buttonH },
listOnly: { x: margin + refreshW + gap, y: buttonY, w: listOnlyW, h: buttonH },
@@ -1062,7 +1063,7 @@ function selectorActionMode(node) {
}
function selectorActionLabel(node) {
return selectorActionMode(node) === "sync" ? "🎯 Sync Checkpoint" : "🏹 Push to Local List";
return selectorActionMode(node) === "sync" ? "🎯 Sync Checkpoint" : "🏹 Push Local";
}
async function loadSelector(node, mode = "list") {