aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ui_common.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2023-05-31 19:40:09 +0000
committerAUTOMATIC <16777216c@gmail.com>2023-05-31 19:40:09 +0000
commitdf02498d03e4296b7d7581aff69571a49be1d27a (patch)
tree7d85e31bac5756f288824729659254678f87f2e5 /modules/ui_common.py
parent583fb9f066e1f9aa95a404a9d6446c138d6f6167 (diff)
downloadstable-diffusion-webui-gfx803-df02498d03e4296b7d7581aff69571a49be1d27a.tar.gz
stable-diffusion-webui-gfx803-df02498d03e4296b7d7581aff69571a49be1d27a.tar.bz2
stable-diffusion-webui-gfx803-df02498d03e4296b7d7581aff69571a49be1d27a.zip
add an option to show selected setting in main txt2img/img2img UI
split some code from ui.py into ui_settings.py ui_gradio_edxtensions.py add before_process callback for scripts add ability for alwayson scripts to specify section and let user reorder those sections
Diffstat (limited to 'modules/ui_common.py')
-rw-r--r--modules/ui_common.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/modules/ui_common.py b/modules/ui_common.py
index 5a9204a4..57c2d0ad 100644
--- a/modules/ui_common.py
+++ b/modules/ui_common.py
@@ -10,8 +10,11 @@ import subprocess as sp
from modules import call_queue, shared
from modules.generation_parameters_copypaste import image_from_url_text
import modules.images
+from modules.ui_components import ToolButton
+
folder_symbol = '\U0001f4c2' # 📂
+refresh_symbol = '\U0001f504' # 🔄
def update_generation_info(generation_info, html_info, img_index):
@@ -216,3 +219,23 @@ Requested path was: {f}
))
return result_gallery, generation_info if tabname != "extras" else html_info_x, html_info, html_log
+
+
+def create_refresh_button(refresh_component, refresh_method, refreshed_args, elem_id):
+ def refresh():
+ refresh_method()
+ args = refreshed_args() if callable(refreshed_args) else refreshed_args
+
+ for k, v in args.items():
+ setattr(refresh_component, k, v)
+
+ return gr.update(**(args or {}))
+
+ refresh_button = ToolButton(value=refresh_symbol, elem_id=elem_id)
+ refresh_button.click(
+ fn=refresh,
+ inputs=[],
+ outputs=[refresh_component]
+ )
+ return refresh_button
+