aboutsummaryrefslogtreecommitdiffstats
path: root/modules/scripts.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2023-05-09 19:42:37 +0000
committerAUTOMATIC <16777216c@gmail.com>2023-05-09 19:42:37 +0000
commitc8791c1d37502f162b8616b066303bfadc4a749b (patch)
tree6843c3505117f26549dfe1dc9cd40aacd5ccdfd3 /modules/scripts.py
parent6fbd85dd0c0dffc06560bff91f4c4b65e441ca5f (diff)
parent31397986e70d20e392d9c3ec70d3aef8ecc2c1ff (diff)
downloadstable-diffusion-webui-gfx803-c8791c1d37502f162b8616b066303bfadc4a749b.tar.gz
stable-diffusion-webui-gfx803-c8791c1d37502f162b8616b066303bfadc4a749b.tar.bz2
stable-diffusion-webui-gfx803-c8791c1d37502f162b8616b066303bfadc4a749b.zip
Merge branch 'dev' into release_candidate
Diffstat (limited to 'modules/scripts.py')
-rw-r--r--modules/scripts.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/scripts.py b/modules/scripts.py
index 4d0bbd66..d945b89f 100644
--- a/modules/scripts.py
+++ b/modules/scripts.py
@@ -163,7 +163,8 @@ class Script:
"""helper function to generate id for a HTML element, constructs final id out of script name, tab and user-supplied item_id"""
need_tabname = self.show(True) == self.show(False)
- tabname = ('img2img' if self.is_img2img else 'txt2txt') + "_" if need_tabname else ""
+ tabkind = 'img2img' if self.is_img2img else 'txt2txt'
+ tabname = f"{tabkind}_" if need_tabname else ""
title = re.sub(r'[^a-z_0-9]', '', re.sub(r'\s', '_', self.title().lower()))
return f'script_{tabname}{title}_{item_id}'
@@ -526,7 +527,7 @@ def add_classes_to_gradio_component(comp):
this adds gradio-* to the component for css styling (ie gradio-button to gr.Button), as well as some others
"""
- comp.elem_classes = ["gradio-" + comp.get_block_name(), *(comp.elem_classes or [])]
+ comp.elem_classes = [f"gradio-{comp.get_block_name()}", *(comp.elem_classes or [])]
if getattr(comp, 'multiselect', False):
comp.elem_classes.append('multiselect')