defauls state is None, state and sizes are not updated when Save or Reload is pressed

This commit is contained in:
EtSL33py
2024-09-20 03:30:11 +03:00
parent 844f286f24
commit 7a5d19eeec
2 changed files with 36 additions and 31 deletions

View File

@@ -200,7 +200,7 @@ def ui_rules():
Rule("sidebar-control-always-compact", False, bool), Rule("sidebar-control-always-compact", False, bool),
Rule("sidebar-default-width", 0.5, float, 0.0, 1.0), Rule("sidebar-default-width", 0.5, float, 0.0, 1.0),
Rule("sidebar-default-height", 0.5, float, 0.0, 1.0), Rule("sidebar-default-height", 0.5, float, 0.0, 1.0),
Rule("sidebar-default-state", "Left", str), Rule("sidebar-default-state", "None", str),
Rule("text-input-always-hide-search-button", False, bool), Rule("text-input-always-hide-search-button", False, bool),
Rule("text-input-always-hide-clear-button", False, bool), Rule("text-input-always-hide-clear-button", False, bool),

View File

@@ -4611,7 +4611,7 @@ class SettingsView {
}), }),
$select({ $select({
$: (el) => (settings['sidebar-default-state'] = el), $: (el) => (settings['sidebar-default-state'] = el),
textContent: 'Default model manager position', textContent: 'Default model manager position (on start up)',
options: ['Left', 'Right', 'Top', 'Bottom', 'None'], options: ['Left', 'Right', 'Top', 'Bottom', 'None'],
}), }),
$checkbox({ $checkbox({
@@ -5356,37 +5356,27 @@ class ModelManager extends ComfyDialog {
async #init() { async #init() {
await this.#settingsView.reload(false); await this.#settingsView.reload(false);
await this.#refreshModels(); await this.#refreshModels();
}
#updateSidebarSettings = (settings) => { const settings = this.#settingsView.elements.settings;
const newSidebarState = settings['sidebar-default-state'].value;
let buttonNumb = 0;
if (newSidebarState === 'Left') {
buttonNumb = 4;
} else if (newSidebarState === 'Right') {
buttonNumb = 1;
} else if (newSidebarState === 'Top') {
buttonNumb = 2;
} else if (newSidebarState === 'Bottom') {
buttonNumb = 3;
}
if(!this.#sidebarButtonGroup.children[buttonNumb].classList.contains('radio-button-group-active')){
this.#sidebarButtonGroup.children[buttonNumb].click();
}
{ {
// initialize buttons' visibility state // set initial sidebar state
const hideSearchButtons = const newSidebarState = settings['sidebar-default-state'].value;
settings['text-input-always-hide-search-button'].checked; let buttonNumb = 0;
const hideClearSearchButtons = if (newSidebarState === 'Right') {
settings['text-input-always-hide-clear-button'].checked; buttonNumb = 1;
this.#downloadView.elements.searchButton.style.display = hideSearchButtons } else if (newSidebarState === 'Top') {
? 'none' buttonNumb = 2;
: ''; } else if (newSidebarState === 'Bottom') {
this.#downloadView.elements.clearSearchButton.style.display = buttonNumb = 3;
hideClearSearchButtons ? 'none' : ''; } else if (newSidebarState === 'Left') {
} buttonNumb = 4;
}
const button = this.#sidebarButtonGroup.children[buttonNumb];
if(!button.classList.contains('radio-button-group-active')){
button.click();
}
}
{ {
// set initial sidebar widths & heights // set initial sidebar widths & heights
@@ -5430,6 +5420,21 @@ class ModelManager extends ComfyDialog {
} }
} }
#updateSidebarSettings = (settings) => {
{
// update buttons' visibility state
const hideSearchButtons =
settings['text-input-always-hide-search-button'].checked;
const hideClearSearchButtons =
settings['text-input-always-hide-clear-button'].checked;
this.#downloadView.elements.searchButton.style.display = hideSearchButtons
? 'none'
: '';
this.#downloadView.elements.clearSearchButton.style.display =
hideClearSearchButtons ? 'none' : '';
}
}
#resetManagerContentsScroll = () => { #resetManagerContentsScroll = () => {
this.#tabManagerContents.scrollTop = 0; this.#tabManagerContents.scrollTop = 0;
}; };