Moved dirty setting tab indicator element creation to python backend side

This commit is contained in:
Alex Heller
2023-06-08 18:46:41 +02:00
parent f47444edc5
commit 69ab29b097
3 changed files with 25 additions and 16 deletions
-1
View File
@@ -272,7 +272,6 @@ div#extras_scale_to_tab div.form{
#settings .modification-indicator {
width: 100%;
height: 100%;
background: var(--color-accent);
border-radius: 1em !important;
padding: 0;
}
+3 -14
View File
@@ -322,14 +322,10 @@ onUiLoaded(function(){
tab_nav_element.parentElement.insertBefore(tab_content_wrapper, tab_nav_element.nextSibling)
tab_elements.forEach(function(elem, index){
// Add a modification indicator to the toplevel tab button
// Move the modification indicator to the toplevel tab button
let tab_name = elem.id.replace("settings_", "")
let new_indicator = document.createElement('button')
new_indicator.id = "modification_indicator_"+tab_name
new_indicator.className = "modification-indicator"
new_indicator.disabled = true
new_indicator.onclick = () => onSettingsModificationIndicatorClicked(tab_name)
tab_nav_element.insertBefore(new_indicator, tab_nav_buttons[index])
let indicator = gradioApp().getElementById("modification_indicator_"+tab_name)
tab_nav_element.insertBefore(indicator, tab_nav_buttons[index])
// Add the tab content to the wrapper
tab_content_wrapper.appendChild(elem)
@@ -374,13 +370,6 @@ function markIfModified(setting_name, value) {
tab_nav_indicator.title += `${unsaved.size} new default value${unsaved.size > 1 ? 's':''} (not yet saved).`;
}
function onSettingsModificationIndicatorClicked(tab_name) {
opts_tabs[tab_name].changed.forEach(function(setting_name){
// Click each setting's modification indicator
gradioApp().getElementById("modification_indicator_"+setting_name).click()
})
}
let txt2img_textarea;
let img2img_textarea;
const wait_time = 800;