From 2270580a4041c3ba21871065299ee343852f4ade Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sun, 17 May 2026 09:59:38 +0200 Subject: [PATCH] improve settings search Signed-off-by: Vladimir Mandic --- CHANGELOG.md | 1 + extensions-builtin/sdnext-modernui | 2 +- javascript/settings.js | 36 +++++++++++++++++++++--------- modules/ui_definitions.py | 2 ++ 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc7bbd317..39f300fae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ - custom `vae` loader - `attention` execution guard against `cpu` tensors - downloaded diffuser model use `snapshot` path + - improve `settings` search ## Update for 2026-05-13 diff --git a/extensions-builtin/sdnext-modernui b/extensions-builtin/sdnext-modernui index 7ddd8957f..19aa1d756 160000 --- a/extensions-builtin/sdnext-modernui +++ b/extensions-builtin/sdnext-modernui @@ -1 +1 @@ -Subproject commit 7ddd8957fa77d2d3ff0fb4a3ad89e84a7cf3ced3 +Subproject commit 19aa1d756247dc5626af00639e243fd698f0fc32 diff --git a/javascript/settings.js b/javascript/settings.js index d23229efe..97d076627 100644 --- a/javascript/settings.js +++ b/javascript/settings.js @@ -138,19 +138,33 @@ async function onAfterUiUpdateCallback() { const settingsSearch = gradioApp().querySelectorAll('#settings_search > label > textarea')[0]; let settingsTimer; + let settingSearchValue = ''; + + function doSettingsSearch() { + if (settingSearchValue === settingsSearch.value.trim().toLowerCase()) return; + showAllSettings(); + const value = settingsSearch.value.trim().toLowerCase(); + log('doSettingsSearch', value); + settingSearchValue = value; + getSettingsTabs().forEach((section) => { + section.querySelectorAll('.dirtyable').forEach((setting) => { + const visible = setting.innerText.toLowerCase().includes(value) || setting.id.toLowerCase().includes(value); + const parent = setting.closest('.settings_section'); + if (!visible) parent.style.display = 'none'; + else parent.style.removeProperty('display'); + }); + }); + } + settingsSearch.oninput = (e) => { if (settingsTimer) clearTimeout(settingsTimer); - settingsTimer = setTimeout(() => { - log('settingsSearch', e.target.value); - showAllSettings(); - getSettingsTabs().forEach((section) => { - section.querySelectorAll('.dirtyable').forEach((setting) => { - const visible = setting.innerText.toLowerCase().includes(e.target.value.toLowerCase()) || setting.id.toLowerCase().includes(e.target.value.toLowerCase()); - if (!visible) setting.style.display = 'none'; - else setting.style.removeProperty('display'); - }); - }); - }, 250); + settingsTimer = setTimeout(doSettingsSearch, 250); + }; + settingsSearch.onkeypress = (e) => { + if (e.key === 'Enter') { + if (settingsTimer) clearTimeout(settingsTimer); + doSettingsSearch(); + } }; } diff --git a/modules/ui_definitions.py b/modules/ui_definitions.py index 26ea78b82..f57f4a997 100644 --- a/modules/ui_definitions.py +++ b/modules/ui_definitions.py @@ -140,6 +140,7 @@ def create_settings(cmd_opts): # --- Model Quantization --- options_templates.update(options_section(("quantization", "Model Quantization"), { + "quantize_sep": OptionInfo("

Quantization General

", "", gr.HTML), "models_not_to_quant": OptionInfo("", "Model types not to quantize"), "sdnq_quantize_sep": OptionInfo("

SDNQ: SD.Next Quantization

", "", gr.HTML), @@ -570,6 +571,7 @@ def create_settings(cmd_opts): # --- Postprocessing --- options_templates.update(options_section(('postprocessing', "Postprocessing"), { + "postprocessing_sep": OptionInfo("

Postprocessing Operations

", "", gr.HTML), 'postprocessing_enable_in_main_ui': OptionInfo([], "Additional postprocessing operations", gr.Dropdown, lambda: {"multiselect":True, "choices": [x.name for x in shared_items.postprocessing_scripts()]}), 'postprocessing_operation_order': OptionInfo([], "Postprocessing operation order", gr.Dropdown, lambda: {"multiselect":True, "choices": [x.name for x in shared_items.postprocessing_scripts()], "visible": False }),