fix on reload with changed show all loras setting

This commit is contained in:
Andray 2024-02-27 23:17:52 +04:00
parent de7604fa77
commit b4c44e659b
3 changed files with 12 additions and 13 deletions

View File

@ -454,16 +454,18 @@ function extraNetworksControlTreeViewOnClick(event, tabname, extra_networks_tabn
if (tree.classList.contains("hidden")) { if (tree.classList.contains("hidden")) {
tree.style.display = 'none'; tree.style.display = 'none';
resizeHandle.style.display = 'none';
parent.style.display = 'flex'; parent.style.display = 'flex';
if (resizeHandle) {
resizeHandle.style.display = 'none';
}
} else { } else {
tree.style.display = 'block'; tree.style.display = 'block';
parent.style.display = 'grid';
if (!resizeHandle) { if (!resizeHandle) {
setupResizeHandle(parent); setupResizeHandle(parent);
resizeHandle = parent.querySelector('.resize-handle'); resizeHandle = parent.querySelector('.resize-handle');
} }
resizeHandle.style.display = 'block'; resizeHandle.style.display = 'block';
parent.style.display = 'grid';
} }
event.currentTarget.classList.toggle("extra-network-control--enabled"); event.currentTarget.classList.toggle("extra-network-control--enabled");
} }

View File

@ -166,18 +166,15 @@
setupResizeHandle = setup; setupResizeHandle = setup;
})(); })();
onUiLoaded(function() {
for (var elem of gradioApp().querySelectorAll('.resize-handle-row')) {
if (!elem.querySelector('.resize-handle')) {
setupResizeHandle(elem);
}
}
});
function setupExtraNetworksResizeHandle() { function setupAllResizeHandles() {
for (var elem of document.body.querySelectorAll('.resize-handle-row')) { for (var elem of gradioApp().querySelectorAll('.resize-handle-row')) {
if (!elem.querySelector('.resize-handle') && !elem.children[0].classList.contains("hidden")) { if (!elem.querySelector('.resize-handle') && !elem.children[0].classList.contains("hidden")) {
setupResizeHandle(elem); setupResizeHandle(elem);
} }
} }
} }
onUiLoaded(setupAllResizeHandles);

View File

@ -700,7 +700,7 @@ def create_ui(interface: gr.Blocks, unrelated_tabs, tabname):
return ui.pages_contents return ui.pages_contents
button_refresh = gr.Button("Refresh", elem_id=f"{tabname}_{page.extra_networks_tabname}_extra_refresh_internal", visible=False) button_refresh = gr.Button("Refresh", elem_id=f"{tabname}_{page.extra_networks_tabname}_extra_refresh_internal", visible=False)
button_refresh.click(fn=refresh, inputs=[], outputs=ui.pages).then(fn=lambda: None, _js="function(){ " + f"applyExtraNetworkFilter('{tabname}_{page.extra_networks_tabname}');" + " }") button_refresh.click(fn=refresh, inputs=[], outputs=ui.pages).then(fn=lambda: None, _js="function(){ " + f"applyExtraNetworkFilter('{tabname}_{page.extra_networks_tabname}');" + " }").then(fn=lambda: None, _js='setupAllResizeHandles')
def create_html(): def create_html():
ui.pages_contents = [pg.create_html(ui.tabname) for pg in ui.stored_extra_pages] ui.pages_contents = [pg.create_html(ui.tabname) for pg in ui.stored_extra_pages]
@ -710,7 +710,7 @@ def create_ui(interface: gr.Blocks, unrelated_tabs, tabname):
create_html() create_html()
return ui.pages_contents return ui.pages_contents
interface.load(fn=pages_html, inputs=[], outputs=ui.pages).then(fn=lambda: None, _js='setupExtraNetworksResizeHandle') interface.load(fn=pages_html, inputs=[], outputs=ui.pages).then(fn=lambda: None, _js='setupAllResizeHandles')
return ui return ui