diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2022-09-12 10:24:14 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-12 10:24:14 +0000 |
commit | 051e9195f14e9ac1a9bdff0de58454a5e7e387fd (patch) | |
tree | 881d96f0c84ad7f990e4fbb0ca1cdd2f3039ec4b /modules/ui.py | |
parent | ddc86f2edb1db6ac3b708cf4a6ad6da5601d778c (diff) | |
parent | c094f00e100f28f05bbef1b7572f38940ca27862 (diff) | |
download | stable-diffusion-webui-gfx803-051e9195f14e9ac1a9bdff0de58454a5e7e387fd.tar.gz stable-diffusion-webui-gfx803-051e9195f14e9ac1a9bdff0de58454a5e7e387fd.tar.bz2 stable-diffusion-webui-gfx803-051e9195f14e9ac1a9bdff0de58454a5e7e387fd.zip |
Merge pull request #295 from EyeDeck/master
Add --hide-ui-dir-config command line flag
Diffstat (limited to 'modules/ui.py')
-rw-r--r-- | modules/ui.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/modules/ui.py b/modules/ui.py index e407041c..3a28bdab 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -661,19 +661,20 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): info = opts.data_labels[key]
t = type(info.default)
+ args = info.component_args() if callable(info.component_args) else info.component_args
+
if info.component is not None:
- args = info.component_args() if callable(info.component_args) else info.component_args
- item = info.component(label=info.label, value=fun, **(args or {}))
+ comp = info.component
elif t == str:
- item = gr.Textbox(label=info.label, value=fun, lines=1)
+ comp = gr.Textbox
elif t == int:
- item = gr.Number(label=info.label, value=fun)
+ comp = gr.Number
elif t == bool:
- item = gr.Checkbox(label=info.label, value=fun)
+ comp = gr.Checkbox
else:
raise Exception(f'bad options item type: {str(t)} for key {key}')
- return item
+ return comp(label=info.label, value=fun, **(args or {}))
components = []
keys = list(opts.data_labels.keys())
@@ -684,6 +685,10 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo): up = []
for key, value, comp in zip(opts.data_labels.keys(), args, components):
+ comp_args = opts.data_labels[key].component_args
+ if comp_args and isinstance(comp_args, dict) and comp_args.get('visible') is False:
+ continue
+
opts.data[key] = value
up.append(comp.update(value=value))
|