Commit c9ee9844 authored by innovaciones's avatar innovaciones Committed by AUTOMATIC1111

New position and interrupt integration

parent 8af8fa20
// code related to showing and updating progressbar shown as the image is being made // code related to showing and updating progressbar shown as the image is being made
global_progressbar = null global_progressbar = null
onUiUpdate(function(){ onUiUpdate(function(){
progressbar = gradioApp().getElementById('progressbar') progressbar = gradioApp().getElementById('progressbar')
progressDiv = gradioApp().querySelectorAll('.progressDiv').length > 0; progressDiv = gradioApp().querySelectorAll('.progressDiv').length > 0;
interrupt = gradioApp().getElementById('interrupt')
if(progressbar!= null && progressbar != global_progressbar){ if(progressbar!= null && progressbar != global_progressbar){
global_progressbar = progressbar global_progressbar = progressbar
var mutationObserver = new MutationObserver(function(m){ var mutationObserver = new MutationObserver(function(m){
txt2img_preview = gradioApp().getElementById('txt2img_preview') txt2img_preview = gradioApp().getElementById('txt2img_preview')
txt2img_gallery = gradioApp().getElementById('txt2img_gallery') txt2img_gallery = gradioApp().getElementById('txt2img_gallery')
img2img_preview = gradioApp().getElementById('img2img_preview') img2img_preview = gradioApp().getElementById('img2img_preview')
img2img_gallery = gradioApp().getElementById('img2img_gallery') img2img_gallery = gradioApp().getElementById('img2img_gallery')
...@@ -19,7 +18,7 @@ onUiUpdate(function(){ ...@@ -19,7 +18,7 @@ onUiUpdate(function(){
txt2img_preview.style.width = txt2img_gallery.clientWidth + "px" txt2img_preview.style.width = txt2img_gallery.clientWidth + "px"
txt2img_preview.style.height = txt2img_gallery.clientHeight + "px" txt2img_preview.style.height = txt2img_gallery.clientHeight + "px"
if(!progressDiv){ if(!progressDiv){
progressbar.style.display = "none" interrupt.style.display = "none"
} }
} }
...@@ -27,7 +26,7 @@ onUiUpdate(function(){ ...@@ -27,7 +26,7 @@ onUiUpdate(function(){
img2img_preview.style.width = img2img_gallery.clientWidth + "px" img2img_preview.style.width = img2img_gallery.clientWidth + "px"
img2img_preview.style.height = img2img_gallery.clientHeight + "px" img2img_preview.style.height = img2img_gallery.clientHeight + "px"
if(!progressDiv){ if(!progressDiv){
progressbar.style.display = "none" interrupt.style.display = "none"
} }
} }
...@@ -36,7 +35,6 @@ onUiUpdate(function(){ ...@@ -36,7 +35,6 @@ onUiUpdate(function(){
mutationObserver.observe( progressbar, { childList:true, subtree:true }) mutationObserver.observe( progressbar, { childList:true, subtree:true })
} }
}) })
function requestMoreProgress(){ function requestMoreProgress(){
btn = gradioApp().getElementById("check_progress"); btn = gradioApp().getElementById("check_progress");
if(btn==null) return; if(btn==null) return;
...@@ -44,7 +42,7 @@ function requestMoreProgress(){ ...@@ -44,7 +42,7 @@ function requestMoreProgress(){
btn.click(); btn.click();
progressDiv = gradioApp().querySelectorAll('.progressDiv').length > 0; progressDiv = gradioApp().querySelectorAll('.progressDiv').length > 0;
if(progressDiv){ if(progressDiv){
progressbar.style.display = "block" interrupt.style.display = "block"
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment