Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update shared.opts.data when add_option #12957

Merged
merged 1 commit into from
Sep 9, 2023

Conversation

AnyISalIn
Copy link
Contributor

@AnyISalIn AnyISalIn commented Sep 1, 2023

Description

If we add a new option but don't save it in config.json, we won't be able to set it in

stored_opts = {k: opts.data[k] for k in p.override_settings.keys()}

This will result in a KeyError being raised for opts.data[k]

for example, we will override control_net_no_detectmap parameters, if we have no save it in config.json, we cannot to set it in API.

Screenshots/videos:

Checklist:

Signed-off-by: AnyISalIn <anyisalin@gmail.com>
@AnyISalIn AnyISalIn changed the title fix: update shared.opts.data when add_otpion fix: update shared.opts.data when add_option Sep 1, 2023
@AUTOMATIC1111 AUTOMATIC1111 merged commit e06c16e into AUTOMATIC1111:dev Sep 9, 2023
3 checks passed
@catboxanon
Copy link
Collaborator

catboxanon commented Sep 12, 2023

This is now causing the default option(s) of extensions to be set on startup regardless of what the user has configured for themself.

@w-e-w
Copy link
Collaborator

w-e-w commented Sep 12, 2023

I notice this is just now too
basically any extensions use shared.opts.add_option to add options would have the the value displayed set to default on webui load and if now one presses apply settings
the settings will be nuke to default in settings files

extensions using this method is fine

shared.options_templates.update(shared.options_section(('canvas_hotkey', "Canvas Hotkeys"), {
"canvas_hotkey_zoom": shared.OptionInfo("Alt", "Zoom canvas", gr.Radio, {"choices": ["Shift","Ctrl", "Alt"]}).info("If you choose 'Shift' you cannot scroll horizontally, 'Alt' can cause a little trouble in firefox"),
"canvas_hotkey_adjust": shared.OptionInfo("Ctrl", "Adjust brush size", gr.Radio, {"choices": ["Shift","Ctrl", "Alt"]}).info("If you choose 'Shift' you cannot scroll horizontally, 'Alt' can cause a little trouble in firefox"),
"canvas_hotkey_move": shared.OptionInfo("F", "Moving the canvas").info("To work correctly in firefox, turn off 'Automatically search the page text when typing' in the browser settings"),
"canvas_hotkey_fullscreen": shared.OptionInfo("S", "Fullscreen Mode, maximizes the picture so that it fits into the screen and stretches it to its full width "),
"canvas_hotkey_reset": shared.OptionInfo("R", "Reset zoom and canvas positon"),
"canvas_hotkey_overlap": shared.OptionInfo("O", "Toggle overlap").info("Technical button, neededs for testing"),
"canvas_show_tooltip": shared.OptionInfo(True, "Enable tooltip on the canvas"),
"canvas_auto_expand": shared.OptionInfo(True, "Automatically expands an image that does not fit completely in the canvas area, similar to manually pressing the S and R buttons"),
"canvas_blur_prompt": shared.OptionInfo(False, "Take the focus off the prompt when working with a canvas"),
"canvas_disabled_functions": shared.OptionInfo(["Overlap"], "Disable function that you don't use", gr.CheckboxGroup, {"choices": ["Zoom","Adjust brush size", "Moving canvas","Fullscreen","Reset Zoom","Overlap"]}),
}))

@w-e-w w-e-w mentioned this pull request Dec 4, 2023
@w-e-w w-e-w mentioned this pull request Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants