mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
fix imageviewer and push changes to support uiux
This commit is contained in:
@@ -51,10 +51,12 @@
|
||||
"onUiLoaded": "readonly",
|
||||
"onUiUpdate": "readonly",
|
||||
"onUiTabChange": "readonly",
|
||||
"onUiReady": "readonly",
|
||||
"uiCurrentTab": "writable",
|
||||
"uiElementIsVisible": "readonly",
|
||||
"uiElementInSight": "readonly",
|
||||
"getUICurrentTabContent": "readonly",
|
||||
"waitForFlag": "readonly",
|
||||
//ui.js
|
||||
"opts": "writable",
|
||||
"sortUIElements": "readonly",
|
||||
|
||||
+2
-2
@@ -37,6 +37,7 @@
|
||||
as both *image-browser* and *controlnet* have native equivalents
|
||||
both can still be installed by user if desired
|
||||
- **Improvements**:
|
||||
- Add **MIGraphX** torch optimization engine, thanks @Disty0
|
||||
- Styles apply wildcards to params
|
||||
- Make metadata in full screen viewer optional
|
||||
- Add VAE civitai scan metadata/preview
|
||||
@@ -45,8 +46,7 @@
|
||||
- update to *IPEX 2.1.20* on Linux
|
||||
requires removing the venv folder to update properly
|
||||
- removed 1024x1024 workaround
|
||||
- disable ipexrun by default
|
||||
export `IPEXRUN=True` if you want to use ipexrun.
|
||||
- disable ipexrun by default, set `IPEXRUN=True` if you want to use `ipexrun`.
|
||||
- **Fixes**:
|
||||
- update requirements
|
||||
- prompt params parser
|
||||
|
||||
@@ -169,18 +169,17 @@ function galleryClickEventHandler(event) {
|
||||
}
|
||||
}
|
||||
|
||||
async function initImageViewer() {
|
||||
async function bindImageViewer() {
|
||||
// Each tab has its own gradio-gallery
|
||||
const galleryPreviews = gradioApp().querySelectorAll('.gradio-gallery > div.preview');
|
||||
if (galleryPreviews.length > 0) {
|
||||
for (const galleryPreview of galleryPreviews) {
|
||||
const fullImgPreview = galleryPreview.querySelectorAll('img');
|
||||
if (fullImgPreview.length > 0) {
|
||||
galleryPreview.addEventListener('click', galleryClickEventHandler, true);
|
||||
fullImgPreview.forEach(setupImageForLightbox);
|
||||
}
|
||||
}
|
||||
for (const galleryPreview of galleryPreviews) {
|
||||
if (!galleryPreview.hasAttribute('data-listener')) galleryPreview.addEventListener('click', galleryClickEventHandler, true);
|
||||
galleryPreview.setAttribute('data-listener', true);
|
||||
galleryPreview.querySelectorAll('img').forEach(setupImageForLightbox);
|
||||
}
|
||||
}
|
||||
|
||||
async function initImageViewer() {
|
||||
// main elements
|
||||
const modal = document.createElement('div');
|
||||
modal.id = 'lightboxModal';
|
||||
@@ -281,3 +280,5 @@ async function initImageViewer() {
|
||||
gradioApp().appendChild(modal);
|
||||
log('initImageViewer');
|
||||
}
|
||||
|
||||
onAfterUiUpdate(bindImageViewer);
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
const log = (...msg) => {
|
||||
const dt = new Date();
|
||||
const ts = `${dt.getHours().toString().padStart(2, '0')}:${dt.getMinutes().toString().padStart(2, '0')}:${dt.getSeconds().toString().padStart(2, '0')}.${dt.getMilliseconds().toString().padStart(3, '0')}`;
|
||||
if (window.logger) window.logger.innerHTML += window.logPrettyPrint(...msg);
|
||||
console.log(ts, ...msg); // eslint-disable-line no-console
|
||||
};
|
||||
|
||||
const debug = (...msg) => {
|
||||
const dt = new Date();
|
||||
const ts = `${dt.getHours().toString().padStart(2, '0')}:${dt.getMinutes().toString().padStart(2, '0')}:${dt.getSeconds().toString().padStart(2, '0')}.${dt.getMilliseconds().toString().padStart(3, '0')}`;
|
||||
if (window.logger) window.logger.innerHTML += window.logPrettyPrint(...msg);
|
||||
console.debug(ts, ...msg); // eslint-disable-line no-console
|
||||
};
|
||||
|
||||
@@ -81,7 +83,7 @@ function scheduleAfterUiUpdateCallbacks() {
|
||||
}
|
||||
|
||||
let executedOnLoaded = false;
|
||||
const ignoreElements = ['logMonitorData', 'logWarnings', 'logErrors', 'tooltip-container'];
|
||||
const ignoreElements = ['logMonitorData', 'logWarnings', 'logErrors', 'tooltip-container', 'logger'];
|
||||
const ignoreClasses = ['wrap'];
|
||||
|
||||
async function mutationCallback(mutations) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
async function initStartup() {
|
||||
log('initStartup');
|
||||
if (window.setupLogger) await setupLogger();
|
||||
|
||||
// all items here are non-blocking async calls
|
||||
initModels();
|
||||
@@ -26,7 +27,7 @@ async function initStartup() {
|
||||
executeCallbacks(uiReadyCallbacks);
|
||||
|
||||
// optinally wait for modern ui
|
||||
if (window.waitForUiUxReady) await window.waitForUiUxReady();
|
||||
if (window.waitForUiReady) await waitForUiReady();
|
||||
removeSplash();
|
||||
|
||||
// post startup tasks that may take longer but are not critical
|
||||
|
||||
Reference in New Issue
Block a user