mirror of https://github.com/vladmandic/automatic
fix gallery
parent
57dd6652df
commit
c71467e7f0
|
|
@ -1,5 +1,4 @@
|
|||
function extensions_apply(extensions_disabled_list, extensions_update_list, disable_all) {
|
||||
console.log('Extensions apply:', extensions_disabled_list, extensions_update_list, disable_all);
|
||||
const disable = [];
|
||||
const update = [];
|
||||
gradioApp().querySelectorAll('#extensions input[type="checkbox"]').forEach((x) => {
|
||||
|
|
@ -7,47 +6,48 @@ function extensions_apply(extensions_disabled_list, extensions_update_list, disa
|
|||
if (x.name.startsWith('update_') && x.checked) update.push(x.name.substring(7));
|
||||
});
|
||||
restart_reload();
|
||||
console.log('Extensions apply:', { disable, update });
|
||||
return [JSON.stringify(disable), JSON.stringify(update), disable_all];
|
||||
}
|
||||
|
||||
function extensions_check(info, extensions_disabled_list, search_text, sort_column) {
|
||||
console.log('Extensions check:', info, extensions_disabled_list);
|
||||
const disable = [];
|
||||
gradioApp().querySelectorAll('#extensions input[type="checkbox"]').forEach((x) => {
|
||||
if (x.name.startsWith('enable_') && !x.checked) disable.push(x.name.substring(7));
|
||||
});
|
||||
const id = randomId();
|
||||
console.log('Extensions check:', { disable });
|
||||
return [id, JSON.stringify(disable), search_text, sort_column];
|
||||
}
|
||||
|
||||
function install_extension(button, url) {
|
||||
console.log('Extension install:', url);
|
||||
button.disabled = 'disabled';
|
||||
button.value = 'Installing...';
|
||||
button.innerHTML = 'installing';
|
||||
const textarea = gradioApp().querySelector('#extension_to_install textarea');
|
||||
textarea.value = url;
|
||||
updateInput(textarea);
|
||||
console.log('Extension install:', { url });
|
||||
gradioApp().querySelector('#install_extension_button').click();
|
||||
}
|
||||
|
||||
function uninstall_extension(button, url) {
|
||||
console.log('Extension uninstall:', url, JSON.stringify(url), decodeURIComponent(url), encodeURI(url));
|
||||
button.disabled = 'disabled';
|
||||
button.value = 'Uninstalling...';
|
||||
button.innerHTML = 'uninstalling';
|
||||
const textarea = gradioApp().querySelector('#extension_to_install textarea');
|
||||
textarea.value = url;
|
||||
updateInput(textarea);
|
||||
console.log('Extension uninstall:', { url });
|
||||
gradioApp().querySelector('#uninstall_extension_button').click();
|
||||
}
|
||||
|
||||
function update_extension(button, url) {
|
||||
console.log('Extension update:', url);
|
||||
button.value = 'Updating...';
|
||||
button.innerHTML = 'updating';
|
||||
const textarea = gradioApp().querySelector('#extension_to_install textarea');
|
||||
textarea.value = url;
|
||||
updateInput(textarea);
|
||||
console.log('Extension update:', { url });
|
||||
gradioApp().querySelector('#update_extension_button').click();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
function attachGalleryListeners(tab_name) {
|
||||
const gallery = gradioApp().querySelector(`#${tab_name}_gallery`);
|
||||
gallery?.addEventListener('click', () => setTimeout(() => {
|
||||
if (!gallery) return null;
|
||||
gallery.addEventListener('click', () => setTimeout(() => {
|
||||
console.log('galleryItemSelected:', tab_name);
|
||||
gradioApp().getElementById(`${tab_name}_generation_info_button`)?.click();
|
||||
}, 500));
|
||||
gallery?.addEventListener('keydown', (e) => {
|
||||
|
|
@ -20,7 +22,6 @@ function initiGenerationParams() {
|
|||
if (generationParamsInitialized) return;
|
||||
if (!modal) modal = gradioApp().getElementById('lightboxModal');
|
||||
if (!modal) return;
|
||||
generationParamsInitialized = true;
|
||||
|
||||
const modalObserver = new MutationObserver((mutations) => {
|
||||
mutations.forEach((mutationRecord) => {
|
||||
|
|
@ -32,6 +33,8 @@ function initiGenerationParams() {
|
|||
|
||||
if (!txt2img_gallery) txt2img_gallery = attachGalleryListeners('txt2img');
|
||||
if (!img2img_gallery) img2img_gallery = attachGalleryListeners('img2img');
|
||||
if (txt2img_gallery && img2img_gallery) generationParamsInitialized = true;
|
||||
else return;
|
||||
modalObserver.observe(modal, { attributes: true, attributeFilter: ['style'] });
|
||||
console.log('initGenerationParams');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -434,9 +434,11 @@ class Api:
|
|||
return options
|
||||
|
||||
def set_config(self, req: Dict[str, Any]):
|
||||
updated = []
|
||||
for k, v in req.items():
|
||||
shared.opts.set(k, v)
|
||||
updated.append({ k: shared.opts.set(k, v) })
|
||||
shared.opts.save(shared.config_filename)
|
||||
return { "updated": updated }
|
||||
|
||||
def get_cmd_flags(self):
|
||||
return vars(shared.cmd_opts)
|
||||
|
|
|
|||
Loading…
Reference in New Issue