AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
141.78k stars 26.78k forks source link

[Feature Request]: Opt out from loadsave "Default" system when making an extension ? #10906

Open Nevysha opened 1 year ago

Nevysha commented 1 year ago

Is there an existing issue for this?

What would your feature do ?

Is there a way to opt out from the system that save the UI state of gradio elem when making an extension ?

for interface, _label, ifid in interfaces:
                if ifid in ["extensions", "settings"]:
                    continue

                loadsave.add_block(interface, ifid)

Regards

Proposed workflow

  1. Go to ....
  2. Press ....
  3. ...

Additional information

No response

w-e-w commented 1 year ago

@Nevysha yes but not exactly it's not opting out from the default system but it's opting out for the entire ui-config.json as they're tied together together

if you can set the attribute to do_not_save_to_config to True this will exclude the element from ui-config.json

https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/5ef669de080814067961f28357256e8fe27544f4/modules/ui_loadsave.py#L48-L49

example

enable = gr.Checkbox(label='your label', value=False)
enable.do_not_save_to_config = True
# or
setattr(enable, "do_not_save_to_config", True)

example of someone actually using this in an extension https://github.com/wcde/sd-webui-refiner/blob/0ad12e75339e857c7539bbbdf6a125f1cdd6fa96/scripts/refiner.py#L85-L95