Improve user guidance for file path input
Changes: - Added tooltips to all input parameters explaining their purpose - Enhanced alert dialog with detailed instructions and examples - Shows current default path in the alert - Better formatting for multi-line instructions - Added dynamicPrompts: false to image input for better UX Note: Browser security prevents automatic full path detection. Users need to manually enter the complete file path after using the file picker.
This commit is contained in:
@@ -31,21 +31,26 @@ class RandomImagePicker:
|
||||
"image": ("STRING", {
|
||||
"default": default_path,
|
||||
"multiline": False,
|
||||
"dynamicPrompts": False,
|
||||
"tooltip": "Enter full path to image file (Single mode) or folder (Folder mode). Use 📁 button to help select."
|
||||
}),
|
||||
"folder_mode": ("BOOLEAN", {
|
||||
"default": False,
|
||||
"label_on": "Folder",
|
||||
"label_off": "Single"
|
||||
"label_off": "Single",
|
||||
"tooltip": "Single: Load specific file | Folder: Random from folder"
|
||||
}),
|
||||
"include_subfolders": ("BOOLEAN", {
|
||||
"default": False,
|
||||
"label_on": "ON",
|
||||
"label_off": "OFF"
|
||||
"label_off": "OFF",
|
||||
"tooltip": "Include subfolders when scanning in Folder mode"
|
||||
}),
|
||||
"seed": ("INT", {
|
||||
"default": 0,
|
||||
"min": 0,
|
||||
"max": 0xffffffffffffffff
|
||||
"max": 0xffffffffffffffff,
|
||||
"tooltip": "Random seed for reproducible selection in Folder mode"
|
||||
}),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -23,10 +23,23 @@ app.registerExtension({
|
||||
const imageWidget = node.widgets.find(w => w.name === "image");
|
||||
|
||||
if (imageWidget) {
|
||||
// Update with file name (user needs to provide full path)
|
||||
imageWidget.value = file.name;
|
||||
console.log("Selected file:", file.name);
|
||||
alert(`File selected: ${file.name}\n\nPlease enter the full path to this file in the text field above.`);
|
||||
// Show selected file name
|
||||
const fileName = file.name;
|
||||
console.log("Selected file:", fileName);
|
||||
|
||||
// Show dialog with instructions
|
||||
const currentPath = imageWidget.value || "";
|
||||
const dialogText = `File selected: ${fileName}\n\n` +
|
||||
`⚠️ IMPORTANT:\n` +
|
||||
`Due to browser security, the full path cannot be automatically detected.\n\n` +
|
||||
`Please copy and paste the FULL PATH to this file in the 'image' field above.\n\n` +
|
||||
`Example:\n` +
|
||||
`D:\\Images\\${fileName}\n` +
|
||||
`or\n` +
|
||||
`C:\\Users\\YourName\\Pictures\\${fileName}\n\n` +
|
||||
`Current default: ${currentPath || '(not set)'}`;
|
||||
|
||||
alert(dialogText);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user